From 4d228bd558efed70842a16360b600ad3ce2236ca Mon Sep 17 00:00:00 2001 From: "lixuefei.1313" Date: Mon, 17 Jun 2024 16:58:24 +0800 Subject: [PATCH 01/16] fix: fix the issue issue with stacked waterfall charts where positive and negative values were not stacked separately when there were both positive and negative values in the same stack --- .../vchart/src/data/transforms/waterfall.ts | 53 ++++++++++++++----- 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/packages/vchart/src/data/transforms/waterfall.ts b/packages/vchart/src/data/transforms/waterfall.ts index ac87846d48..bc2f82b0b0 100644 --- a/packages/vchart/src/data/transforms/waterfall.ts +++ b/packages/vchart/src/data/transforms/waterfall.ts @@ -18,6 +18,8 @@ type TotalInfo = { lastEnd: number; index: string; isTotal: boolean; + positive: number; + negative: number; }; export interface IWaterfallOpt { @@ -47,6 +49,8 @@ export const waterfall = (lastData: Array, op: IWaterfallOpt) => { lastEnd: number; index: string; isTotal: boolean; + positive: number; + negative: number; }[] = []; const { dimensionValues, dimensionData } = groupData().latestData as { dimensionValues: { [key in string]: Set }; @@ -54,7 +58,13 @@ export const waterfall = (lastData: Array, op: IWaterfallOpt) => { }; const indexValues = Array.from(dimensionValues[indexField]); // 上一次的计算结果 - let temp: { start: number; end: number; lastIndex: string } = { start: 0, end: 0, lastIndex: null }; + let temp: { start: number; end: number; lastIndex: string; positive: number; negative: number } = { + start: 0, + end: 0, + positive: 0, + negative: 0, + lastIndex: null + }; indexValues.forEach((key, index) => { const total = { start: temp.end, @@ -62,7 +72,9 @@ export const waterfall = (lastData: Array, op: IWaterfallOpt) => { lastIndex: temp.lastIndex, lastEnd: temp.end, index: key, - isTotal: false + isTotal: false, + positive: temp.end, + negative: temp.end }; const indexData = dimensionData[key]; @@ -115,7 +127,7 @@ function computeTotalWithMultipleData( key: string, total: TotalInfo, totalData: TotalInfo[], - temp: { start: number; end: number; lastIndex: string }, + temp: { start: number; end: number; lastIndex: string; positive: number; negative: number }, indexValues: string[], index: number, op: IWaterfallOpt, @@ -153,14 +165,21 @@ function computeTotalWithMultipleData( let { start, end } = getTotalStartEnd(totalConfigData, total, totalData, temp, totalSpec); total.start = start; total.end = end; + const positive = start; + const navigate = start; // 当前剩余的总计值 let valueTemp = end - start; // 将非总计数据进行堆叠 _normalTemp.forEach(d => { - d[startAs] = +start; - d[endAs] = precisionAdd(d[startAs], +d[valueField]); - start = d[endAs]; - valueTemp = precisionSub(valueTemp, +d[valueField]); + const value = +d[valueField]; + if (value >= 0) { + d[startAs] = +positive; + } else { + d[startAs] = +navigate; + } + d[endAs] = precisionAdd(d[startAs], value); + start = precisionAdd(start, value); + valueTemp = precisionSub(valueTemp, value); }); // 先在的start end 就是 total 的 _totalTemp.forEach(d => { @@ -176,7 +195,7 @@ function computeNormalData( key: string, total: TotalInfo, totalData: TotalInfo[], - temp: { start: number; end: number; lastIndex: string }, + temp: { start: number; end: number; lastIndex: string; positive: number; negative: number }, indexValues: string[], index: number, op: IWaterfallOpt @@ -204,9 +223,17 @@ function computeNormalData( } } if (!isTotalTag) { - d[startAs] = +total.end; - d[endAs] = precisionAdd(d[startAs], +d[valueField]); - total.end = d[endAs]; + const value = +d[valueField]; + // 区分正负值 + if (value >= 0) { + d[startAs] = +total.positive; + total.positive = precisionAdd(total.positive, value); + } else { + d[startAs] = +total.negative; + total.negative = precisionAdd(total.negative, value); + } + d[endAs] = precisionAdd(d[startAs], value); + total.end = precisionAdd(total.end, value); } total.isTotal = isTotalTag; @@ -225,7 +252,7 @@ function getTotalStartEnd( d: Datum, total: TotalInfo, totalData: TotalInfo[], - temp: { start: number; end: number; lastIndex: string }, + temp: { start: number; end: number; lastIndex: string; positive: number; negative: number }, totalSpec: IWaterfallOpt['total'] ) { if (!totalSpec || totalSpec.type === 'end') { @@ -249,7 +276,7 @@ function getTotalInEndType(total: TotalInfo) { function getTotalInCustomType( d: Datum, - temp: { start: number; end: number; lastIndex: string }, + temp: { start: number; end: number; lastIndex: string; positive: number; negative: number }, totalSpec: IWaterfallOpt['total'] ) { return (totalSpec).product(d, temp); From 716132bdc533f93ac7a0a1f47a98046b3f18e1ea Mon Sep 17 00:00:00 2001 From: "lixuefei.1313" Date: Mon, 17 Jun 2024 16:59:06 +0800 Subject: [PATCH 02/16] docs: update changlog of rush --- ...fix-waterfall-stack-navigate_2024-06-17-08-59.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vchart/fix-waterfall-stack-navigate_2024-06-17-08-59.json diff --git a/common/changes/@visactor/vchart/fix-waterfall-stack-navigate_2024-06-17-08-59.json b/common/changes/@visactor/vchart/fix-waterfall-stack-navigate_2024-06-17-08-59.json new file mode 100644 index 0000000000..9d8d90c89d --- /dev/null +++ b/common/changes/@visactor/vchart/fix-waterfall-stack-navigate_2024-06-17-08-59.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: fix the issue issue with stacked waterfall charts where positive and negative values were not stacked separately when there were both positive and negative values in the same stack\n\n", + "type": "none", + "packageName": "@visactor/vchart" + } + ], + "packageName": "@visactor/vchart", + "email": "lixuef1313@163.com" +} \ No newline at end of file From 8c6aa0a1e702ed8b3d2e7156665bef424084e7d7 Mon Sep 17 00:00:00 2001 From: Kuiliang Zhang Date: Mon, 17 Jun 2024 20:23:01 -0700 Subject: [PATCH 03/16] docs: fix path of preview image and relavant docs --- CONTRIBUTING.md | 14 +++++++------- CONTRIBUTING.zh-CN.md | 8 ++++---- .../examples/en/bar-chart/bar-customized-label.md | 2 +- .../examples/zh/bar-chart/bar-customized-label.md | 2 +- .../guide/en/tutorial_docs/Contribution_Guide.md | 14 +++++++------- .../guide/zh/tutorial_docs/Contribution_Guide.md | 8 ++++---- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 85944bd48e..bed10a2d85 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -164,16 +164,16 @@ You can get started with using VChart through this type of task. VChart provides After completing the task, you can submit the self-made case to the official website demo for more people in need to learn and use. -All demos are stored in the `docs/assets/examples `directory +All demos are stored in the `docs/assets/examples` directory -1. Please create a new `docs/*** `or `demo/*** `branch based on the develop branch for development +1. Please create a new `docs/***` or `demo/***` branch based on the develop branch for development 2. (If you have already installed, skip this step) Global installation [@microsoft/rush](https://rushjs.io/pages/intro/get_started/): `npm i --global @microsoft/rush` 3. Run `rush update` -4. Run `rush docs `to preview the current demo content locally -5. `Docs `directory - 1. `Docs/assets/examples/menu.json `Add your demo information to the directory file - 2. Complete the Chinese and English demo documents in the `zh `/ `en `directory respectively - 3. Add the demo preview image in the `docs/public/vchart/preview `directory and update the relative path in the demo document +4. Run `rush docs` to preview the current demo content locally +5. `Docs` directory + 1. `Docs/assets/examples/menu.json` Add your demo information to the directory file + 2. Complete the Chinese and English demo documents in the `zh`/`en` directory respectively + 3. Add the demo preview image in the `docs/public/vchart/preview` directory and update the path in the demo document accordingly, for example, `/vchart/preview/basic-map_1.9.1.png` 6. Submit all code and create a Pull Request on Github, inviting others to review ### Feature Task Development Guide diff --git a/CONTRIBUTING.zh-CN.md b/CONTRIBUTING.zh-CN.md index d4af570d94..624a01b0be 100644 --- a/CONTRIBUTING.zh-CN.md +++ b/CONTRIBUTING.zh-CN.md @@ -163,14 +163,14 @@ VChart 的入门问题,你可以通过 [issue 列表](https://github.com/VisAc 所有的 demo 存放在 `docs/assets/examples` 目录下 -1. 请基于 develop 分支,新拉一个 `docs/***`或 `demo/***` 分支进行开发 +1. 请基于 develop 分支,新拉一个 `docs/***` 或 `demo/***` 分支进行开发 2. (如果你已经安装,请跳过此步骤)全局安装 [@microsoft/rush](https://rushjs.io/pages/intro/get_started/):`npm i --global @microsoft/rush` 3. 根目录下运行 `rush update` -4. 运行`rush docs` 在本地预览目前 demo 内容 +4. 运行 `rush docs` 在本地预览目前 demo 内容 5. `docs` 目录下: 1. `docs/assets/examples/menu.json` 目录文件中添加你的 demo 信息 - 2. 在`zh`/`en`目录下分别完成中英文 demo 文档 - 3. 在 `docs/public/vchart/preview`目录下添加 demo 预览图片并将相对路径更新在 demo 文档中 + 2. 在 `zh`/`en` 目录下分别完成中英文 demo 文档 + 3. 在 `docs/public/vchart/preview` 目录下添加 demo 预览图片并将路径更新在 demo 文档中,例如 `/vchart/preview/basic-map_1.9.1.png` 6. 提交所有代码,并在 Github 创建 Pull Request,邀请其他人进行 review ### Feature Task 开发指南 diff --git a/docs/assets/examples/en/bar-chart/bar-customized-label.md b/docs/assets/examples/en/bar-chart/bar-customized-label.md index 81e0b4da6b..e477280cb5 100644 --- a/docs/assets/examples/en/bar-chart/bar-customized-label.md +++ b/docs/assets/examples/en/bar-chart/bar-customized-label.md @@ -3,7 +3,7 @@ category: examples group: bar chart title: Bar chart with custom label keywords: barChart,comparison,distribution,rectangle,comparison,rank,axis,label -cover: ../../../../public/vchart/preview/bar-customized-label-en_1.11.1.png +cover: /vchart/preview/bar-customized-label-en_1.11.1.png option: barChart --- diff --git a/docs/assets/examples/zh/bar-chart/bar-customized-label.md b/docs/assets/examples/zh/bar-chart/bar-customized-label.md index 64773e4481..addb61d9bf 100644 --- a/docs/assets/examples/zh/bar-chart/bar-customized-label.md +++ b/docs/assets/examples/zh/bar-chart/bar-customized-label.md @@ -3,7 +3,7 @@ category: examples group: bar chart title: 自定义标签的条形图 keywords: barChart,comparison,distribution,rectangle,comparison,rank,axis,label -cover: ../../../../public/vchart/preview/bar-customized-label_1.11.1.png +cover: /vchart/preview/bar-customized-label_1.11.1.png option: barChart --- diff --git a/docs/assets/guide/en/tutorial_docs/Contribution_Guide.md b/docs/assets/guide/en/tutorial_docs/Contribution_Guide.md index 85944bd48e..bed10a2d85 100644 --- a/docs/assets/guide/en/tutorial_docs/Contribution_Guide.md +++ b/docs/assets/guide/en/tutorial_docs/Contribution_Guide.md @@ -164,16 +164,16 @@ You can get started with using VChart through this type of task. VChart provides After completing the task, you can submit the self-made case to the official website demo for more people in need to learn and use. -All demos are stored in the `docs/assets/examples `directory +All demos are stored in the `docs/assets/examples` directory -1. Please create a new `docs/*** `or `demo/*** `branch based on the develop branch for development +1. Please create a new `docs/***` or `demo/***` branch based on the develop branch for development 2. (If you have already installed, skip this step) Global installation [@microsoft/rush](https://rushjs.io/pages/intro/get_started/): `npm i --global @microsoft/rush` 3. Run `rush update` -4. Run `rush docs `to preview the current demo content locally -5. `Docs `directory - 1. `Docs/assets/examples/menu.json `Add your demo information to the directory file - 2. Complete the Chinese and English demo documents in the `zh `/ `en `directory respectively - 3. Add the demo preview image in the `docs/public/vchart/preview `directory and update the relative path in the demo document +4. Run `rush docs` to preview the current demo content locally +5. `Docs` directory + 1. `Docs/assets/examples/menu.json` Add your demo information to the directory file + 2. Complete the Chinese and English demo documents in the `zh`/`en` directory respectively + 3. Add the demo preview image in the `docs/public/vchart/preview` directory and update the path in the demo document accordingly, for example, `/vchart/preview/basic-map_1.9.1.png` 6. Submit all code and create a Pull Request on Github, inviting others to review ### Feature Task Development Guide diff --git a/docs/assets/guide/zh/tutorial_docs/Contribution_Guide.md b/docs/assets/guide/zh/tutorial_docs/Contribution_Guide.md index d4af570d94..624a01b0be 100644 --- a/docs/assets/guide/zh/tutorial_docs/Contribution_Guide.md +++ b/docs/assets/guide/zh/tutorial_docs/Contribution_Guide.md @@ -163,14 +163,14 @@ VChart 的入门问题,你可以通过 [issue 列表](https://github.com/VisAc 所有的 demo 存放在 `docs/assets/examples` 目录下 -1. 请基于 develop 分支,新拉一个 `docs/***`或 `demo/***` 分支进行开发 +1. 请基于 develop 分支,新拉一个 `docs/***` 或 `demo/***` 分支进行开发 2. (如果你已经安装,请跳过此步骤)全局安装 [@microsoft/rush](https://rushjs.io/pages/intro/get_started/):`npm i --global @microsoft/rush` 3. 根目录下运行 `rush update` -4. 运行`rush docs` 在本地预览目前 demo 内容 +4. 运行 `rush docs` 在本地预览目前 demo 内容 5. `docs` 目录下: 1. `docs/assets/examples/menu.json` 目录文件中添加你的 demo 信息 - 2. 在`zh`/`en`目录下分别完成中英文 demo 文档 - 3. 在 `docs/public/vchart/preview`目录下添加 demo 预览图片并将相对路径更新在 demo 文档中 + 2. 在 `zh`/`en` 目录下分别完成中英文 demo 文档 + 3. 在 `docs/public/vchart/preview` 目录下添加 demo 预览图片并将路径更新在 demo 文档中,例如 `/vchart/preview/basic-map_1.9.1.png` 6. 提交所有代码,并在 Github 创建 Pull Request,邀请其他人进行 review ### Feature Task 开发指南 From 55031057484b83e86e9e34254f5e059f17818ba3 Mon Sep 17 00:00:00 2001 From: xiaoluoHe Date: Tue, 18 Jun 2024 17:54:29 +0800 Subject: [PATCH 04/16] feat: optimize legend pager color in dark theme --- .../common/component/legend/discrete-legend.ts | 15 +++++++++++++++ .../vchart/src/theme/builtin/dark/color-scheme.ts | 9 ++++++++- .../src/theme/builtin/light/color-scheme.ts | 9 ++++++++- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/packages/vchart/src/theme/builtin/common/component/legend/discrete-legend.ts b/packages/vchart/src/theme/builtin/common/component/legend/discrete-legend.ts index da1badaab3..c6be350689 100644 --- a/packages/vchart/src/theme/builtin/common/component/legend/discrete-legend.ts +++ b/packages/vchart/src/theme/builtin/common/component/legend/discrete-legend.ts @@ -16,6 +16,21 @@ export const discreteLegend: IDiscreteLegendTheme = { }, 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: true, spaceCol: 10, diff --git a/packages/vchart/src/theme/builtin/dark/color-scheme.ts b/packages/vchart/src/theme/builtin/dark/color-scheme.ts index 0bbdde01dd..2158347cd0 100644 --- a/packages/vchart/src/theme/builtin/dark/color-scheme.ts +++ b/packages/vchart/src/theme/builtin/dark/color-scheme.ts @@ -66,7 +66,14 @@ export const colorScheme: IThemeColorScheme = { /** 成功色 */ successColor: '#14b267', /** 信息色 */ - infoColor: '#4284ff' + infoColor: '#4284ff', + + /** 图例翻页器文字颜色 */ + discreteLegendPagerTextColor: '#BBBDC3', + /** 图例翻页器按钮颜色 */ + discreteLegendPagerHandlerColor: '#BBBDC3', + /** 图例翻页器按钮颜色(disable 态) */ + discreteLegendPagerHandlerDisableColor: '#55595F' } as BuiltinColorPalette } }; diff --git a/packages/vchart/src/theme/builtin/light/color-scheme.ts b/packages/vchart/src/theme/builtin/light/color-scheme.ts index 047a47f9bb..402fcb3006 100644 --- a/packages/vchart/src/theme/builtin/light/color-scheme.ts +++ b/packages/vchart/src/theme/builtin/light/color-scheme.ts @@ -66,7 +66,14 @@ export const colorScheme: IThemeColorScheme = { /** 成功色 */ successColor: '#07a35a', /** 信息色 */ - infoColor: '#3073f2' + infoColor: '#3073f2', + + /** 图例翻页器文字颜色 */ + discreteLegendPagerTextColor: 'rgb(51, 51, 51)', + /** 图例翻页器按钮颜色 */ + discreteLegendPagerHandlerColor: 'rgb(47, 69, 84)', + /** 图例翻页器按钮颜色(disable 态) */ + discreteLegendPagerHandlerDisableColor: 'rgb(170, 170, 170)' } as BuiltinColorPalette } }; From cc9d0da93861d08088c10e163278536e0394f67a Mon Sep 17 00:00:00 2001 From: xiaoluoHe Date: Tue, 18 Jun 2024 17:59:40 +0800 Subject: [PATCH 05/16] docs: update change log --- ...ze-legend-pager-in-dark-theme_2024-06-18-09-59.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 common/changes/@visactor/vchart/feat-optimize-legend-pager-in-dark-theme_2024-06-18-09-59.json diff --git a/common/changes/@visactor/vchart/feat-optimize-legend-pager-in-dark-theme_2024-06-18-09-59.json b/common/changes/@visactor/vchart/feat-optimize-legend-pager-in-dark-theme_2024-06-18-09-59.json new file mode 100644 index 0000000000..ce024a0eb3 --- /dev/null +++ b/common/changes/@visactor/vchart/feat-optimize-legend-pager-in-dark-theme_2024-06-18-09-59.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vchart", + "comment": "fix: optimize discrete legend pager color in dark theme, related #2654", + "type": "none" + } + ], + "packageName": "@visactor/vchart" +} \ No newline at end of file From b669bf815c81c30a4058e94500f866524bd068a2 Mon Sep 17 00:00:00 2001 From: xile611 Date: Tue, 18 Jun 2024 11:36:47 +0000 Subject: [PATCH 06/16] docs: generate changelog of release v1.11.4 --- docs/assets/changelog/en/release.md | 17 +++++++++++++++++ docs/assets/changelog/zh/release.md | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/docs/assets/changelog/en/release.md b/docs/assets/changelog/en/release.md index a1d9b3fbec..d7515a4bb0 100644 --- a/docs/assets/changelog/en/release.md +++ b/docs/assets/changelog/en/release.md @@ -1,3 +1,20 @@ +# v1.11.4 + +2024-06-18 + + +**🐛 Bug fix** + + - **@visactor/vchart**: fix bug of `updateSpec` when has `scales`, close [#2744](https://github.com/VisActor/VChart/issues/2744) + - **@visactor/vchart**: gauge chart might throw error when the value is close to its maximum, fix [#2783](https://github.com/VisActor/VChart/issues/2783) + - **@visactor/vchart**: fix the behavior of the gauge pointer when it exceeds the axis range, fix [#2780](https://github.com/VisActor/VChart/issues/2780) + - **@visactor/vchart**: normal animation not work when appear animation is disabled, fix [#2807](https://github.com/VisActor/VChart/issues/2807) + - **@visactor/vchart**: upgrade vrender to 0.19.10, vgrammar to 0.13.9 + + + +[more detail about v1.11.4](https://github.com/VisActor/VChart/releases/tag/v1.11.4) + # v1.11.3 2024-06-06 diff --git a/docs/assets/changelog/zh/release.md b/docs/assets/changelog/zh/release.md index 5138f49602..6f6d6682f9 100644 --- a/docs/assets/changelog/zh/release.md +++ b/docs/assets/changelog/zh/release.md @@ -1,3 +1,20 @@ +# v1.11.4 + +2024-06-18 + + +**🐛 功能修复** + + - **@visactor/vchart**: fix bug of `updateSpec` when has `scales`, close [#2744](https://github.com/VisActor/VChart/issues/2744) + - **@visactor/vchart**: gauge chart might throw error when the value is close to its maximum, fix [#2783](https://github.com/VisActor/VChart/issues/2783) + - **@visactor/vchart**: fix the behavior of the gauge pointer when it exceeds the axis range, fix [#2780](https://github.com/VisActor/VChart/issues/2780) + - **@visactor/vchart**: normal animation not work when appear animation is disabled, fix [#2807](https://github.com/VisActor/VChart/issues/2807) + - **@visactor/vchart**: upgrade vrender to 0.19.10, vgrammar to 0.13.9 + + + +[更多详情请查看 v1.11.4](https://github.com/VisActor/VChart/releases/tag/v1.11.4) + # v1.11.3 2024-06-06 From c6217279ec67c9620aecb3c89adb99fe155b4290 Mon Sep 17 00:00:00 2001 From: xile611 Date: Tue, 11 Jun 2024 18:58:56 +0800 Subject: [PATCH 07/16] feat: tooltip support `align` right --- .../src/component/tooltip/interface/theme.ts | 8 +++ .../tooltip-handler/dom/interface.ts | 1 + .../dom/model/content-model.ts | 54 +++++++++---------- .../tooltip-handler/dom/model/shape-model.ts | 8 +-- .../tooltip-handler/dom/model/title-model.ts | 19 ++++--- .../tooltip-handler/dom/utils/style.ts | 11 ++-- .../tooltip-handler/interface/style.ts | 8 +++ .../tooltip-handler/utils/attribute.ts | 30 +++++++++-- .../theme/builtin/common/component/tooltip.ts | 2 - 9 files changed, 90 insertions(+), 51 deletions(-) diff --git a/packages/vchart/src/component/tooltip/interface/theme.ts b/packages/vchart/src/component/tooltip/interface/theme.ts index b10e8628a4..b90a17b351 100644 --- a/packages/vchart/src/component/tooltip/interface/theme.ts +++ b/packages/vchart/src/component/tooltip/interface/theme.ts @@ -85,4 +85,12 @@ export interface ITooltipTheme { x?: number; y?: number; }; + /** + * @since 1.11.4 + * + * shape、key、value的对齐方式,可选项如下: + * 'left': 从左到右对齐 + * 'right': 从右到左对齐 + */ + align?: 'left' | 'right'; } diff --git a/packages/vchart/src/plugin/components/tooltip-handler/dom/interface.ts b/packages/vchart/src/plugin/components/tooltip-handler/dom/interface.ts index e3b02473f0..bbea6ac165 100644 --- a/packages/vchart/src/plugin/components/tooltip-handler/dom/interface.ts +++ b/packages/vchart/src/plugin/components/tooltip-handler/dom/interface.ts @@ -18,6 +18,7 @@ export interface IDomTooltipStyle { shapeColumn: TooltipColumnStyle; keyColumn: TooltipColumnStyle; valueColumn: TooltipColumnStyle; + align?: 'left' | 'right'; } export type TooltipColumnStyle = IMargin & { diff --git a/packages/vchart/src/plugin/components/tooltip-handler/dom/model/content-model.ts b/packages/vchart/src/plugin/components/tooltip-handler/dom/model/content-model.ts index 3c9f5e5b29..03d11f594b 100644 --- a/packages/vchart/src/plugin/components/tooltip-handler/dom/model/content-model.ts +++ b/packages/vchart/src/plugin/components/tooltip-handler/dom/model/content-model.ts @@ -1,4 +1,5 @@ import { BaseTooltipModel } from './base-tooltip-model'; +import type { ContentColumnType } from './content-column-model'; import { ContentColumnModel } from './content-column-model'; import type { Maybe } from '@visactor/vutils'; // eslint-disable-next-line no-duplicate-imports @@ -15,36 +16,35 @@ export class ContentModel extends BaseTooltipModel { if (!this.product) { this.product = this.createElement('div', ['container-box']); } - if (!this.shapeBox) { - this._initShapeBox(); + const { align } = this._option.getTooltipAttributes(); + if (align === 'right') { + if (!this.valueBox) { + this.valueBox = this._initBox('value-box', 0); + } + if (!this.keyBox) { + this.keyBox = this._initBox('key-box', 1); + } + if (!this.shapeBox) { + this.shapeBox = this._initBox('shape-box', 2); + } + } else { + if (!this.shapeBox) { + this.shapeBox = this._initBox('shape-box', 0); + } + if (!this.keyBox) { + this.keyBox = this._initBox('key-box', 1); + } + if (!this.valueBox) { + this.valueBox = this._initBox('value-box', 2); + } } - if (!this.keyBox) { - this._initKeyBox(); - } - if (!this.valueBox) { - this._initValueBox(); - } - } - - private _initShapeBox() { - const shapeBox = new ContentColumnModel(this.product!, this._option, 'shape-box', 0); - shapeBox.init(); - this.shapeBox = shapeBox; - this.children[shapeBox.childIndex] = shapeBox; - } - - private _initKeyBox() { - const keyBox = new ContentColumnModel(this.product!, this._option, 'key-box', 1); - keyBox.init(); - this.keyBox = keyBox; - this.children[keyBox.childIndex] = keyBox; } - private _initValueBox() { - const valueBox = new ContentColumnModel(this.product!, this._option, 'value-box', 2); - valueBox.init(); - this.valueBox = valueBox; - this.children[valueBox.childIndex] = valueBox; + private _initBox(className: ContentColumnType, index: number) { + const box = new ContentColumnModel(this.product!, this._option, className, index); + box.init(); + this.children[box.childIndex] = box; + return box; } setStyle(style?: Partial): void { diff --git a/packages/vchart/src/plugin/components/tooltip-handler/dom/model/shape-model.ts b/packages/vchart/src/plugin/components/tooltip-handler/dom/model/shape-model.ts index e924445535..2810fba9b8 100644 --- a/packages/vchart/src/plugin/components/tooltip-handler/dom/model/shape-model.ts +++ b/packages/vchart/src/plugin/components/tooltip-handler/dom/model/shape-model.ts @@ -54,12 +54,6 @@ export class ShapeModel extends BaseTooltipModel { } } -const builtInShape = { - // FIXME: vrender 的五角星是用 canvas api 画出来的,没有内置的 path。这里先覆盖一下,等 vrender 修复 - // eslint-disable-next-line max-len - star: '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' -}; - function getSvgHtml(option: IShapeSvgOption | undefined, valueToHtml: (value: any) => string) { if (!option?.hasShape || !option.symbolType) { return ''; @@ -74,7 +68,7 @@ function getSvgHtml(option: IShapeSvgOption | undefined, valueToHtml: (value: an const sizeNumber = pixelPropertyStrToNumber(size) as number; const createSymbol = (symbolType: string) => new Symbol({ symbolType, size: sizeNumber, fill: true }); - let symbol = createSymbol(builtInShape[symbolType] ?? symbolType); + let symbol = createSymbol(symbolType); const parsedPath = symbol.getParsedPath(); if (!parsedPath.path) { symbol = createSymbol(parsedPath.pathStr); diff --git a/packages/vchart/src/plugin/components/tooltip-handler/dom/model/title-model.ts b/packages/vchart/src/plugin/components/tooltip-handler/dom/model/title-model.ts index 4d951a6755..49907882b8 100644 --- a/packages/vchart/src/plugin/components/tooltip-handler/dom/model/title-model.ts +++ b/packages/vchart/src/plugin/components/tooltip-handler/dom/model/title-model.ts @@ -15,23 +15,28 @@ export class TitleModel extends BaseTooltipModel { if (!this.product) { this.product = this.createElement('h2'); } + const { align } = this._option.getTooltipAttributes(); + + if (align === 'right' && !this.textSpan) { + this._initTextSpan(0); + } const { title } = tooltipActual; if (title?.hasShape && title?.shapeType) { if (!this.shape) { - this._initShape(); + this._initShape(align === 'right' ? 1 : 0); } } else if (this.shape) { this._releaseShape(); } - if (!this.textSpan) { - this._initTextSpan(); + if (align !== 'right' && !this.textSpan) { + this._initTextSpan(1); } } - private _initShape() { - const shape = new ShapeModel(this.product!, this._option, 0); + private _initShape(index: number = 0) { + const shape = new ShapeModel(this.product!, this._option, index); shape.init(); this.shape = shape; this.children[shape.childIndex] = shape; @@ -46,8 +51,8 @@ export class TitleModel extends BaseTooltipModel { this.shape = null; } - private _initTextSpan() { - const textSpan = new TextModel(this.product!, this._option, 1); + private _initTextSpan(index: number = 1) { + const textSpan = new TextModel(this.product!, this._option, index); textSpan.init(); this.textSpan = textSpan; this.children[textSpan.childIndex] = textSpan; diff --git a/packages/vchart/src/plugin/components/tooltip-handler/dom/utils/style.ts b/packages/vchart/src/plugin/components/tooltip-handler/dom/utils/style.ts index baa09d3a77..26c08d6541 100644 --- a/packages/vchart/src/plugin/components/tooltip-handler/dom/utils/style.ts +++ b/packages/vchart/src/plugin/components/tooltip-handler/dom/utils/style.ts @@ -24,7 +24,8 @@ export function getDomStyles(attributes?: Maybe): IDomToolti valueWidth, enterable, transitionDuration, - panelDomHeight = 0 + panelDomHeight = 0, + align = 'left' } = attributes ?? {}; const { @@ -48,8 +49,10 @@ export function getDomStyles(attributes?: Maybe): IDomToolti const keyStyle = getLabelStyle(key); const valueStyle = getLabelStyle(value); const { bottom, left, right, top } = normalizeLayoutPaddingSpec(padding); + const marginKey = align === 'right' ? 'marginLeft' : 'marginRight'; const styles: IDomTooltipStyle = { + align, panel: { width: getPixelPropertyStr(width + lineWidth * 2), minHeight: getPixelPropertyStr(panelDomHeight + lineWidth * 2), @@ -85,7 +88,7 @@ export function getDomStyles(attributes?: Maybe): IDomToolti } as IShapeStyle) ), width: getPixelPropertyStr(shape.size), - marginRight: getPixelPropertyStr(shape.spacing ?? DEFAULT_SHAPE_SPACING) + [marginKey]: getPixelPropertyStr(shape.spacing ?? DEFAULT_SHAPE_SPACING) }, keyColumn: { common: keyStyle, @@ -100,7 +103,7 @@ export function getDomStyles(attributes?: Maybe): IDomToolti } as ILabelStyle) ), width: getPixelPropertyStr(keyWidth), - marginRight: getPixelPropertyStr(key.spacing ?? DEFAULT_KEY_SPACING) + [marginKey]: getPixelPropertyStr(key.spacing ?? DEFAULT_KEY_SPACING) }, valueColumn: { common: valueStyle, @@ -115,7 +118,7 @@ export function getDomStyles(attributes?: Maybe): IDomToolti } as ILabelStyle) ), width: getPixelPropertyStr(valueWidth), - marginRight: getPixelPropertyStr(value.spacing ?? DEFAULT_VALUE_SPACING) + [marginKey]: getPixelPropertyStr(value.spacing ?? DEFAULT_VALUE_SPACING) } }; return styles; diff --git a/packages/vchart/src/plugin/components/tooltip-handler/interface/style.ts b/packages/vchart/src/plugin/components/tooltip-handler/interface/style.ts index 89c1cdf91b..7aac021feb 100644 --- a/packages/vchart/src/plugin/components/tooltip-handler/interface/style.ts +++ b/packages/vchart/src/plugin/components/tooltip-handler/interface/style.ts @@ -19,4 +19,12 @@ export interface ITooltipAttributes extends TooltipAttributes { panelDomHeight?: number; /** dom tooltip 内容区的最大高度,canvas tooltip 不支持 */ maxContentHeight?: number; + /** + * @since 1.11.4 + * + * shape、key、value的对齐方式,可选项如下: + * 'left': 从左到右对齐 + * 'right': 从右到左对齐 + */ + align?: 'left' | 'right'; } diff --git a/packages/vchart/src/plugin/components/tooltip-handler/utils/attribute.ts b/packages/vchart/src/plugin/components/tooltip-handler/utils/attribute.ts index 0ce97258b5..d02483bbe1 100644 --- a/packages/vchart/src/plugin/components/tooltip-handler/utils/attribute.ts +++ b/packages/vchart/src/plugin/components/tooltip-handler/utils/attribute.ts @@ -76,12 +76,33 @@ export const getTooltipAttributes = ( globalTheme: ITheme ): ITooltipAttributes => { const { style = {}, enterable, transitionDuration } = spec; - const { panel = {}, titleLabel, shape, keyLabel, valueLabel, spaceRow: commonSpaceRow, maxContentHeight } = style; + const { + panel = {}, + titleLabel, + shape, + keyLabel, + valueLabel, + spaceRow: commonSpaceRow, + maxContentHeight, + align + } = style; const padding = normalizePadding(panel.padding); const paddingSpec = normalizeLayoutPaddingSpec(panel.padding) as IPadding; - const titleStyle = getTextAttributes(titleLabel, globalTheme); - const keyStyle = getTextAttributes(keyLabel, globalTheme); + const titleStyle = getTextAttributes( + { + textAlign: align === 'right' ? 'right' : 'left', + ...titleLabel + }, + globalTheme + ); + const keyStyle = getTextAttributes( + { + textAlign: align === 'right' ? 'right' : 'left', + ...keyLabel + }, + globalTheme + ); const valueStyle = getTextAttributes(valueLabel, globalTheme); const shapeStyle: TooltipRowStyleAttrs['shape'] = { fill: true, @@ -113,7 +134,8 @@ export const getTooltipAttributes = ( maxContentHeight, enterable, - transitionDuration + transitionDuration, + align }; const { title = {}, content = [] } = actualTooltip; diff --git a/packages/vchart/src/theme/builtin/common/component/tooltip.ts b/packages/vchart/src/theme/builtin/common/component/tooltip.ts index 1beac19d32..a9a24c2d20 100644 --- a/packages/vchart/src/theme/builtin/common/component/tooltip.ts +++ b/packages/vchart/src/theme/builtin/common/component/tooltip.ts @@ -34,7 +34,6 @@ export const tooltip: ITooltipTheme = { fontColor: { type: 'palette', key: 'primaryFontColor' }, fontWeight: 'bold', - textAlign: 'left', textBaseline: 'middle', spacing: 0 }, @@ -47,7 +46,6 @@ export const tooltip: ITooltipTheme = { lineHeight: { type: 'token', key: 'l4LineHeight' }, fontColor: { type: 'palette', key: 'secondaryFontColor' }, - textAlign: 'left', textBaseline: 'middle', spacing: 26 }, From 3066b5854512679fce8db98d45980286437f73fd Mon Sep 17 00:00:00 2001 From: xile611 Date: Tue, 18 Jun 2024 22:20:09 +0800 Subject: [PATCH 08/16] docs: update changelog of 1.11.4 in chinese --- docs/assets/changelog/zh/release.md | 33 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/docs/assets/changelog/zh/release.md b/docs/assets/changelog/zh/release.md index 6f6d6682f9..c19b788cea 100644 --- a/docs/assets/changelog/zh/release.md +++ b/docs/assets/changelog/zh/release.md @@ -1,20 +1,19 @@ -# v1.11.4 - -2024-06-18 - - -**🐛 功能修复** - - - **@visactor/vchart**: fix bug of `updateSpec` when has `scales`, close [#2744](https://github.com/VisActor/VChart/issues/2744) - - **@visactor/vchart**: gauge chart might throw error when the value is close to its maximum, fix [#2783](https://github.com/VisActor/VChart/issues/2783) - - **@visactor/vchart**: fix the behavior of the gauge pointer when it exceeds the axis range, fix [#2780](https://github.com/VisActor/VChart/issues/2780) - - **@visactor/vchart**: normal animation not work when appear animation is disabled, fix [#2807](https://github.com/VisActor/VChart/issues/2807) - - **@visactor/vchart**: upgrade vrender to 0.19.10, vgrammar to 0.13.9 - - - -[更多详情请查看 v1.11.4](https://github.com/VisActor/VChart/releases/tag/v1.11.4) - +# v1.11.4 + +2024-06-18 + + +**🐛 功能修复** + + - **@visactor/vchart**: 修复当配置了`scales`的时候,`updateSpec` 效果错误的问题 [#2744](https://github.com/VisActor/VChart/issues/2744) + - **@visactor/vchart**: 修复当值接近最大值时,仪表盘可能抛错的问题,关闭[#2783](https://github.com/VisActor/VChart/issues/2783) + - **@visactor/vchart**: 修复仪表盘指针位置超出轴范围的问题,修复[#2780](https://github.com/VisActor/VChart/issues/2780) + - **@visactor/vchart**: 修复关闭appear动画后,循环动画不生效的问题,关闭[#2807](https://github.com/VisActor/VChart/issues/2807) + + + +[更多详情请查看 v1.11.4](https://github.com/VisActor/VChart/releases/tag/v1.11.4) + # v1.11.3 2024-06-06 From 2744f47b72c53f050f9c1f22a6bd35cd67ab9656 Mon Sep 17 00:00:00 2001 From: xile611 Date: Wed, 19 Jun 2024 09:52:16 +0800 Subject: [PATCH 09/16] docs: update docs of tooltip --- .../en/component/tooltip-common/tooltip-theme.md | 9 +++++++++ .../zh/component/tooltip-common/tooltip-theme.md | 11 +++++++++++ .../vchart/src/component/tooltip/interface/theme.ts | 2 +- .../components/tooltip-handler/interface/style.ts | 2 +- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/docs/assets/option/en/component/tooltip-common/tooltip-theme.md b/docs/assets/option/en/component/tooltip-common/tooltip-theme.md index 996cac28f5..1daabb2f8f 100644 --- a/docs/assets/option/en/component/tooltip-common/tooltip-theme.md +++ b/docs/assets/option/en/component/tooltip-common/tooltip-theme.md @@ -114,3 +114,12 @@ Configure tooltip background frame style. #${prefix} maxContentHeight(number) **Optional** Configure the maximum height of the content area, and if the content area exceeds this height, a local scrollbar will be displayed (applicable to dom tooltip). Supported since version 1.9.0. + +#${prefix} align('left' | 'right') + +Supported since version 1.11.5. + +**Optional** Set the content alignment: + +- 'left': shape, title, and values are displayed from left to right, aligned to the left +- 'right': shape, title, and values are displayed from right to left, aligned to the right diff --git a/docs/assets/option/zh/component/tooltip-common/tooltip-theme.md b/docs/assets/option/zh/component/tooltip-common/tooltip-theme.md index 96f453fc92..14c5789fb6 100644 --- a/docs/assets/option/zh/component/tooltip-common/tooltip-theme.md +++ b/docs/assets/option/zh/component/tooltip-common/tooltip-theme.md @@ -114,3 +114,14 @@ #${prefix} maxContentHeight(number) **可选** 设置最大内容区高度,内容区若超过该高度将显示局部滚动条(适用于 dom tooltip)。自 1.9.0 版本开始支持。 + + +#${prefix} align('left' | 'right') + +自 1.11.5 版本开始支持。 + +**可选** 设置内容的对齐方式: + +- 'left': shape、标题、数值从左到右展示,左对齐 +- 'right': shape、标题、数值从右到左展示,右对齐 + diff --git a/packages/vchart/src/component/tooltip/interface/theme.ts b/packages/vchart/src/component/tooltip/interface/theme.ts index b90a17b351..db90ef678d 100644 --- a/packages/vchart/src/component/tooltip/interface/theme.ts +++ b/packages/vchart/src/component/tooltip/interface/theme.ts @@ -86,7 +86,7 @@ export interface ITooltipTheme { y?: number; }; /** - * @since 1.11.4 + * @since 1.11.5 * * shape、key、value的对齐方式,可选项如下: * 'left': 从左到右对齐 diff --git a/packages/vchart/src/plugin/components/tooltip-handler/interface/style.ts b/packages/vchart/src/plugin/components/tooltip-handler/interface/style.ts index 7aac021feb..9bc2c55f3f 100644 --- a/packages/vchart/src/plugin/components/tooltip-handler/interface/style.ts +++ b/packages/vchart/src/plugin/components/tooltip-handler/interface/style.ts @@ -20,7 +20,7 @@ export interface ITooltipAttributes extends TooltipAttributes { /** dom tooltip 内容区的最大高度,canvas tooltip 不支持 */ maxContentHeight?: number; /** - * @since 1.11.4 + * @since 1.11.5 * * shape、key、value的对齐方式,可选项如下: * 'left': 从左到右对齐 From d3474074df49db66177013661e43315039c7057d Mon Sep 17 00:00:00 2001 From: "lixuefei.1313" Date: Wed, 19 Jun 2024 11:23:56 +0800 Subject: [PATCH 10/16] fix: fix bug of waterfall stack nagivate --- packages/vchart/src/data/transforms/waterfall.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/vchart/src/data/transforms/waterfall.ts b/packages/vchart/src/data/transforms/waterfall.ts index bc2f82b0b0..8ec5a90520 100644 --- a/packages/vchart/src/data/transforms/waterfall.ts +++ b/packages/vchart/src/data/transforms/waterfall.ts @@ -165,8 +165,8 @@ function computeTotalWithMultipleData( let { start, end } = getTotalStartEnd(totalConfigData, total, totalData, temp, totalSpec); total.start = start; total.end = end; - const positive = start; - const navigate = start; + let positive = start; + let navigate = start; // 当前剩余的总计值 let valueTemp = end - start; // 将非总计数据进行堆叠 @@ -174,14 +174,16 @@ function computeTotalWithMultipleData( const value = +d[valueField]; if (value >= 0) { d[startAs] = +positive; + positive = precisionAdd(positive, value); } else { d[startAs] = +navigate; + navigate = precisionAdd(navigate, value); } d[endAs] = precisionAdd(d[startAs], value); start = precisionAdd(start, value); valueTemp = precisionSub(valueTemp, value); }); - // 先在的start end 就是 total 的 + // 现在的start end 就是 total 的 _totalTemp.forEach(d => { d[startAs] = +start; d[endAs] = precisionAdd(d[startAs], valueTemp); From 99f02104a47906d13fd4f53647a3a6b50a286482 Mon Sep 17 00:00:00 2001 From: xile611 Date: Wed, 19 Jun 2024 14:12:34 +0800 Subject: [PATCH 11/16] docs: update docs of univer-vchart-plugin --- .../univer.md | 155 ++++++++++++++++++ .../univer.md | 155 ++++++++++++++++++ 2 files changed, 310 insertions(+) create mode 100644 docs/assets/guide/en/tutorial_docs/Cross-terminal_and_Developer_Ecology/univer.md create mode 100644 docs/assets/guide/zh/tutorial_docs/Cross-terminal_and_Developer_Ecology/univer.md diff --git a/docs/assets/guide/en/tutorial_docs/Cross-terminal_and_Developer_Ecology/univer.md b/docs/assets/guide/en/tutorial_docs/Cross-terminal_and_Developer_Ecology/univer.md new file mode 100644 index 0000000000..90899152f9 --- /dev/null +++ b/docs/assets/guide/en/tutorial_docs/Cross-terminal_and_Developer_Ecology/univer.md @@ -0,0 +1,155 @@ +# univer-vchart-plugin 介绍 + +## 关于 Univer + +[Univer](https://univer.ai/)是 Office 系列办公套件的开源替代品,包括电子表格、文档和幻灯片。目前提供公式、数字格式、条件格式、数据验证、图文混排等功能。你可以将 Univer 集成到你的系统当中,并基于 Univer 开发个性化的业务需求。 + +[univer-vchart-plugin](https://github.com/VisActor/univer-vchart-plugin)是基于 Univer 封装的插件,可以让你在 Univer 中快速的插入 vchart 图表。 + +## 快速上手 + +### 安装 + +``` +# 使用 npm 安装 +npm install @visactor/univer-vchart-plugin + +# 使用 yarn 安装 +yarn add @visactor/univer-vchart-plugin +``` + +### 使用 + +- 注册插件 + +```typescript +import { UniverVChartPlugin } from '@visactor/univer-vchart-plugin'; + +export function setupUniver() { + const univer = new Univer({ + theme: defaultTheme, + locale: LocaleType.EN_US, + locales: { + [LocaleType.EN_US]: enUS + } + }); + univer.registerPlugin(UniverVChartPlugin); +} +``` + +- 创建 vchart 图表,示例如下: + +```typescript +import { CREATE_VCHART_COMMAND_ID } from '@visactor/univer-vchart-plugin'; +... + +await univerAPI.executeCommand(CREATE_VCHART_COMMAND_ID, { + spec: { ... }, + }); +``` + +其中创建 vchart 图表,支持如下参数: + +```typescript +/** + * the params of create a vchart instance + * + * @param spec spec of vchart + * @param options options of vchart + * @param initPosition ths position of vchart layer + */ +export interface CreateVChartParams { + spec: ISpec; + options?: Omit; + initPosition?: { + startX?: number; + startY?: number; + endX?: number; + endY?: number; + }; +} +``` + +### 一个简单的图表示例 + + + +```typescript +import { UniverVChartPlugin, CREATE_VCHART_COMMAND_ID } from '@visactor/univer-vchart-plugin'; + +export function setupUniver() { + const univer = new Univer({ + theme: defaultTheme, + locale: LocaleType.EN_US, + locales: { + [LocaleType.EN_US]: enUS + } + }); + univer.registerPlugin(UniverVChartPlugin); +} + +export function setupVChartDemo($toolbar: HTMLElement, univerAPI: FUniver) { + const $button = document.createElement('a'); + $button.textContent = 'Create vchart demo'; + $toolbar.appendChild($button); + + $button.addEventListener('click', async () => { + if (!univerAPI) throw new Error('univerAPI is not defined'); + + const activeWorkbook = univerAPI.getActiveWorkbook(); + if (!activeWorkbook) throw new Error('activeWorkbook is not defined'); + const activeSheet = activeWorkbook.getActiveSheet(); + if (!activeSheet) throw new Error('activeSheet is not defined'); + + await univerAPI.executeCommand(CREATE_VCHART_COMMAND_ID, { + spec: { + type: 'line', + data: { + values: [ + { + time: '2:00', + value: 8 + }, + { + time: '4:00', + value: 9 + }, + { + time: '6:00', + value: 11 + }, + { + time: '8:00', + value: 14 + }, + { + time: '10:00', + value: 16 + }, + { + time: '12:00', + value: 17 + }, + { + time: '14:00', + value: 17 + }, + { + time: '16:00', + value: 16 + }, + { + time: '18:00', + value: 15 + } + ] + }, + xField: 'time', + yField: 'value' + } + }); + }); +} +``` + +[查看在线 demo](https://stackblitz.com/~/github.com/xile611/univer-vchart-plugin-demo) diff --git a/docs/assets/guide/zh/tutorial_docs/Cross-terminal_and_Developer_Ecology/univer.md b/docs/assets/guide/zh/tutorial_docs/Cross-terminal_and_Developer_Ecology/univer.md new file mode 100644 index 0000000000..90899152f9 --- /dev/null +++ b/docs/assets/guide/zh/tutorial_docs/Cross-terminal_and_Developer_Ecology/univer.md @@ -0,0 +1,155 @@ +# univer-vchart-plugin 介绍 + +## 关于 Univer + +[Univer](https://univer.ai/)是 Office 系列办公套件的开源替代品,包括电子表格、文档和幻灯片。目前提供公式、数字格式、条件格式、数据验证、图文混排等功能。你可以将 Univer 集成到你的系统当中,并基于 Univer 开发个性化的业务需求。 + +[univer-vchart-plugin](https://github.com/VisActor/univer-vchart-plugin)是基于 Univer 封装的插件,可以让你在 Univer 中快速的插入 vchart 图表。 + +## 快速上手 + +### 安装 + +``` +# 使用 npm 安装 +npm install @visactor/univer-vchart-plugin + +# 使用 yarn 安装 +yarn add @visactor/univer-vchart-plugin +``` + +### 使用 + +- 注册插件 + +```typescript +import { UniverVChartPlugin } from '@visactor/univer-vchart-plugin'; + +export function setupUniver() { + const univer = new Univer({ + theme: defaultTheme, + locale: LocaleType.EN_US, + locales: { + [LocaleType.EN_US]: enUS + } + }); + univer.registerPlugin(UniverVChartPlugin); +} +``` + +- 创建 vchart 图表,示例如下: + +```typescript +import { CREATE_VCHART_COMMAND_ID } from '@visactor/univer-vchart-plugin'; +... + +await univerAPI.executeCommand(CREATE_VCHART_COMMAND_ID, { + spec: { ... }, + }); +``` + +其中创建 vchart 图表,支持如下参数: + +```typescript +/** + * the params of create a vchart instance + * + * @param spec spec of vchart + * @param options options of vchart + * @param initPosition ths position of vchart layer + */ +export interface CreateVChartParams { + spec: ISpec; + options?: Omit; + initPosition?: { + startX?: number; + startY?: number; + endX?: number; + endY?: number; + }; +} +``` + +### 一个简单的图表示例 + + + +```typescript +import { UniverVChartPlugin, CREATE_VCHART_COMMAND_ID } from '@visactor/univer-vchart-plugin'; + +export function setupUniver() { + const univer = new Univer({ + theme: defaultTheme, + locale: LocaleType.EN_US, + locales: { + [LocaleType.EN_US]: enUS + } + }); + univer.registerPlugin(UniverVChartPlugin); +} + +export function setupVChartDemo($toolbar: HTMLElement, univerAPI: FUniver) { + const $button = document.createElement('a'); + $button.textContent = 'Create vchart demo'; + $toolbar.appendChild($button); + + $button.addEventListener('click', async () => { + if (!univerAPI) throw new Error('univerAPI is not defined'); + + const activeWorkbook = univerAPI.getActiveWorkbook(); + if (!activeWorkbook) throw new Error('activeWorkbook is not defined'); + const activeSheet = activeWorkbook.getActiveSheet(); + if (!activeSheet) throw new Error('activeSheet is not defined'); + + await univerAPI.executeCommand(CREATE_VCHART_COMMAND_ID, { + spec: { + type: 'line', + data: { + values: [ + { + time: '2:00', + value: 8 + }, + { + time: '4:00', + value: 9 + }, + { + time: '6:00', + value: 11 + }, + { + time: '8:00', + value: 14 + }, + { + time: '10:00', + value: 16 + }, + { + time: '12:00', + value: 17 + }, + { + time: '14:00', + value: 17 + }, + { + time: '16:00', + value: 16 + }, + { + time: '18:00', + value: 15 + } + ] + }, + xField: 'time', + yField: 'value' + } + }); + }); +} +``` + +[查看在线 demo](https://stackblitz.com/~/github.com/xile611/univer-vchart-plugin-demo) From 53d2c82e859bc0d8cdb6b603c53f80c170da5ab8 Mon Sep 17 00:00:00 2001 From: xile611 Date: Wed, 19 Jun 2024 15:39:26 +0800 Subject: [PATCH 12/16] docs: update english docs of univer --- .../univer.md | 32 ++++++++----------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/docs/assets/guide/en/tutorial_docs/Cross-terminal_and_Developer_Ecology/univer.md b/docs/assets/guide/en/tutorial_docs/Cross-terminal_and_Developer_Ecology/univer.md index 90899152f9..176925f4fd 100644 --- a/docs/assets/guide/en/tutorial_docs/Cross-terminal_and_Developer_Ecology/univer.md +++ b/docs/assets/guide/en/tutorial_docs/Cross-terminal_and_Developer_Ecology/univer.md @@ -1,26 +1,26 @@ -# univer-vchart-plugin 介绍 +# Introduction to univer-vchart-plugin -## 关于 Univer +## About Univer -[Univer](https://univer.ai/)是 Office 系列办公套件的开源替代品,包括电子表格、文档和幻灯片。目前提供公式、数字格式、条件格式、数据验证、图文混排等功能。你可以将 Univer 集成到你的系统当中,并基于 Univer 开发个性化的业务需求。 +[Univer](https://univer.ai/) is an open-source alternative to the Office suite, including spreadsheets, documents, and presentations. It currently offers features such as formulas, number formatting, conditional formatting, data validation, and text-image mixing. You can integrate Univer into your system and develop personalized business requirements based on Univer. -[univer-vchart-plugin](https://github.com/VisActor/univer-vchart-plugin)是基于 Univer 封装的插件,可以让你在 Univer 中快速的插入 vchart 图表。 +[univer-vchart-plugin](https://github.com/VisActor/univer-vchart-plugin) is a plugin encapsulated based on Univer, allowing you to quickly insert vchart charts into Univer. -## 快速上手 +## Quick Start -### 安装 +### Installation ``` -# 使用 npm 安装 +# Install using npm npm install @visactor/univer-vchart-plugin -# 使用 yarn 安装 +# Install using yarn yarn add @visactor/univer-vchart-plugin ``` -### 使用 +### Usage -- 注册插件 +- Register the plugin ```typescript import { UniverVChartPlugin } from '@visactor/univer-vchart-plugin'; @@ -36,8 +36,7 @@ export function setupUniver() { univer.registerPlugin(UniverVChartPlugin); } ``` - -- 创建 vchart 图表,示例如下: +- Create a vchart chart, example as follows: ```typescript import { CREATE_VCHART_COMMAND_ID } from '@visactor/univer-vchart-plugin'; @@ -47,8 +46,7 @@ await univerAPI.executeCommand(CREATE_VCHART_COMMAND_ID, { spec: { ... }, }); ``` - -其中创建 vchart 图表,支持如下参数: +The following parameters are supported when creating a vchart chart: ```typescript /** @@ -70,7 +68,7 @@ export interface CreateVChartParams { } ``` -### 一个简单的图表示例 +### A Simple Chart Example @@ -150,6 +148,4 @@ export function setupVChartDemo($toolbar: HTMLElement, univerAPI: FUniver) { }); }); } -``` - -[查看在线 demo](https://stackblitz.com/~/github.com/xile611/univer-vchart-plugin-demo) +[View the online demo](https://stackblitz.com/~/github.com/xile611/univer-vchart-plugin-demo) From 38b391ef5bc3bb0b04d8fae0d08d2e57b2e6befc Mon Sep 17 00:00:00 2001 From: xile611 Date: Thu, 20 Jun 2024 18:14:54 +0800 Subject: [PATCH 13/16] chore: update changelog in bundler.config.js --- packages/vchart/bundler.config.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/vchart/bundler.config.js b/packages/vchart/bundler.config.js index 8534fad6c7..aa3918e54c 100644 --- a/packages/vchart/bundler.config.js +++ b/packages/vchart/bundler.config.js @@ -110,6 +110,8 @@ module.exports = { const dest = crossEnvs[env].output; const envSource = path.join(__dirname, config.outputDir.umd, source); copyFile(envSource, path.join(__dirname, dest)); + + console.log(`[copy file] copy ${envSource} to ${path.join(__dirname, dest)}`) }); umdEntries.forEach(entry => { fs.unlinkSync(path.join(__dirname, config.outputDir.umd, `${entry}.min.js`)); @@ -122,6 +124,8 @@ module.exports = { const envSource = path.join(__dirname, config.outputDir.umd, source); copyFile(envSource, path.join(__dirname, dest)); fs.unlinkSync(path.join(__dirname, config.outputDir.umd, source)); + + console.log(`[copy file] copy ${envSource} to ${path.join(__dirname, dest)}`) } catch(e) { console.log(`[Error] can't copy es5/index.es.js to harmony`) } From e5420fa22956fc63080bd7712129cd9e03682063 Mon Sep 17 00:00:00 2001 From: xile611 Date: Thu, 20 Jun 2024 10:40:30 +0000 Subject: [PATCH 14/16] build: release version 1.11.5 --- ...d-pager-in-dark-theme_2024-06-18-09-59.json | 10 ---------- ...erfall-stack-navigate_2024-06-17-08-59.json | 11 ----------- common/config/rush/pnpm-lock.yaml | 18 +++++++++--------- 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 +- 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 | 16 ++++++++++++++++ packages/vchart-types/package.json | 2 +- .../component/tooltip/interface/theme.d.ts | 1 + .../tooltip-handler/dom/interface.d.ts | 1 + .../dom/model/content-model.d.ts | 4 +--- .../tooltip-handler/interface/style.d.ts | 1 + packages/vchart/CHANGELOG.json | 15 +++++++++++++++ packages/vchart/CHANGELOG.md | 12 +++++++++++- 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 +- 29 files changed, 80 insertions(+), 59 deletions(-) delete mode 100644 common/changes/@visactor/vchart/feat-optimize-legend-pager-in-dark-theme_2024-06-18-09-59.json delete mode 100644 common/changes/@visactor/vchart/fix-waterfall-stack-navigate_2024-06-17-08-59.json diff --git a/common/changes/@visactor/vchart/feat-optimize-legend-pager-in-dark-theme_2024-06-18-09-59.json b/common/changes/@visactor/vchart/feat-optimize-legend-pager-in-dark-theme_2024-06-18-09-59.json deleted file mode 100644 index ce024a0eb3..0000000000 --- a/common/changes/@visactor/vchart/feat-optimize-legend-pager-in-dark-theme_2024-06-18-09-59.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vchart", - "comment": "fix: optimize discrete legend pager color in dark theme, related #2654", - "type": "none" - } - ], - "packageName": "@visactor/vchart" -} \ No newline at end of file diff --git a/common/changes/@visactor/vchart/fix-waterfall-stack-navigate_2024-06-17-08-59.json b/common/changes/@visactor/vchart/fix-waterfall-stack-navigate_2024-06-17-08-59.json deleted file mode 100644 index 9d8d90c89d..0000000000 --- a/common/changes/@visactor/vchart/fix-waterfall-stack-navigate_2024-06-17-08-59.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "fix: fix the issue issue with stacked waterfall charts where positive and negative values were not stacked separately when there were both positive and negative values in the same stack\n\n", - "type": "none", - "packageName": "@visactor/vchart" - } - ], - "packageName": "@visactor/vchart", - "email": "lixuef1313@163.com" -} \ No newline at end of file diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 4b79ae9f20..3a9e7bc598 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.4 - '@visactor/react-vchart': workspace:1.11.4 - '@visactor/vchart': workspace:1.11.4 + '@visactor/openinula-vchart': workspace:1.11.5 + '@visactor/react-vchart': workspace:1.11.5 + '@visactor/vchart': workspace:1.11.5 '@visactor/vchart-theme': ~1.6.6 '@visactor/vgrammar': 0.13.10 '@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.4 + '@visactor/vchart': workspace:1.11.5 '@visactor/vgrammar-core': 0.13.10 '@visactor/vrender-core': 0.19.11 '@visactor/vrender-kits': 0.19.11 @@ -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.4 + '@visactor/vchart': workspace:1.11.5 '@visactor/vgrammar-core': 0.13.10 '@visactor/vrender-core': 0.19.11 '@visactor/vrender-kits': 0.19.11 @@ -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.4 + '@visactor/vchart': workspace:1.11.5 '@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.11 '@visactor/vscale': ~0.18.9 '@visactor/vutils': ~0.18.9 - '@visactor/vutils-extension': workspace:1.11.4 + '@visactor/vutils-extension': workspace:1.11.5 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.4 + '@visactor/vchart': workspace:1.11.5 '@visactor/vrender-core': 0.19.11 '@visactor/vrender-kits': 0.19.11 '@visactor/vutils': ~0.18.9 @@ -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.4 + '@visactor/vchart': workspace:1.11.5 '@visactor/vrender': 0.19.11 '@visactor/vrender-core': 0.19.11 '@visactor/vrender-kits': 0.19.11 diff --git a/common/config/rush/version-policies.json b/common/config/rush/version-policies.json index 11018e503f..d145a929d3 100644 --- a/common/config/rush/version-policies.json +++ b/common/config/rush/version-policies.json @@ -1 +1 @@ -[{"definitionName":"lockStepVersion","policyName":"vchartMain","version":"1.11.4","mainProject":"@visactor/vchart","nextBump":"patch"}] +[{"definitionName":"lockStepVersion","policyName":"vchartMain","version":"1.11.5","mainProject":"@visactor/vchart","nextBump":"patch"}] diff --git a/docs/package.json b/docs/package.json index dbc0b54783..95a0d87d14 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.4", - "@visactor/react-vchart": "workspace:1.11.4", - "@visactor/vchart": "workspace:1.11.4", + "@visactor/openinula-vchart": "workspace:1.11.5", + "@visactor/react-vchart": "workspace:1.11.5", + "@visactor/vchart": "workspace:1.11.5", "@visactor/vchart-theme": "~1.6.6", "@visactor/vmind": "1.2.4-alpha.5", "@visactor/vutils": "~0.18.9", diff --git a/packages/block-vchart/block/vchart/index.js b/packages/block-vchart/block/vchart/index.js index 41b0b39258..3af0f794b1 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 V(t){return Object.prototype.toString.call(t)}function N(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(V(t)!==V(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=N(t),n=N(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 Vt(t){return t>1?0:t<-1?Et:Math.acos(t)}function Nt(t){return t>=1?Pt:t<=-1?-Pt:Math.asin(t)}function Gt(t,e,i,s,n){let r,a;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 Ve,Ne,Ge,We;function Ue(t){return Ve=1/0,Ne=1/0,Ge=-1/0,We=-1/0,t.forEach((t=>{Ve>t.x&&(Ve=t.x),Get.y&&(Ne=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},Vi=Math.sqrt,Ni=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=Vi(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=Ns},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=Vs,Rs=Os=t,Ls=Is=e}function Vs(t,e){Fs.add(Is*t-Os*e),Os=t,Is=e}function Ns(){Vs(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=Vi(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=Vi(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(Vi(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 Vn=16,Nn=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=Vi(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()):Vi(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 Ni((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)*Vi(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 Vr(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 Vr(s).parse(t)},Yr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Lr.DSV,Nr(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",Va="Function",Na="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 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 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 No(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 No("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){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"linearClosed":return ll(t,i)}}class cl 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 dl=["l",0,0,0,0,0,0,0];function ul(t,e,i){const s=dl[0]=t[0];if("a"===s||"A"===s)dl[1]=e*t[1],dl[2]=i*t[2],dl[3]=t[3],dl[4]=t[4],dl[5]=t[5],dl[6]=e*t[6],dl[7]=i*t[7];else if("h"===s||"H"===s)dl[1]=e*t[1];else if("v"===s||"V"===s)dl[1]=i*t[1];else for(let s=1,n=t.length;s{at.getInstance().warn("空函数")}}),Cl=Object.assign(Object.assign({},bl),{points:[],cornerRadius:0,closePath:!0}),El=Object.assign(Object.assign({},bl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},bl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const Pl=Object.assign(Object.assign({},bl),{symbolType:"circle",size:10,keepDirIn3d:!0}),Bl=Object.assign(Object.assign(Object.assign({},bl),vl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Rl=Object.assign(Object.assign(Object.assign({},bl),vl),{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}),Ll=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},bl),{fill:!0,cornerRadius:0}),Ol=Object.assign(Object.assign({},Ll),{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 Il=new class{},Dl={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"}},Fl=!0,jl=!1,zl=/\w|\(|\)|-/,Hl=/[.?!,;:/,。?!、;:]/,Vl=/\S/;function Nl(t,e,i,s,n){if(!e||e<=0)return 0;const r=Il.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=Gl(t,a)),a}function Gl(t,e){let i=e;for(;zl.test(t[i-1])&&zl.test(t[i])||Hl.test(t[i]);)if(i--,i<=0)return e;return i}function Wl(t,e){const i=Il.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 Ul=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Yl=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=Bl.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=Gl(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=Gl(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}};Yl=Ul([Oa()],Yl);var Kl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Xl=Symbol.for("TextMeasureContribution");let $l=class extends Yl{};$l=Kl([Oa()],$l);const ql=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 Va: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===Da&&(t.cache=e,t.activated=!0)}},Zl=Symbol.for("CanvasFactory"),Jl=Symbol.for("Context2dFactory");function Ql(t){return ql.getNamed(Zl,Il.global.env)(t)}const th=1e-4,eh=Math.sqrt(3),ih=1/3;function sh(t){return t>-vh&&tvh||t<-vh}const rh=[0,0],ah=[0,0],oh=[0,0];function lh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function hh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function ch(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 dh(t){return(t%=Rt)<0&&(t+=Rt),t}function uh(t,e,i,s,n,r){if(r>e&&r>s||rn?o:0}function ph(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 fh(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(sh(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 yh=[-1,-1,-1],bh=[-1,-1];function xh(){const t=bh[0];bh[0]=bh[1],bh[1]=t}function Sh(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(sh(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,ih):Math.pow(i,ih),s=s<0?-Math.pow(-s,ih):Math.pow(s,ih);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+eh*Math.sin(e)))/(3*a),h=(-o+i*(s-eh*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,yh);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&xh(),p=ch(e,s,r,o,bh[0]),u>1&&(g=ch(e,s,r,o,bh[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(sh(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,yh);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=hh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);yh[0]=-l,yh[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>=yh[0]+t&&a<=yh[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=yh[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 Mh(t){return Math.round(t/Et*1e8)/1e8%2*Et}function Th(t,e){let i=Mh(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-Mh(i-n)):e&&i1&&(i||(h+=uh(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;wh[0]=S,wh[1]=A,Th(wh,Boolean(a[6])),S=wh[0],A=wh[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(fh(c,d,f,v,e,s,n))return!0}else h+=uh(c,d,f,v,s,n)||0;c=f,d=v;break;case po.C:if(i){if(gh(c,d,f,v,_,y,b,x,e,s,n))return!0}else h+=Sh(c,d,f,v,_,y,b,x,s,n)||0;c=b,d=x;break;case po.Q:if(i){if(ph(c,d,f,v,_,y,e,s,n))return!0}else h+=Ah(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+=uh(c,d,o,l,s,n),i){if(mh(f,v,_,k,k+M,T,e,w,n))return!0}else h+=kh(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(fh(u,p,o,p,e,s,n)||fh(o,p,o,l,e,s,n)||fh(o,l,u,l,e,s,n)||fh(u,l,u,p,e,s,n))return!0}else h+=uh(o,p,o,l,s,n),h+=uh(u,l,u,p,s,n);break;case po.Z:if(i){if(fh(c,d,u,p,e,s,n))return!0}else h+=uh(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},Bh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Rh=Symbol.for("VWindow"),Lh=Symbol.for("WindowHandlerContribution");let Oh=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&&(ql.getNamed(Lh,t.env).configure(this,t),this.actived=!0)},this._uid=ba.GenAutoIncrementId(),this.global=Il.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)}};Oh=Ph([Oa(),Bh("design:paramtypes",[])],Oh);var Ih=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fh=function(t,e){return function(i,s){e(i,s,t)}};let jh=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=Il.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=Eh.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:vl.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:vl.fontFamily,fontSize:vl.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=ql.get(Rh),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 zh;jh=Ih([Oa(),Fh(0,Ra(qa)),Fh(0,Ia(Xl)),Dh("design:paramtypes",[Object])],jh),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(zh||(zh={}));const Hh=new oe;let Vh=class{constructor(){this.matrix=new oe}init(t){return this.mode=zh.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=zh.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Hh.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(Hh.a,Hh.b,Hh.c,Hh.d,Hh.e,Hh.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Hh.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(Hh.a,Hh.b,Hh.c,Hh.d,Hh.e,Hh.f),this}scale(t,e,i){return this.mode===zh.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===zh.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Hh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Hh.a,Hh.b,Hh.c,Hh.d,Hh.e,Hh.f),this}translate(t,e){return this.mode===zh.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===zh.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Vh=Ih([Oa(),Dh("design:paramtypes",[])],Vh);const Nh={arc:xl,area:Sl,circle:Al,line:Tl,path:wl,symbol:Pl,text:Bl,rect:El,polygon:Cl,richtext:Rl,richtextIcon:Ol,image:Ll,group:kl,glyph:Ml},Gh=Object.keys(Nh);function Wh(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Uh={arc:Object.assign({},Nh.arc),area:Object.assign({},Nh.area),circle:Object.assign({},Nh.circle),line:Object.assign({},Nh.line),path:Object.assign({},Nh.path),symbol:Object.assign({},Nh.symbol),text:Object.assign({},Nh.text),rect:Object.assign({},Nh.rect),polygon:Object.assign({},Nh.polygon),richtext:Object.assign({},Nh.richtext),richtextIcon:Object.assign({},Nh.richtextIcon),image:Object.assign({},Nh.image),group:Object.assign({},Nh.group),glyph:Object.assign({},Nh.glyph)};class Yh{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Gh.forEach((t=>{this._defaultTheme[t]=Object.create(Uh[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;Gh.forEach((s=>{const n=Object.create(Uh[s]);t&&t[s]&&Wh(n,t[s]),i[s]&&Wh(n,i[s]),e[s]&&Wh(n,e[s]),this.combinedTheme[s]=n})),e.common&&Gh.forEach((t=>{Wh(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 Kh=new Yh;function Xh(t,e){return t.glyphHost?Xh(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)):Kh.getTheme()}return null}(t)||t.attachedThemeGraphic&&Xh(t.attachedThemeGraphic)||Kh.getTheme()}var $h=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=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 $h(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 Qh))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(sc(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 Qh))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=sc(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 Qh))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=sc(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 Qh))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=sc(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 Qh))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=ic.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(sc(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(sc(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,sc(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 Qh))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"):sc(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 tc))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=ic.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 nc(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 Qh,this.rootWheelEvent=new tc,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 lc{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return lc.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 hc{static Avaliable(){return!0}avaliable(){return hc.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 cc{static Avaliable(){return!!Il.global.getRequestAnimationFrame()}avaliable(){return cc.Avaliable()}tick(t,e){Il.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var dc;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(dc||(dc={}));class uc{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-uc.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*uc.bounceIn(2*t):.5*uc.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}}}uc.quadIn=uc.getPowIn(2),uc.quadOut=uc.getPowOut(2),uc.quadInOut=uc.getPowInOut(2),uc.cubicIn=uc.getPowIn(3),uc.cubicOut=uc.getPowOut(3),uc.cubicInOut=uc.getPowInOut(3),uc.quartIn=uc.getPowIn(4),uc.quartOut=uc.getPowOut(4),uc.quartInOut=uc.getPowInOut(4),uc.quintIn=uc.getPowIn(5),uc.quintOut=uc.getPowOut(5),uc.quintInOut=uc.getPowInOut(5),uc.backIn=uc.getBackIn(1.7),uc.backOut=uc.getBackOut(1.7),uc.backInOut=uc.getBackInOut(1.7),uc.elasticIn=uc.getElasticIn(1,.3),uc.elasticOut=uc.getElasticOut(1,.3),uc.elasticInOut=uc.getElasticInOut(1,.3*1.5);class pc{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 gc=new pc;class mc{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(){}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 fc extends mc{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let vc=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]:gc;this.id=t,this.timeline=e,this.status=Ao.INITIAL,this.tailAnimate=new _c(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.duration===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 fc((()=>{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 _c(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()}};vc.mode=ko.NORMAL,vc.interpolateMap=new Map;class _c{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 yc(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?uc[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?uc[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 yc(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 yc{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 bc=200,xc="cubicOut",Sc=1e3,Ac="quadInOut";var kc;!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"}(kc||(kc={}));const Mc=[!1,!1,!1,!1],Tc=[0,0,0,0],wc=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Tc[0]=t[0],Tc[2]=t[0],Tc[1]=t[1],Tc[3]=t[1],Tc):t:t:0,Cc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Ec=[1,2,3,0,1,2,3,0];function Pc(t,e,i,s){for(;t>=Rt;)t-=Rt;for(;t<0;)t+=Rt;for(;t>e;)e+=Rt;Cc[0].x=i,Cc[1].y=i,Cc[2].x=-i,Cc[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]:Ic.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)}}Ic.TimeOut=1e3/60;const Dc=new Ic,Fc=(t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class jc extends mc{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 zc;!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"}(zc||(zc={}));class Hc extends mc{constructor(t,e,i,s,n){super(t,e,i,s,n),this.newPointAnimateType="appear"===(null==n?void 0:n.newPointAnimateType)?"appear":"grow"}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}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?[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=Bc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),i.points=this.points}}class Vc extends mc{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 Nc extends Vc{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=Il.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 Gc extends Vc{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=Il.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 Wc extends mc{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 Uc extends mc{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?uc[n]:n;e=r(e),s.onUpdate(t,e,i)})),this.updating=!1)}}function Yc(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 Kc(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 Qc(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 td(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 sd(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}))),ad=(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]},od=(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 ad(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return ad(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);od(n[0],s,i),od(n[1],e-s,i)}};var ld;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(ld||(ld={}));class hd{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ld.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===ld.Color1){const e=hd.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];hd.store1[t]=e,hd.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=hd.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&&(hd.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],hd.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===ld.Color1){if(hd.store1[t])return;hd.store1[t]=i,hd.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(hd.store255[t])return;hd.store255[t]=i,hd.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function cd(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 dd(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)=>ud(y(t)?t[r]:t,y(e)?e[r]:e,i,s))):ud(t,e,i,s,n)}function ud(t,e,i,s,n){if(!t||!e)return t&&cd(t)||e&&cd(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=hd.Get(t,ld.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=hd.Get(e,ld.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:cd(a)})))});return o?dd(r,l,i,s,n):dd(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:md(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:md(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:md(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),cd(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)}hd.store255={},hd.store1={};const pd=[0,0,0,0],gd=[0,0,0,0];function md(t,e,i){return hd.Get(t,ld.Color255,pd),hd.Get(e,ld.Color255,gd),`rgba(${Math.round(pd[0]+(gd[0]-pd[0])*i)},${Math.round(pd[1]+(gd[1]-pd[1])*i)},${Math.round(pd[2]+(gd[2]-pd[2])*i)},${pd[3]+(gd[3]-pd[3])*i})`}const fd=(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=dd(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},vd=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?Qc(t):[],n=Qc(e);i&&s&&(i.fromTransform&&td(s,i.fromTransform.clone().getInverse()),td(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})))},yd=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],bd=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!yd.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]?hd.Get(t[n],ld.Color255):t[n],to:"string"==typeof r?hd.Get(r,ld.Color255):r,key:n}):i.push({from:t[n],to:r,key:n}),s=!0)})),s?i:null};class xd extends mc{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;vd(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&fd(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Sd=(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=_d(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=bd(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 xd({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Sc,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Ac)),c};class Ad extends mc{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;vd(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&&fd(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const kd=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Lc.includes(t))(i)||(e[i]=t[i])})),e},Md=(t,e,i)=>{const s=kd(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=Il.graphicService.creator.rect({x:0,y:0,width:a,height:o});n.appendChild(i),e.push(i)}))}},Td=(t,e,i)=>{const s=[],n=i?null:kd(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:kd(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=id(t.attribute),n=sd(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(Il.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=sd(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(Il.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=sd(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(Il.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 nd(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 nd(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(Il.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:rd(i)}];const s=[];return od(i,e,s),s})(t,e).forEach((t=>{s.push(Il.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 od(r,e,h),h})(t,e).forEach((t=>{s.push(Il.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=Qc(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(Il.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(Il.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Md(t,s,e),s};class Cd{static GetImage(t,e){var i;const s=Cd.cache.get(t);s?"fail"===s.loadState?Il.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):Cd.loadImage(t,e)}static GetSvg(t,e){var i;let s=Cd.cache.get(t);s?"fail"===s.loadState?Il.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"},Cd.cache.set(t,s),s.dataPromise=Il.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=Cd.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"},Cd.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Il.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Il.global.loadBlob(t):"json"===e&&(i.dataPromise=Il.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Cd.isLoading&&Cd.toLoadAueue.length){Cd.isLoading=!0;const t=Cd.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Cd.cache.set(i,n),n.dataPromise=Il.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((()=>{Cd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Cd.loading()})).catch((t=>{console.error(t),Cd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Cd.loading()}))}}),0)}static loadImage(t,e){const i=Ed(t,Cd.toLoadAueue);if(-1!==i)return Cd.toLoadAueue[i].marks.push(e),void Cd.loading();Cd.toLoadAueue.push({url:t,marks:[e]}),Cd.loading()}static improveImageLoading(t){const e=Ed(t,Cd.toLoadAueue);if(-1!==e){const t=Cd.toLoadAueue.splice(e,1);Cd.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Ed(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;Dd.x=n+(null!==(i=t.scrollX)&&void 0!==i?i:0),Dd.y=r+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else Dd.x=n,Dd.y=r;return Dd}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Il.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Il.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]:Rd;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Rd;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(Il.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:bc,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:xc),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 Bd.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(Bd),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=pl.x,y:e=pl.y,scaleX:i=pl.scaleX,scaleY:s=pl.scaleY,angle:n=pl.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),Il.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(pl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Pd.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),Il.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=dd(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=dd(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=dd(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 Xh(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:Il.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 cl).fromString(t):this.pathProxy=new cl,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",Il.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new ec(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)}}}jd.mixin(rc);class zd{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 Hd(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Vd(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 Nd=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class Gd{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=Vd(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Hd(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Vd(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 zd(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 zd(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 Wd(t,e){return Ud(t)}function Ud(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 Zd=0;function Jd(){return Zd++}var Qd;function tu(t){const e=[];let i=0,s="";for(let n=0;neu.set(t,!0)));const iu=new Map;function su(t){if(eu.has(t))return!0;if(iu.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>iu.set(t,!0)));const nu=Jd(),ru=Jd(),au=Jd(),ou=Jd(),lu=Jd(),hu=Jd(),cu=Jd(),du=Jd(),uu=Jd(),pu=Jd();Jd();const gu=Jd();Jd();const mu=Jd(),fu=Jd(),vu=Jd(),_u=Symbol.for("GraphicService"),yu=Symbol.for("GraphicCreator"),bu={"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"},xu=Object.keys(bu);var Su;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Su||(Su={}));let Au=class t extends jd{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=hu,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 Yh),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Yh)}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;Il.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),Il.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=pl.x,y:e=pl.y,dx:i=pl.dx,dy:s=pl.dy,scaleX:n=pl.scaleX,scaleY:r=pl.scaleY,angle:a=pl.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=Xh(this).group;this._AABBBounds.clear();const i=Il.graphicService.updateGroupAABBBounds(t,e,this._AABBBounds,this),{boundsPadding:s=e.boundsPadding}=t,n=wc(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(),Il.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Il.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,Il.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{Il.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),Il.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=Il.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 ku(t){return new Au(t)}Au.NOWORK_ANIMATE_ATTR=Fd;class Mu extends Au{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 Yh,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=>{Il.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=>{Il.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 Tu=Symbol.for("TransformUtil"),wu=Symbol.for("GraphicUtil"),Cu=Symbol.for("LayerService"),Eu=Symbol.for("StaticLayerHandlerContribution"),Pu=Symbol.for("DynamicLayerHandlerContribution"),Bu=Symbol.for("VirtualLayerHandlerContribution");var Ru,Lu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)};let Iu=Ru=class{static GenerateLayerId(){return`${Ru.idprefix}_${Ru.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Il.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(Eu):"dynamic"===t?ql.get(Pu):ql.get(Bu),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 Mu(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Ru.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)}};Iu.idprefix="visactor_layer",Iu.prefix_count=0,Iu=Ru=Lu([Oa(),Ou("design:paramtypes",[])],Iu);var Du=new xa((t=>{t(io).to(ao).inSingletonScope(),t(Rh).to(Oh),t(wu).to(jh).inSingletonScope(),t(Tu).to(Vh).inSingletonScope(),t(Cu).to(Iu).inSingletonScope()}));function Fu(t,e){return!(!t&&!e)}function ju(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function zu(t,e,i){return i&&t*e>0}function Hu(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Vu(t,e){return t*e>0}function Nu(t,e,i,s){return t*e>0&&0!==i&&0!==s}function Gu(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 Uu(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(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:m,outerEndAngle:f,innerEndAngle:v,innerStartAngle:_}=t.getParsePadAngle(o,l),y=u,b=u,x=u,S=u,A=Math.max(b,y),k=Math.max(x,S);let M=A,T=k;const w=n*It(m),C=n*jt(m),E=r*It(v),P=r*jt(v);let B,R,L,O;if((k>Ct||A>Ct)&&(B=n*It(f),R=n*jt(f),L=r*It(_),O=r*jt(_),hCt){const t=Ft(y,M),r=Ft(b,M),o=Wu(L,O,w,C,n,t,Number(c)),l=Wu(B,R,E,P,n,r,Number(c));M0&&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+B,s+n*jt(f))}else!a||a[0]?(e.moveTo(i+w,s+C),e.arc(i,s,n,m,f,!c)):e.moveTo(i+n*It(f),s+n*jt(f));if(!(r>Ct)||g<.001)!a||a[1]?e.lineTo(i+E,s+P):e.moveTo(i+E,s+P),d=!0;else if(T>Ct){const t=Ft(S,T),n=Ft(x,T),o=Wu(E,P,B,R,r,-n,Number(c)),l=Wu(w,C,L,O,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),T0&&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+L,s+O)}else!a||a[1]?e.lineTo(i+E,s+P):e.moveTo(i+E,s+P),!a||a[2]?e.arc(i,s,r,v,_,c):e.moveTo(i+r*It(_),s+r*jt(_))}return a?a[3]&&e.lineTo(i+n*It(o),s+n*jt(o)):e.closePath(),d}class Yu{static GetCanvas(){try{return Yu.canvas||(Yu.canvas=Il.global.createCanvas({})),Yu.canvas}catch(t){return null}}static GetCtx(){if(!Yu.ctx){const t=Yu.GetCanvas();Yu.ctx=t.getContext("2d")}return Yu.ctx}}class Ku extends le{static getInstance(){return Ku._instance||(Ku._instance=new Ku),Ku._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=Yu.GetCanvas(),s=Yu.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 Ku(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Xu{static GetSize(t){for(let e=0;e=t)return Xu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Xu.GenKey(t,e,i,s,n),l=Xu.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=Xu.GenKey(t,e,i,s,n);Xu.cache[l]?Xu.cache[l].push({width:a,height:o,pattern:r}):Xu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}Xu.cache={},Xu.ImageSize=[20,40,80,160,320,640,1280,2560];const $u=Symbol.for("ArcRenderContribution"),qu=Symbol.for("AreaRenderContribution"),Zu=Symbol.for("CircleRenderContribution"),Ju=Symbol.for("GroupRenderContribution"),Qu=Symbol.for("ImageRenderContribution"),tp=Symbol.for("PathRenderContribution"),ep=Symbol.for("PolygonRenderContribution"),ip=Symbol.for("RectRenderContribution"),sp=Symbol.for("SymbolRenderContribution"),np=Symbol.for("TextRenderContribution"),rp=Symbol.for("InteractiveSubRenderContribution"),ap=["radius","startAngle","endAngle",...Rd];class op extends jd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=ou}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=Xh(this).circle;this._AABBBounds.clear();const i=this.attribute,s=Il.graphicService.updateCircleAABBBounds(i,Xh(this).circle,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=wc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xh(this).circle[t]}needUpdateTags(t){return super.needUpdateTags(t,ap)}needUpdateTag(t){return super.needUpdateTag(t,ap)}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 cl;return o.arc(0,0,n,r,a),o}clone(){return new op(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return op.NOWORK_ANIMATE_ATTR}}function lp(t){return new op(t)}function hp(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 cp(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function dp(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)}op.NOWORK_ANIMATE_ATTR=Fd;class up{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=vu,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=Xh(this).text;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=this.attribute,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}updateWrapAABBBounds(t){var e,i,s,n;const r=Xh(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=Fc(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=Il.graphicUtil.textMeasure,k=new up(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===Qd.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=cp(x,o),M=dp(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=Xh(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=Fc(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 _=Il.graphicUtil.textMeasure,y=new up(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=Xh(this).text,a=Il.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=Fc(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=cp(x,o),e=this.cache.verticalList.length*b,i=dp(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=>tu(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===Qd.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=cp(x,o),M=this.cache.verticalList.length*b,T=dp(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 Xh(this).text[t]}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pp;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pp;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function mp(t){return new gp(t)}gp.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Fd),gp.baselineMapAlign={top:"left",bottom:"right",middle:"center"},gp.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class fp{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 vp(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 _p=new class extends fp{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 vp(t,e/2,i,s,n)}drawOffset(t,e,i,s,n,r){return vp(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 yp=new class extends fp{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 bp(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 xp=new class extends fp{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 bp(t,e/2,i,s,n)}drawFitDir(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)}};function Sp(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Ap=new class extends fp{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Sp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Sp(t,e/2+n,i,s)}};class kp extends fp{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 Mp=new kp;var Tp=new class extends kp{constructor(){super(...arguments),this.type="triangle"}};const wp=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Cp=Math.sin(Bt/10)*wp,Ep=-Math.cos(Bt/10)*wp;function Pp(t,e,i,s){const n=Cp*e,r=Ep*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 Bp=new class extends fp{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 Pp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Pp(t,e/2+n,i,s)}};const Rp=zt(3);function Lp(t,e,i,s){const n=e,r=n/Rp,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 Op=new class extends fp{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 Lp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Lp(t,e/2+n,i,s)}};function Ip(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 Dp=new class extends fp{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Ip(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Ip(t,e/2+n,i,s)}};function Fp(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var jp=new class extends fp{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}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)}};const zp=-.5,Hp=zt(3)/2,Vp=1/zt(12);function Np(t,e,i,s){const n=e/2,r=e*Vp,a=n,o=e*Vp+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(zp*n-Hp*r+i,Hp*n+zp*r+s),t.lineTo(zp*a-Hp*o+i,Hp*a+zp*o+s),t.lineTo(zp*l-Hp*h+i,Hp*l+zp*h+s),t.lineTo(zp*n+Hp*r+i,zp*r-Hp*n+s),t.lineTo(zp*a+Hp*o+i,zp*o-Hp*a+s),t.lineTo(zp*l+Hp*h+i,zp*h-Hp*l+s),t.closePath(),!1}var Gp=new class extends fp{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 Np(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Np(t,e/2+n,i,s)}};var Wp=new class extends fp{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 Up=new class extends fp{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 Yp=new class extends fp{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 Kp=zt(3);function Xp(t,e,i,s){const n=e*Kp;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var $p=new class extends kp{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Xp(t,e/2/Kp,i,s)}drawOffset(t,e,i,s,n){return Xp(t,e/2/Kp+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 Zp=new class extends fp{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 Jp(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 Qp=new class extends fp{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 Jp(t,e/4,i,s)}drawOffset(t,e,i,s,n){return Jp(t,e/4+n,i,s)}};function tg(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 eg=new class extends fp{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 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-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var sg=new class extends fp{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 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,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var rg=new class extends fp{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return ng(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return ng(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 ag(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var og=new class extends fp{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return ag(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return ag(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 lg(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 hg=new class extends fp{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 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-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function cg(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function dg(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var ug=new class extends fp{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)?dg(t,e,i,s):cg(t,e,i,s)}drawOffset(t,e,i,s,n){return S(e)?dg(t,e+2*n,i,s):cg(t,[e[0]+2*n,e[1]+2*n],i,s)}};const pg=new Qt;class gg{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;pg.x1=s.bounds.x1*t,pg.y1=s.bounds.y1*t,pg.x2=s.bounds.x2*t,pg.y2=s.bounds.y2*t,e.union(pg)}))}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 mg={};[_p,yp,xp,Ap,$p,Tp,Bp,Op,Dp,jp,Gp,Wp,Up,Mp,Yp,Zp,Qp,eg,sg,ug,rg,og,hg].forEach((t=>{mg[t.type]=t}));const fg={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"},vg=new Qt,_g=["symbolType","size",...Rd];let yg=class t extends jd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=fu}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=Xh(this).symbol;let{symbolType:i=e.symbolType}=this.attribute,s=mg[i];if(s)return this._parsedPath=s,s;if(s=t.userSymbolMap[i],s)return this._parsedPath=s,s;if(i=fg[i]||i,!0===((n=i).startsWith("{const e=(new cl).fromString(t.d),i={};xu.forEach((e=>{t[e]&&(i[bu[e]]=t[e])})),r.push({path:e,attribute:i}),vg.union(e.bounds)}));const a=vg.width(),o=vg.height(),l=1/Dt(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new gg(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var n;const r=(new cl).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 gg(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=Xh(this).symbol;this._AABBBounds.clear();const i=this.attribute,s=Il.graphicService.updateSymbolAABBBounds(i,Xh(this).symbol,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=wc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xh(this).symbol[t]}needUpdateTags(t){return super.needUpdateTags(t,_g)}needUpdateTag(t){return super.needUpdateTag(t,_g)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new cl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new cl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function bg(t){return new yg(t)}yg.userSymbolMap={},yg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Fd);const xg=["segments","points","curveType",...Rd];let Sg=class t extends jd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=du}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=Rc(i,s,e))}doUpdateAABBBounds(){const t=Xh(this).line;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateLineAABBBounds(e,Xh(this).line,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xh(this).line[t]}needUpdateTags(t){return super.needUpdateTags(t,xg)}needUpdateTag(t){return super.needUpdateTag(t,xg)}toCustomPath(){const t=this.attribute,e=new cl,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 Ag(t){return new Sg(t)}Sg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Fd);const kg=["width","x1","y1","height","cornerRadius",...Rd];class Mg extends jd{constructor(t){super(t),this.type="rect",this.numberType=gu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}doUpdateAABBBounds(){const t=Xh(this).rect;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateRectAABBBounds(e,Xh(this).rect,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xh(this).rect[t]}needUpdateTags(t){return super.needUpdateTags(t,kg)}needUpdateTag(t){return super.needUpdateTag(t,kg)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:s,height:n}=id(t),r=new cl;return r.moveTo(e,i),r.rect(e,i,s,n),r}clone(){return new Mg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Mg.NOWORK_ANIMATE_ATTR}}function Tg(t){return new Mg(t)}Mg.NOWORK_ANIMATE_ATTR=Fd;class wg extends jd{constructor(t){super(t),this.type="glyph",this.numberType=lu,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=Il.graphicService.updateGlyphAABBBounds(this.attribute,Xh(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 wg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return wg.NOWORK_ANIMATE_ATTR}}function Cg(t){return new wg(t)}wg.NOWORK_ANIMATE_ATTR=Fd;class Eg{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=Dl[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 Pg{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const s=Fc(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}=Wl(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}=Wl(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=Nl(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}=Wl(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||jl;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||Fl;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=Nl(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Wl(this.text.slice(t),this.character);return i+this.ellipsisWidth-s}return i}}const Bg=["width","height","image",...Rd];class Rg extends jd{constructor(t){super(t),this.type="image",this.numberType=cu,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=Xh(this).image;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateImageAABBBounds(e,Xh(this).image,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Ll[t]}needUpdateTags(t){return super.needUpdateTags(t,Bg)}needUpdateTag(t){return super.needUpdateTag(t,Bg)}clone(){return new Rg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Rg.NOWORK_ANIMATE_ATTR}}function Lg(t){return new Rg(t)}Rg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Fd);class Og extends Rg{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=wc(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=wc(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=Ll.width,height:e=Ll.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 Ig{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 Og?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=Dl[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Pg){const e=Vl.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 Og)break;if("vertical"===this.direction&&"vertical"!==s.direction){s.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";s.ellipsisStr=r;const{width:a}=Wl(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 Og)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 Og)break;const{width:n}=Wl(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 Og?t.width:t.getWidthWithEllips(this.direction)})),i}}class Dg{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=Dl[this.direction]}store(t){if(t instanceof Og){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 Ig(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 Og?"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=Nl(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 Pg(i,t.newLine,t.character),new Pg(s,!0,t.character)]}(t,s);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const Fg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...Rd];class jg extends jd{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=mu}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Rl.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:Rl.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:Rl.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:Rl.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:Rl.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:Rl.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:Rl.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:Rl.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=Xh(this).richtext;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateRichTextAABBBounds(e,Xh(this).richtext,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Rl[t]}needUpdateTags(t){return super.needUpdateTags(t,Fg)}needUpdateTag(t){return super.needUpdateTag(t,Fg)}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(){var t;const{textConfig:e=[],maxWidth:i,maxHeight:s,width:n,height:r,ellipsis:a,wordBreak:o,verticalDirection:l,textAlign:h,textBaseline:c,layoutDirection:d,singleLine:u,disableAutoWrapLine:p}=this.attribute,g=[];for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,g.push(t)}}else{const i=this.combinedStyleToCharacter(e[t]);if(S(i.text)&&(i.text=`${i.text}`),i.text&&i.text.includes("\n")){const t=i.text.split("\n");for(let e=0;e0,f="number"==typeof s&&Number.isFinite(s)&&s>0,v="number"==typeof n&&Number.isFinite(n)&&n>0&&(!m||n<=i),_="number"==typeof r&&Number.isFinite(r)&&r>0&&(!f||r<=s),y=new Eg(0,0,(v?n:m?i:0)||0,(_?r:f?s:0)||0,a,o,l,h,c,d||"horizontal",!v&&m,!_&&f,u||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),b=new Dg(y);if(p){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 jg.NOWORK_ANIMATE_ATTR}}function zg(t){return new jg(t)}jg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Fd);const Hg=["path","customPath",...Rd];class Vg extends jd{constructor(t){super(t),this.type="path",this.numberType=uu}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=Xh(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof cl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof cl?this.cache:t.path)}doUpdateAABBBounds(){const t=Xh(this).path;this.doUpdatePathShape(),this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updatePathAABBBounds(e,Xh(this).path,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new cl).fromString(t.path):t.customPath&&(this.cache=new cl,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xh(this).path[t]}needUpdateTags(t){return super.needUpdateTags(t,Hg)}needUpdateTag(t){return super.needUpdateTag(t,Hg)}toCustomPath(){return(new cl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Vg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Vg.NOWORK_ANIMATE_ATTR}}function Ng(t){return new Vg(t)}Vg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Fd);const Gg=["segments","points","curveType",...Rd];class Wg extends jd{constructor(t){super(t),this.type="area",this.numberType=au}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=Xh(this).area;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateAreaAABBBounds(e,Xh(this).area,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Rc(i,s,e))}getDefaultAttribute(t){return Xh(this).area[t]}needUpdateTags(t){return super.needUpdateTags(t,Gg)}needUpdateTag(t){return super.needUpdateTag(t,Gg)}toCustomPath(){const t=new cl,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 Wg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Wg.NOWORK_ANIMATE_ATTR}}function Ug(t){return new Wg(t)}Wg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Fd);const Yg=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Rd];class Kg extends jd{constructor(t){super(t),this.type="arc",this.numberType=nu}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=Xh(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);return Math.min(S(e,!0)?e:a*parseFloat(e)/100,a/2)}getParsedAngle(){const t=Xh(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=Xh(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=Nt(Number(l)/o*jt(g)),n=Nt(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=Xh(this).arc;this._AABBBounds.clear();const i=this.attribute,s=Il.graphicService.updateArcAABBBounds(i,Xh(this).arc,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=wc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return super.needUpdateTags(t,Yg)}needUpdateTag(t){return super.needUpdateTag(t,Yg)}getDefaultAttribute(t){return Xh(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 Kg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Kg.NOWORK_ANIMATE_ATTR}}function Xg(t){return new Kg(t)}Kg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Fd);const $g=["points","cornerRadius",...Rd];class qg extends jd{constructor(t){super(t),this.type="polygon",this.numberType=pu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=Xh(this).polygon;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updatePolygonAABBBounds(e,Xh(this).polygon,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Rc(i,s,e))}getDefaultAttribute(t){return Xh(this).polygon[t]}needUpdateTags(t){return super.needUpdateTags(t,$g)}needUpdateTag(t){return super.needUpdateTag(t,$g)}toCustomPath(){const t=this.attribute.points,e=new cl;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 Zg(t){return new qg(t)}qg.NOWORK_ANIMATE_ATTR=Fd;class Jg extends Au{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 Qg(t){return new Jg(t)}class tm{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 em extends tm{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 im{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 im.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},am=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},om=function(t,e){return function(i,s){e(i,s,t)}};function lm(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 hm(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 cm(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 dm(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),lm(t,t,[n+o,r+l,a+h]),lm(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),lm(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=nm.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]}lm(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),lm(i,i,[-s[0],-s[1],0]),cm(t,t,i)}}let um=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 tm],this._symbolBoundsContribitions=[new em],this._imageBoundsContribitions=[new tm],this._circleBoundsContribitions=[new tm],this._arcBoundsContribitions=[new tm],this._pathBoundsContribitions=[new tm]}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,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}=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 h=this.tempAABBBounds1,c=this.tempAABBBounds2;return h.setValue(i.x1,i.y1,i.x2,i.y2),c.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=dp(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=cp(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),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}=t,r=i;return n.forEach((t=>{r.add(t.x,t.y)})),r}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{r.add(t.x,t.y)}))})),r}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):Pc(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):(Pc(h,l,n,i),Pc(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&&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)}};um=rm([Oa(),om(0,Ra(yu)),am("design:paramtypes",[Object])],um);const pm=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 gm,mm;function fm(t){return gm||(gm=pm.CreateGraphic("text",{})),gm.initAttributes(t),gm.AABBBounds}const vm={x:0,y:0,z:0,lastModelMatrix:null};class _m{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=zu(o,l,n),p=Vu(o,c),g=Fu(n,r),m=ju(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;vm.x=n,vm.y=r,vm.z=a,vm.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=nm.allocate(),n=nm.allocate();dm(n,t,e),cm(s,d||s,n),vm.x=0,vm.y=0,vm.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),nm.free(n)}if(g&&!d){const s=t.getOffsetXY(e);vm.x+=s.x,vm.y+=s.y,vm.z=a,i.setTransformForCurrent()}else if(p)vm.x=0,vm.y=0,vm.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);vm.x+=s.x,vm.y+=s.y,this.transformWithoutTranslate(i,vm.x,vm.y,vm.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),vm.x=0,vm.y=0,vm.z=0;return vm}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=Xh(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,_=zu(d,u,h),y=Vu(d,g),b=Fu(h),x=ju(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&&nm.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}const ym=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 bm{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(bm.IsGradientStr(t))try{const e=ym(t)[0];if(e){if("linear"===e.type)return bm.ParseLinear(e);if("radial"===e.type)return bm.ParseRadial(e);if("conic"===e.type)return bm.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 xm(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 Sm(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 Am=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},km=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mm=function(t,e){return function(i,s){e(i,s,t)}};class Tm{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=Xh(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=Eh.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),Eh.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 wm=new Tm;let Cm=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)}))}};Cm=Am([Oa(),Mm(0,Ra(qa)),Mm(0,Ia(rp)),km("design:paramtypes",[Object])],Cm);class Em{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=Eh.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])),Eh.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 Pm=new Em;const Bm=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=xm(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T+r,innerRadius:M-r,startAngle:_-a,endAngle:y+a}),e.beginPath(),Uu(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=xm(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T-r,innerRadius:M+r,startAngle:_+a,endAngle:y-a}),e.beginPath(),Uu(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})}},Rm=Pm,Lm=wm;const Om=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=xm(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=xm(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()}}}},Im=Pm,Dm=wm;const Fm=new class extends Tm{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()}},jm=Et/2;function zm(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],-jm,0,!1)}if(t.lineTo(_[0],_[1]),!q(v,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,jm,!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],jm,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+jm,!1)}return t.closePath(),t}var Hm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Vm{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=xm(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(),zm(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=xm(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(),zm(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 Nm=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)}};Nm=Hm([Oa()],Nm);let Gm=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()}}};Gm=Hm([Oa()],Gm);const Wm=new Vm,Um=Pm,Ym=wm;const Km=new class extends Vm{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)}},Xm=new class extends Tm{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=Xh(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=wc(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?zm(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 $m=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=xm(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=xm(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=Pm,Zm=wm;var Jm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},tf=function(t,e){return function(i,s){e(i,s,t)}};let ef=class extends _m{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=nu,this.builtinContributions=[Bm,Lm,Rm],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||T>Ct)&&(O=n*It(y),I=n*jt(y),D=r*It(x),F=r*jt(x),uCt){const t=Ft(S,C),r=Ft(A,C),a=Wu(D,F,P,B,n,t,Number(p)),o=Wu(O,I,R,L,n,r,Number(p));if(C0&&e.arc(i+o.cx,s+o.cy,r,Ot(o.y11,o.x11),Ot(o.y01,o.x01),!p)}}else e.moveTo(i+P,s+B);if(!(r>Ct)||v<.001)e.lineTo(i+R,s+L),g=!0;else if(E>Ct){const t=Ft(M,E),n=Ft(k,E),a=Wu(R,L,O,I,r,-n,Number(p)),o=Wu(P,B,D,F,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),E0&&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(x),s+r*jt(x));return g}drawShape(t,e,i,s,n,r,a,o){const l=Xh(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++)Mc[s]=t,i&&(i=!(null!==(e=Mc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Mc[e]=!!t[e],i&&(i=!!Mc[e]);else Mc[0]=!1,Mc[1]=!1,Mc[2]=!1,Mc[3]=!1;return{isFullStroke:i,stroke:Mc}})(d);if((v||C)&&(e.beginPath(),Uu(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(),Uu(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),dd(o.color,l.color,h,!1)}(0,0,h,n);a||zu&&(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=Xh(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}};ef=Jm([Oa(),tf(0,Ra(qa)),tf(0,Ia($u)),Qm("design:paramtypes",[Object])],ef);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 _m{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=ou,this.builtinContributions=[Om,Dm,Im],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Xh(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=Xh(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function of(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 lf(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),of(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 cf=class extends _m{constructor(){super(...arguments),this.numberType=du}draw(t,e,i,s){const n=Xh(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;lf(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(),lf(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"===f)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=hl(t.points,f,{startPoint:e});return s=n,n})).filter((t=>!!t)),"linearClosed"===f){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===v){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],v,_,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=v*r;let g=0,m=!1;t.cache.forEach(((r,f)=>{if(m)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(m=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[f],[l,t.attribute],Ft(y,1),_,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,v,_,i,s,t,a,o)}};function df(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 uf(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),of(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),of(t,l,1,s),o=!1):o=!0}t.closePath()}cf=hf([Oa()],cf);const pf=new class extends Em{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:Oc(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Oc(l,"textureColor")),textureSize:b=(null!==(m=t.attribute.textureSize)&&void 0!==m?m:Oc(l,"textureSize")),texturePadding:x=(null!==(f=t.attribute.texturePadding)&&void 0!==f?f:Oc(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},gf=wm;var mf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ff=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)}};function _f(t,e,i){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"linearClosed":return ll(t,i)}}let yf=class extends _m{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=au,this.builtinContributions=[pf,gf],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=Xh(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}=t.attribute,b=this.valid(t,g,a,o);if(!b)return;const{doFill:x,doStroke:S}=b,{clipRange:A=g.clipRange,closePath:k,points:M,segments:T}=t.attribute;let{curveType:w=g.curveType}=t.attribute;if(k&&"linear"===w&&(w="linearClosed"),1===A&&!T&&!M.some((t=>!1===t.defined))&&"linear"===w)return this.drawLinearAreaHighPerformance(t,e,!!m,S,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(T&&T.length){let e,i;const s=T.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=_f(t.points,w,{startPoint:e});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=T.length-1;t>=0;t--){const e=T[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=T[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=_f(i,"stepBefore"===w?"stepAfter":"stepAfter"===w?"stepBefore":w),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!M||!M.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=M,i=[];for(let t=M.length-1;t>=0;t--)i.push({x:null!==(u=M[t].x1)&&void 0!==u?u:M[t].x,y:null!==(p=M[t].y1)&&void 0!==p?p:M[t].y});const s=_f(e,w),n=_f(i,"stepBefore"===w?"stepAfter":"stepAfter"===w?"stepBefore":w);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===A){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,x,v,S,y,r[c],[g,t.attribute],A,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=A*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,x,v,S,y,r[u],[g,t.attribute],Ft(m,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,x,v,S,y,t.attribute,g,A,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Xh(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=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),df(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),df(t,e,i,s),e.length=0,i.length=0)}n=o})),df(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},Af=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kf=function(t,e){return function(i,s){e(i,s,t)}};let Mf=class extends _m{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=uu,this.builtinContributions=[xf,bf],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:Xh(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=Xh(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Mf=Sf([Oa(),kf(0,Ra(qa)),kf(0,Ia(tp)),Af("design:paramtypes",[Object])],Mf);var Tf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 _m{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=gu,this.builtinContributions=[Wm,Ym,Um],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Xh(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=Hu(g,m,k,M,c),w=Nu(g,v,k,M),C=Fu(c,d),E=ju(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(),zm(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=Xh(t,null==s?void 0:s.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Ef=Tf([Oa(),Cf(0,Ra(qa)),Cf(0,Ia(ip)),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 _m{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=fu,this.builtinContributions=[$m,Zm,qm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=Xh(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=Xh(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Lf=Pf([Oa(),Rf(0,Ra(qa)),Rf(0,Ia(sp)),Bf("design:paramtypes",[Object])],Lf);const Of=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 If=new class extends Tm{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=Of.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=fm(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?(zm(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&&Of.free(C),w()}};var Df=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ff=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jf=function(t,e){return function(i,s){e(i,s,t)}};let zf=class extends _m{constructor(t){super(),this.textRenderContribitions=t,this.numberType=vu,this.builtinContributions=[If],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Xh(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=Fc(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=sm.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),sm.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=Xh(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=cp(l,f),_=dp(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=dp("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 Hf(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},Yf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kf=function(t,e){return function(i,s){e(i,s,t)}};let Xf=class extends _m{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=pu,this.builtinContributions=[Wf,Gf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Xh(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))?Hf(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 Hf(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=Vf(d,u),b=Vf(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*f);const S=Nf(h,_,y,d,u),A=Nf(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Vf(k,M),w=Nf(h,Vf(_,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=Xh(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Xf=Uf([Oa(),Kf(0,Ra(qa)),Kf(0,Ia(ep)),Yf("design:paramtypes",[Object])],Xf);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},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)}};const Jf=["","repeat-x","repeat-y","repeat"];let Qf=class extends _m{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=cu,this.builtinContributions=[Km,Xm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Xh(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(),zm(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,Jf[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 Cd.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Xh(t).image;this._draw(t,a,!1,i)}};Qf=$f([Oa(),Zf(0,Ra(qa)),Zf(0,Ia(Qu)),qf("design:paramtypes",[Object])],Qf);const tv=Symbol.for("IncrementalDrawContribution"),ev=Symbol.for("ArcRender"),iv=Symbol.for("AreaRender"),sv=Symbol.for("CircleRender"),nv=Symbol.for("GraphicRender"),rv=Symbol.for("GroupRender"),av=Symbol.for("LineRender"),ov=Symbol.for("PathRender"),lv=Symbol.for("PolygonRender"),hv=Symbol.for("RectRender"),cv=Symbol.for("SymbolRender"),dv=Symbol.for("TextRender"),uv=Symbol.for("RichTextRender"),pv=Symbol.for("GlyphRender"),gv=Symbol.for("ImageRender"),mv=Symbol.for("DrawContribution");var fv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)};const _v=Symbol.for("DrawItemInterceptor"),yv=new Qt,bv=new Qt;class xv{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return t.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){yv.copy(s.dirtyBounds),bv.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(yv),s.backupDirtyBounds.copy(bv)),!0}}class Sv{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 Av=class{constructor(){this.order=1,this.interceptors=[new xv,new Mv,new kv,new Sv]}afterDrawItem(t,e,i,s,n){for(let r=0;r(e=t.numberType===ru,!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&&nm.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Tv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},Cv=function(t,e){return function(i,s){e(i,s,t)}};const Ev=Symbol.for("RenderService");let Pv=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}};Pv=Tv([Oa(),Cv(0,Ra(mv)),wv("design:paramtypes",[Object])],Pv);var Bv=new xa((t=>{t(Ev).to(Pv)}));const Rv=Symbol.for("PickerService"),Lv=Symbol.for("GlobalPickerService");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};const Iv=Symbol.for("PickItemInterceptor");let Dv=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){if(!t.shadowRoot)return null;const{parentMatrix:r}=n||{};if(!r)return null;const a=e.pickContext;a.highPerformanceSave();const o=t.shadowRoot,l=sm.allocateByObj(r),h=new $t(l.a*i.x+l.c*i.y+l.e,l.b*i.x+l.d*i.y+l.f),c=e.pickGroup(o,h,l,s);return a.highPerformanceRestore(),c}};Dv=Ov([Oa()],Dv);let Fv=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}};Fv=Ov([Oa()],Fv);let jv=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===ru,!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()}};jv=Ov([Oa()],jv);var zv=new xa(((t,e,i)=>{i(Rv)||(t(Lv).toSelf(),t(Rv).toService(Lv)),t(jv).toSelf().inSingletonScope(),t(Iv).toService(jv),t(Dv).toSelf().inSingletonScope(),t(Iv).toService(Dv),t(Fv).toSelf().inSingletonScope(),t(Iv).toService(Fv),Ja(t,Iv)})),Hv=new xa((t=>{t(_u).to(um).inSingletonScope(),t(yu).toConstantValue(pm)}));const Vv=Symbol.for("AutoEnablePlugins"),Nv=Symbol.for("PluginService");var Gv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},Uv=function(t,e){return function(i,s){e(i,s,t)}};let Yv=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(Vv)&&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=[]}};Yv=Gv([Oa(),Uv(0,Ra(qa)),Uv(0,Ia(Vv)),Wv("design:paramtypes",[Object])],Yv);var Kv=new xa((t=>{t(Nv).to(Yv),function(t,e){t(qa).toDynamicValue((t=>{let{container:i}=t;return new Za(e,i)})).whenTargetNamed(e)}(t,Vv)})),Xv=new xa((t=>{Ja(t,eo)})),$v=new xa((t=>{t(Xl).to($l).inSingletonScope(),Ja(t,Xl)})),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)};let Jv=class{constructor(){this.type="static",this.offscreen=!1,this.global=Il.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=Ql({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()}};Jv=qv([Oa(),Zv("design:paramtypes",[])],Jv);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},t_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let e_=class{constructor(){this.offscreen=!1,this.type="virtual",this.global=Il.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(){}};e_=Qv([Oa(),t_("design:paramtypes",[])],e_);var i_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},s_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let n_=class{constructor(){this.offscreen=!0,this.type="dynamic",this.global=Il.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;const s=Ql({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){}};n_=i_([Oa(),s_("design:paramtypes",[])],n_);var r_=new xa((t=>{t(Jv).toSelf(),t(n_).toSelf(),t(e_).toSelf(),t(Eu).toService(Jv),t(Pu).toService(n_),t(Bu).toService(e_)}));var a_=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 o_(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 a_(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,s)}))}function h_(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 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)},u_=function(t,e){return function(i,s){e(i,s,t)}};let p_=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=Il.global,this.layerService=Il.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:bl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:bl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,sm.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=h_(e,i,bl.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=Of.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=sm.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))})):o_(t,bl.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),Of.free(n),sm.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(tv);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},m_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},f_=function(t,e){return function(i,s){e(i,s,t)}};let v_=class{constructor(t){this.groupRenderContribitions=t,this.numberType=hu}drawShape(t,e,i,s,n,r,a,o){const l=Xh(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=Hu(u,f,p,g,h),k=Nu(u,v,p,g),M=Fu(h,c),T=ju(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(),zm(e,i,s,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Fm));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=Xh(t,null==s?void 0:s.theme).group,l=n.modelMatrix;if(n.camera){const e=nm.allocate(),i=nm.allocate();dm(i,t,o),cm(e,l||e,i),n.modelMatrix=e,nm.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&&nm.free(n.modelMatrix),n.modelMatrix=l,n.baseGlobalAlpha/=a,d&&d.then?d.then((()=>{r?n.restore():n.highPerformanceRestore()})):r?n.restore():n.highPerformanceRestore()}};v_=g_([Oa(),f_(0,Ra(qa)),f_(0,Ia(Ju)),m_("design:paramtypes",[Object])],v_);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};let y_=class extends cf{constructor(){super(...arguments),this.numberType=du}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=Xh(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=zu(u,p,c),_=Vu(u,g),y=Fu(c),b=ju(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())}};y_=__([Oa()],y_);var b_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 x_=class extends yf{constructor(){super(...arguments),this.numberType=au}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=Xh(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=zu(u,d,c),m=Fu(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())}};x_=b_([Oa()],x_);var S_,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},k_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},M_=function(t,e){return function(i,s){e(i,s,t)}},T_=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"}(S_||(S_={}));let w_=class extends p_{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=S_.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 T_(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:bl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:bl.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 T_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return T_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>T_(this,void 0,void 0,(function*(){if(2!==t.count)yield l_(t,bl.zIndex,((i,s)=>{if(this.status===S_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return T_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return T_(this,void 0,void 0,(function*(){this.rendering&&(this.status=S_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=S_.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 T_(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:()=>T_(this,void 0,void 0,(function*(){yield l_(t,bl.zIndex,(t=>T_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};w_=A_([Oa(),M_(0,La(nv)),M_(1,Ra(y_)),M_(2,Ra(x_)),M_(3,Ra(qa)),M_(3,Ia(_v)),k_("design:paramtypes",[Array,Object,Object,Object])],w_);var C_=new xa((t=>{t(Tm).toSelf().inSingletonScope(),t(Em).toSelf().inSingletonScope(),t(mv).to(p_),t(tv).to(w_),t(rv).to(v_).inSingletonScope(),t(nv).toService(rv),Ja(t,Ju),t(Cm).toSelf().inSingletonScope(),Ja(t,rp),Ja(t,nv),t(Av).toSelf().inSingletonScope(),t(_v).toService(Av),Ja(t,_v)}));function E_(){E_.__loaded||(E_.__loaded=!0,ql.load(Du),ql.load(Hv),ql.load(Bv),ql.load(zv),ql.load(Kv),function(t){t.load(Xv),t.load($v),t.load(r_)}(ql),function(t){t.load(C_)}(ql))}E_.__loaded=!1,E_();const P_=ql.get(io);Il.global=P_;const B_=ql.get(wu);Il.graphicUtil=B_;const R_=ql.get(Tu);Il.transformUtil=R_;const L_=ql.get(_u);Il.graphicService=L_;const O_=ql.get(Cu);Il.layerService=O_;class I_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Il.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),Il.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){Il.graphicService.hooks.onAttributeUpdate.taps=Il.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onSetStage.taps=Il.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class D_{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 F_{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,Il.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))})),Il.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){Il.graphicService.hooks.onAddIncremental.taps=Il.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onClearIncremental.taps=Il.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Il.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 j_{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)),Il.graphicService.hooks.onRemove.unTap(this.key),Il.graphicService.hooks.onRelease.unTap(this.key),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?Il.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:Il.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return function(t){const e={};return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[ni(i)]=t[i])})),["fontSize","lineHeight"].forEach((i=>{const s=ni(i);u(t[i])||(e[s]=/^[0-9]*$/.test(`${t[i]}`)?`${t[i]}px`:`${t[i]}`)})),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:Xh(t).text)}getTransformOfText(t){const e=Xh(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=Il.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),f=o+m.left-p.left,v=l+m.top-p.top;if(a.left=`${f}px`,a.top=`${v}px`,"text"===t.type&&"position"===c&&(a=Object.assign(Object.assign({},a),this.getTransformOfText(t))),d(n.style)){const e=n.style({top:v,left:f,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)));Il.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"===Il.global.env&&(t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:bl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:bl.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&&Il.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"===Il.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 z_=new Qt;class H_{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()})),Il.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&&(z_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(z_,t.parent&&t.parent.globalTransMatrix)))})),Il.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))})),Il.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){Il.graphicService.hooks.beforeUpdateAABBBounds.taps=Il.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.afterUpdateAABBBounds.taps=Il.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)),Il.graphicService.hooks.onRemove.taps=Il.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const V_=new Qt;class N_{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=Xh(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,Il.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),Il.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&V_.copy(s)})),Il.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(V_.equals(i)||this.tryLayout(t,!1))})),Il.graphicService.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1)}))}deactivate(t){Il.graphicService.hooks.onAttributeUpdate.taps=Il.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.beforeUpdateAABBBounds.taps=Il.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.afterUpdateAABBBounds.taps=Il.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onSetStage.taps=Il.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const G_=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===dc.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=dc.INITIAL,Il.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),Il.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:cc},{mode:"timeout",cons:hc},{mode:"manual",cons:lc}];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!==dc.INITIAL&&(this.status=dc.PAUSE,!0)}resume(){return this.status!==dc.INITIAL&&(this.status=dc.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===dc.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===dc.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=dc.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=dc.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};G_.addTimeline(gc),G_.setFPS(60);class W_{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=hd.Get(e,ld.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)?hd.Get(e,ld.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}function U_(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 Y_(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 K_{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=nm.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=nm.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()})),i&&Il.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))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])this.htmlMap[o].root.render(r);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t){const i=n.createRoot(t);i.render(r),this.htmlMap||(this.htmlMap={}),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}}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 Z_="white";class J_ extends Au{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:Z_}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 Yh,this.hooks={beforeRender:new to(["stage"]),afterRender:new to(["stage"])},this.global=Il.global,!this.global.env&&$_()&&this.global.setEnv("browser"),this.window=ql.get(Rh),this.renderService=ql.get(Ev),this.pluginService=ql.get(Nv),this.layerService=ql.get(Cu),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:Z_,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||G_,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new pc,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 oc(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 W_(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 K_(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 D_))}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 I_))}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 F_))}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 H_,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 N_))}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 j_))}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){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(){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){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(){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];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];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){this.pickerService||(this.pickerService=ql.get(Rv));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){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){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;const e=ql.get(Rh),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;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 Q_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ty=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ey=new oe(1,0,0,1,0,0),iy={x:0,y:0};let sy=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 cl,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 sm.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(sm.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(sm.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},iy),function(t,e,i){return Ch(t,0,!1,e,i)}(this.path.commandList,iy.x,iy.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},iy);const i=xm(this,this.lineWidth,this.dpr);return function(t,e,i,s){return Ch(t,e,!0,i,s)}(this.path.commandList,i,iy.x,iy.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(ey,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=>sm.free(t))),this.stack.length=0}};sy=Q_([Oa(),ty("design:paramtypes",[Object,Number])],sy);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},ry=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ay={WIDTH:500,HEIGHT:500,DPR:1};let oy=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=ay.WIDTH,height:n=ay.HEIGHT,dpr:r=ay.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)}};oy.env="browser",oy=ny([Oa(),ry("design:paramtypes",[Object])],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};let hy=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}}};hy=ly([Oa()],hy);var cy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let uy=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}};uy=cy([Oa(),dy("design:paramtypes",[])],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)},my=function(t,e){return function(i,s){e(i,s,t)}};let fy=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=Il.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=nm.allocate();if(hm(i,e),a){if(i){const t=nm.allocate();r.modelMatrix=cm(t,a,i),nm.free(i)}}else hm(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=Xh(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=Xh(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&&nm.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),sm.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function vy(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&&vy(t,e,a,s,n),n.push(t[a],t[a+1]),i-a>2&&vy(t,a,i,s,n))}function _y(t,e){const i=t.length-1,s=[t[0]];return vy(t,0,i,e,s),s.push(t[i]),s}fy=py([Oa(),my(0,Ra(qa)),my(0,Ia(Iv)),gy("design:paramtypes",[Object])],fy);let yy=!1;const by=new xa((t=>{yy||(yy=!0,t(ef).toSelf().inSingletonScope(),t(ev).to(ef).inSingletonScope(),t(nv).toService(ev),t($u).toService(Cm),Ja(t,$u))}));let xy=!1;const Sy=new xa((t=>{xy||(xy=!0,t(Ef).toSelf().inSingletonScope(),t(hv).to(Ef).inSingletonScope(),t(nv).toService(hv),t(Gm).toSelf(),t(Nm).toSelf(),t(ip).toService(Gm),t(ip).toService(Nm),t(ip).toService(Cm),Ja(t,ip))}));let Ay=!1;const ky=new xa((t=>{Ay||(Ay=!0,t(cf).toSelf().inSingletonScope(),t(y_).toSelf().inSingletonScope(),t(av).to(cf).inSingletonScope(),t(nv).toService(av))}));let My=!1;const Ty=new xa((t=>{My||(My=!0,t(yf).toSelf().inSingletonScope(),t(iv).to(yf).inSingletonScope(),t(nv).toService(iv),t(qu).toService(Cm),Ja(t,qu),t(x_).toSelf().inSingletonScope())}));let wy=!1;const Cy=new xa((t=>{wy||(wy=!0,t(Lf).toSelf().inSingletonScope(),t(cv).to(Lf).inSingletonScope(),t(nv).toService(cv),t(sp).toService(Cm),Ja(t,sp))}));let Ey=!1;const Py=new xa((t=>{Ey||(Ey=!0,t(af).toSelf().inSingletonScope(),t(sv).to(af).inSingletonScope(),t(nv).toService(sv),t(Zu).toService(Cm),Ja(t,Zu))}));let By=!1;const Ry=new xa((t=>{By||(By=!0,t(dv).to(zf).inSingletonScope(),t(nv).toService(dv),t(np).toService(Cm),Ja(t,np))}));let Ly=!1;const Oy=new xa((t=>{Ly||(Ly=!0,t(Mf).toSelf().inSingletonScope(),t(ov).to(Mf).inSingletonScope(),t(nv).toService(ov),t(tp).toService(Cm),Ja(t,tp))}));let Iy=!1;const Dy=new xa((t=>{Iy||(Iy=!0,t(lv).to(Xf).inSingletonScope(),t(nv).toService(lv),t(ep).toService(Cm),Ja(t,ep))}));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};let jy=class{constructor(){this.numberType=lu}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=Xh(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};jy=Fy([Oa()],jy);let zy=!1;const Hy=new xa((t=>{zy||(zy=!0,t(pv).to(jy).inSingletonScope(),t(nv).toService(pv))}));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},Ny=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Gy=class extends _m{constructor(){super(),this.numberType=mu,this.builtinContributions=[If],this.init()}drawShape(t,e,i,s,n){const r=Xh(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=zu(o,l,!0),d=zu(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=Xh(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(),zm(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=Xh(t).richtext;this._draw(t,s,!1,i)}};Gy=Vy([Oa(),Ny("design:paramtypes",[])],Gy);let Wy=!1;const Uy=new xa((t=>{Wy||(Wy=!0,t(uv).to(Gy).inSingletonScope(),t(nv).toService(uv))}));let Yy=!1;const Ky=new xa((t=>{Yy||(Yy=!0,t(gv).to(Qf).inSingletonScope(),t(nv).toService(gv),t(Qu).toService(Cm),Ja(t,Qu))}));const Xy=(t,e)=>(d(qy.warnHandler)&&qy.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),$y=(t,e,i)=>{if(!d(qy.errorHandler))throw new Error(t);qy.errorHandler.call(null,t,e)},qy={silent:!1,warnHandler:!1,errorHandler:!1},Zy=$_(),Jy=Zy&&globalThis?globalThis.document:void 0;function Qy(t){return("desktop-browser"===t||"mobile-browser"===t)&&Zy}function tb(t){return eb(t)||"mobile-browser"===t}function eb(t){return t.includes("miniApp")||"lynx"===t||"wx"===t}let ib=0;function sb(){return ib>=9999999&&(ib=0),ib++}function nb(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function rb(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const ab=(t,e,i)=>(t.fields=e||[],t.fname=i,t),ob=t=>e=>R(e,t),lb=t=>{at.getInstance().error(t)},hb=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||lb("Access path missing open bracket: "+t),o>0&&h(),o=0,s=n+1):n>s?h():s=n+1}return o&&lb("Access path missing closing bracket: "+t),a&&lb("Access path missing closing quote: "+t),n>s&&(n+=1,h()),e})(t),n=1===s.length?s[0]:t;return ab((i&&i.get||ob)(s),[n],e||n)},cb=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(y(t)){const s=t.map((t=>hb(t,e,i)));return t=>s.map((e=>e(t)))}return hb(t,e,i)};cb("id");const db=ab((function(t){return t}),[],"identity"),ub=ab((function(){return 0}),[],"zero");ab((function(){return 1}),[],"one"),ab((function(){return!0}),[],"true"),ab((function(){return!1}),[],"false"),ab((function(){return{}}),[],"emptyObject");const pb=(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=>gb(t,r,n)))))},mb=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t;function fb(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 vb(t,e,i,s,n){let r=0,a=0;return fb(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function _b(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;fb(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:vb(t,e,i,n,h)}}function yb(t){return"horizontal"===t}function bb(t){return"vertical"===t}const xb=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Sb extends Au{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,xb.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=>xb.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"},Zb=(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 Jb 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=ic.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=ic.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=Zb(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=ic.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=Zb(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=ic.now()-i>this.config.press.time&&Zb(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},tx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ex=[0,0,0];let ix=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({},gl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},fl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},vl),{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 sm.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&&(sm.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(sm.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&&Xu.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&&(Y_(ex,[t,e,i],this.modelMatrix),t=ex[0],e=ex[1],i=ex[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&&(Y_(ex,[t,e,i],this.modelMatrix),t=ex[0],e=ex[1],i=ex[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Y_(ex,[e,i,s],this.modelMatrix),e=ex[0],i=ex[1],s=ex[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]:Il.global.measureTextMethod;var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Il.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:vl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:vl.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&&(Y_(ex,[e,i,s],this.modelMatrix),e=ex[0],i=ex[1],s=ex[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=Sm(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=xm(this,l,this.dpr),r.strokeStyle=Sm(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=hp(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=hp(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=>sm.free(t))),this.stack.length=0}};ix.env="browser",ix=Qb([Oa(),tx("design:paramtypes",[Object,Number])],ix);var 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},nx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let rx=class extends oy{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Il.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new ix(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 ax(t,e){return new xa((i=>{i(Zl).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Jl).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}rx.env="browser",rx=sx([Oa(),nx("design:paramtypes",[Object])],rx);const ox=ax(rx,ix);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},hx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cx=function(t,e){return function(i,s){e(i,s,t)}};let dx=class extends fy{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=Eh.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 px=class{constructor(){this.type="group",this.numberType=hu}contains(t,e,i){return!1}};px=ux([Oa()],px);const gx=new xa(((t,e,i,s)=>{gx.__vloaded||(gx.__vloaded=!0,t(Kb).to(px).inSingletonScope(),t(Xb).toService(Kb),Ja(t,Xb))}));gx.__vloaded=!1;var mx=gx;const fx=new xa(((t,e,i,s)=>{i(dx)||t(dx).toSelf().inSingletonScope(),i(Rv)?s(Rv).toService(dx):t(Rv).toService(dx)}));var vx,_x=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let bx=vx=class extends uy{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${vx.idprefix}_${vx.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Il.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:vx.GenerateCanvasId(),canvasControled:!0};this.canvas=new rx(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 rx({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)}};bx.env="browser",bx.idprefix="visactor_window",bx.prefix_count=0,bx=vx=_x([Oa(),yx("design:paramtypes",[])],bx);const xx=new xa((t=>{t(bx).toSelf(),t(Lh).toDynamicValue((t=>t.container.get(bx))).whenTargetNamed(bx.env)}));var 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)};class kx{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 Mx(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 Tx=class extends hy{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 kx(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 Mx(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Mx(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}}};Tx=Sx([Oa(),Ax("design:paramtypes",[])],Tx);const wx=new xa((t=>{wx.isBrowserBound||(wx.isBrowserBound=!0,t(Tx).toSelf().inSingletonScope(),t(eo).toService(Tx))}));function Cx(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Cx.__loaded||(Cx.__loaded=!0,t.load(wx),t.load(ox),t.load(xx),e&&function(t){t.load(mx),t.load(fx)}(t))}wx.isBrowserBound=!1,Cx.__loaded=!1;var Ex=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Px=class extends ix{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}};Px.env="feishu",Px=Ex([Oa()],Px);var Bx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Rx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Lx=class extends oy{constructor(t){super(t)}init(){this._context=new Px(this,this._dpr)}release(){}};Lx.env="feishu",Lx=Bx([Oa(),Rx("design:paramtypes",[Object])],Lx);const Ox=ax(Lx,Px);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)},Fx=function(t,e){return function(i,s){e(i,s,t)}};class jx{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 zx=class extends uy{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new jx}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 Lx(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 Lx({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()}};zx.env="feishu",zx=Ix([Oa(),Fx(0,Ra(io)),Dx("design:paramtypes",[Object])],zx);const Hx=new xa((t=>{t(zx).toSelf(),t(Lh).toDynamicValue((t=>t.container.get(zx))).whenTargetNamed(zx.env)}));var Vx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Gx=function(t,e){return function(i,s){e(i,s,t)}};let Wx=class extends fy{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 sy(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}};Wx=Vx([Oa(),Gx(0,Ra(qa)),Gx(0,Ia(Ab)),Gx(1,Ra(qa)),Gx(1,Ia(Iv)),Nx("design:paramtypes",[Object,Object])],Wx);const Ux=new xa((t=>{Ux.__vloaded||(Ux.__vloaded=!0,Ja(t,Ab))}));Ux.__vloaded=!1;var Yx=Ux,Kx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$x=function(t,e){return function(i,s){e(i,s,t)}};let qx=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=nu}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=Xh(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}};qx=Kx([Oa(),$x(0,Ra(ev)),Xx("design:paramtypes",[Object])],qx);let Zx=!1;const Jx=new xa(((t,e,i,s)=>{Zx||(Zx=!0,t(kb).to(qx).inSingletonScope(),t(Ab).toService(kb))}));var Qx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},eS=function(t,e){return function(i,s){e(i,s,t)}};let iS=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=au}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=Xh(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}};iS=Qx([Oa(),eS(0,Ra(iv)),tS("design:paramtypes",[Object])],iS);let sS=!1;const nS=new xa(((t,e,i,s)=>{sS||(sS=!0,t(Mb).to(iS).inSingletonScope(),t(Ab).toService(Mb))}));var rS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oS=function(t,e){return function(i,s){e(i,s,t)}};let lS=class{constructor(t){this.canvasRenderer=t,this.type="circle",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=Xh(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}};lS=rS([Oa(),oS(0,Ra(sv)),aS("design:paramtypes",[Object])],lS);let hS=!1;const cS=new xa(((t,e,i,s)=>{hS||(hS=!0,t(Tb).to(lS).inSingletonScope(),t(Ab).toService(Tb))}));var dS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pS=function(t,e){return function(i,s){e(i,s,t)}};let gS=class{constructor(t){this.canvasRenderer=t,this.type="glyph",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=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}};gS=dS([Oa(),pS(0,Ra(pv)),uS("design:paramtypes",[Object])],gS);let mS=!1;const fS=new xa(((t,e,i,s)=>{mS||(mS=!0,t(Ob).to(gS).inSingletonScope(),t(gS).toService(Ob))}));var vS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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{constructor(){this.type="image",this.numberType=cu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};_S=vS([Oa()],_S);let yS=!1;const bS=new xa(((t,e,i,s)=>{yS||(yS=!0,t(wb).to(_S).inSingletonScope(),t(_S).toService(wb))}));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},SS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},AS=function(t,e){return function(i,s){e(i,s,t)}};let kS=class{constructor(t){this.canvasRenderer=t,this.type="line",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=Xh(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}};kS=xS([Oa(),AS(0,Ra(av)),SS("design:paramtypes",[Object])],kS);let MS=!1;const TS=new xa(((t,e,i,s)=>{MS||(MS=!0,t(Cb).to(kS).inSingletonScope(),t(Ab).toService(Cb))}));var wS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ES=function(t,e){return function(i,s){e(i,s,t)}};let PS=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=pu}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=Xh(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}};PS=wS([Oa(),ES(0,Ra(lv)),CS("design:paramtypes",[Object])],PS);let BS=!1;const RS=new xa(((t,e,i,s)=>{BS||(BS=!0,t(Lb).to(PS).inSingletonScope(),t(Ab).toService(Lb))}));var LS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},OS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IS=function(t,e){return function(i,s){e(i,s,t)}};let DS=class{constructor(t){this.canvasRenderer=t,this.type="path",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=Xh(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}};DS=LS([Oa(),IS(0,Ra(ov)),OS("design:paramtypes",[Object])],DS);let FS=!1;const jS=new xa(((t,e,i,s)=>{FS||(FS=!0,t(Eb).to(DS).inSingletonScope(),t(Ab).toService(Eb))}));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},HS=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)}};const NS=new Qt;let GS=class{constructor(t){this.canvasRenderer=t,this.type="rect",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=Xh(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;NS.setValue(i.x1,i.y1,i.x2,i.y2),NS.expand(-r/2),h=!NS.containsPoint(e)}}return s.highPerformanceRestore(),h}};GS=zS([Oa(),VS(0,Ra(hv)),HS("design:paramtypes",[Object])],GS);let WS=!1;const US=new xa(((t,e,i,s)=>{WS||(WS=!0,t(Pb).to(GS).inSingletonScope(),t(Ab).toService(Pb))}));let YS=!1;const KS=new xa(((t,e,i,s)=>{YS||(YS=!0,t(wb).to(_S).inSingletonScope(),t(_S).toService(wb))}));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},$S=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qS=function(t,e){return function(i,s){e(i,s,t)}};let ZS=class{constructor(t){this.canvasRenderer=t,this.type="symbol",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=Xh(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}};ZS=XS([Oa(),qS(0,Ra(cv)),$S("design:paramtypes",[Object])],ZS);let JS=!1;const QS=new xa(((t,e,i,s)=>{JS||(JS=!0,t(Bb).to(ZS).inSingletonScope(),t(Ab).toService(Bb))}));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};let eA=class{constructor(){this.type="text",this.numberType=vu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};eA=tA([Oa()],eA);let iA=!1;const sA=new xa(((t,e,i,s)=>{iA||(iA=!0,t(Rb).to(eA).inSingletonScope(),t(Ab).toService(Rb))})),nA=new xa(((t,e,i,s)=>{i(Wx)||t(Wx).toSelf().inSingletonScope(),i(Rv)?s(Rv).toService(Wx):t(Rv).toService(Wx)}));class rA{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 aA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let lA=class extends hy{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 rA(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 Dc.call(t)}}getCancelAnimationFrame(){return t=>{Dc.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}};lA=aA([Oa(),oA("design:paramtypes",[])],lA);const hA=new xa((t=>{hA.isFeishuBound||(hA.isFeishuBound=!0,t(lA).toSelf().inSingletonScope(),t(eo).toService(lA))}));function cA(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];cA.__loaded||(cA.__loaded=!0,t.load(hA),t.load(Ox),t.load(Hx),e&&function(t){t.load(Yx),t.load(nA),t.load(Jx),t.load(nS),t.load(cS),t.load(fS),t.load(bS),t.load(TS),t.load(RS),t.load(jS),t.load(US),t.load(KS),t.load(QS),t.load(sA)}(t))}hA.isFeishuBound=!1,cA.__loaded=!1;var dA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let pA=class extends ix{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(){}};pA.env="node",pA=dA([Oa(),uA("design:paramtypes",[Object,Number])],pA);var gA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let fA=class extends oy{constructor(t){super(t)}init(){this._context=new pA(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};fA.env="node",fA=gA([Oa(),mA("design:paramtypes",[Object])],fA);const vA=ax(fA,pA);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)},bA=function(t,e){return function(i,s){e(i,s,t)}};let xA=class extends uy{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 fA(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 fA({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){}};xA.env="node",xA=_A([Oa(),bA(0,Ra(io)),yA("design:paramtypes",[Object])],xA);const SA=new xa((t=>{t(xA).toSelf(),t(Lh).toDynamicValue((t=>t.container.get(xA))).whenTargetNamed(xA.env)}));var AA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 kA=class extends hy{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 Dc.call(t)}}getCancelAnimationFrame(){return t=>{Dc.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};kA=AA([Oa()],kA);const MA=new xa((t=>{MA.isNodeBound||(MA.isNodeBound=!0,t(kA).toSelf().inSingletonScope(),t(eo).toService(kA))}));function TA(t){TA.__loaded||(TA.__loaded=!0,t.load(MA),t.load(vA),t.load(SA))}MA.isNodeBound=!1,TA.__loaded=!1;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},CA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},EA=function(t,e){return function(i,s){e(i,s,t)}};let PA=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=nu}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=Xh(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=xm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};PA=wA([Oa(),EA(0,Ra(ev)),CA("design:paramtypes",[Object])],PA);let BA=!1;const RA=new xa(((t,e,i,s)=>{BA||(BA=!0,t(Ib).to(PA).inSingletonScope(),t(Xb).toService(Ib))}));var LA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},OA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IA=function(t,e){return function(i,s){e(i,s,t)}};const DA=new Qt;let FA=class{constructor(t){this.canvasRenderer=t,this.type="rect",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=Xh(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=xm(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;DA.setValue(i.x1,i.y1,i.x2,i.y2),DA.expand(-r/2),h=!DA.containsPoint(e)}}return s.highPerformanceRestore(),h}};FA=LA([Oa(),IA(0,Ra(hv)),OA("design:paramtypes",[Object])],FA);let jA=!1;const zA=new xa(((t,e,i,s)=>{jA||(jA=!0,t(Vb).to(FA).inSingletonScope(),t(Xb).toService(Vb))}));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 VA=class extends _m{};VA=HA([Oa()],VA);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},GA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},WA=function(t,e){return function(i,s){e(i,s,t)}};let UA=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="line",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;s.highPerformanceSave();const n=Xh(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=xm(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&nm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};UA=NA([Oa(),WA(0,Ra(av)),GA("design:paramtypes",[Object])],UA);let YA=!1;const KA=new xa(((t,e,i,s)=>{YA||(YA=!0,t(zb).to(UA).inSingletonScope(),t(Xb).toService(zb))}));var XA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},qA=function(t,e){return function(i,s){e(i,s,t)}};let ZA=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=au}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=Xh(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=xm(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h})),s.highPerformanceRestore(),h}};ZA=XA([Oa(),qA(0,Ra(iv)),$A("design:paramtypes",[Object])],ZA);let JA=!1;const QA=new xa(((t,e,i,s)=>{JA||(JA=!0,t(Db).to(ZA).inSingletonScope(),t(Xb).toService(Db))}));var tk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ik=function(t,e){return function(i,s){e(i,s,t)}};let sk=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=fu}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=Xh(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=xm(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&nm.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};sk=tk([Oa(),ik(0,Ra(cv)),ek("design:paramtypes",[Object])],sk);let nk=!1;const rk=new xa(((t,e,i,s)=>{nk||(nk=!0,t(Nb).to(sk).inSingletonScope(),t(Xb).toService(Nb))}));var ak=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ok=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lk=function(t,e){return function(i,s){e(i,s,t)}};let hk=class{constructor(t){this.canvasRenderer=t,this.type="circle",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=Xh(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=xm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};hk=ak([Oa(),lk(0,Ra(sv)),ok("design:paramtypes",[Object])],hk);let ck=!1;const dk=new xa(((t,e,i,s)=>{ck||(ck=!0,t(Fb).to(hk).inSingletonScope(),t(Xb).toService(Fb))}));var uk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gk=function(t,e){return function(i,s){e(i,s,t)}};let mk=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=vu}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=Xh(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=dp(a,u,n),v=cp(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&&nm.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};mk=uk([Oa(),gk(0,Ra(dv)),pk("design:paramtypes",[Object])],mk);let fk=!1;const vk=new xa(((t,e,i,s)=>{fk||(fk=!0,t(Gb).to(mk).inSingletonScope(),t(Xb).toService(Gb))}));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},yk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bk=function(t,e){return function(i,s){e(i,s,t)}};let xk=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="path",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=Xh(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=xm(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&nm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};xk=_k([Oa(),bk(0,Ra(ov)),yk("design:paramtypes",[Object])],xk);let Sk=!1;const Ak=new xa(((t,e,i,s)=>{Sk||(Sk=!0,t(Hb).to(xk).inSingletonScope(),t(Xb).toService(Hb))}));var kk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mk=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 wk=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=pu}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=Xh(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=xm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};wk=kk([Oa(),Tk(0,Ra(lv)),Mk("design:paramtypes",[Object])],wk);let Ck=!1;const Ek=new xa(((t,e,i,s)=>{Ck||(Ck=!0,t(Wb).to(wk).inSingletonScope(),t(Xb).toService(Wb))}));var Pk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rk=function(t,e){return function(i,s){e(i,s,t)}};let Lk=class{constructor(t){this.canvasRenderer=t,this.type="glyph",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=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}};Lk=Pk([Oa(),Rk(0,Ra(pv)),Bk("design:paramtypes",[Object])],Lk);let Ok=!1;const Ik=new xa(((t,e,i,s)=>{Ok||(Ok=!0,t(Yb).to(Lk).inSingletonScope(),t(Xb).toService(Yb))}));var Dk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Fk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jk=function(t,e){return function(i,s){e(i,s,t)}};let zk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=mu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};zk=Dk([Oa(),jk(0,Ra(uv)),Fk("design:paramtypes",[Object])],zk);let Hk=!1;const Vk=new xa(((t,e,i,s)=>{Hk||(Hk=!0,t(Ub).to(zk).inSingletonScope(),t(Xb).toService(Ub))}));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};let Gk=class{constructor(){this.type="image",this.numberType=cu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Gk=Nk([Oa()],Gk);let Wk=!1;const Uk=new xa(((t,e,i,s)=>{Wk||(Wk=!0,t(jb).to(Gk).inSingletonScope(),t(Xb).toService(jb))})),Yk=$_();function Kk(){Kk.__loaded||(Kk.__loaded=!0,pm.RegisterGraphicCreator("arc",Xg),ql.load(by),ql.load(Yk?RA:Jx))}Kk.__loaded=!1;const Xk=Kk;function $k(){$k.__loaded||($k.__loaded=!0,pm.RegisterGraphicCreator("area",Ug),ql.load(Ty),ql.load(Yk?QA:nS))}$k.__loaded=!1;const qk=$k;function Zk(){Zk.__loaded||(Zk.__loaded=!0,pm.RegisterGraphicCreator("circle",lp),ql.load(Py),ql.load(Yk?dk:cS))}Zk.__loaded=!1;const Jk=Zk;function Qk(){Qk.__loaded||(Qk.__loaded=!0,pm.RegisterGraphicCreator("glyph",Cg),ql.load(Hy),ql.load(Yk?Ik:fS))}Qk.__loaded=!1;const tM=Qk;function eM(){eM.__loaded||(eM.__loaded=!0,pm.RegisterGraphicCreator("group",ku))}eM.__loaded=!1;const iM=eM;function sM(){sM.__loaded||(sM.__loaded=!0,pm.RegisterGraphicCreator("image",Lg),ql.load(Ky),ql.load(Yk?Uk:bS))}sM.__loaded=!1;const nM=sM;function rM(){rM.__loaded||(rM.__loaded=!0,pm.RegisterGraphicCreator("line",Ag),ql.load(ky),ql.load(Yk?KA:TS))}rM.__loaded=!1;const aM=rM;function oM(){oM.__loaded||(oM.__loaded=!0,pm.RegisterGraphicCreator("path",Ng),ql.load(Oy),ql.load(Yk?Ak:jS))}oM.__loaded=!1;const lM=oM;function hM(){hM.__loaded||(hM.__loaded=!0,pm.RegisterGraphicCreator("polygon",Zg),ql.load(Dy),ql.load(Yk?Ek:RS))}hM.__loaded=!1;const cM=hM;function dM(){dM.__loaded||(dM.__loaded=!0,pm.RegisterGraphicCreator("rect",Tg),ql.load(Sy),ql.load(Yk?zA:US))}dM.__loaded=!1;const uM=dM;function pM(){pM.__loaded||(pM.__loaded=!0,pm.RegisterGraphicCreator("richtext",zg),ql.load(Uy),ql.load(Yk?Vk:KS))}pM.__loaded=!1;const gM=pM;function mM(){mM.__loaded||(mM.__loaded=!0,pm.RegisterGraphicCreator("shadowRoot",Qg))}mM.__loaded=!1;const fM=mM;function vM(){vM.__loaded||(vM.__loaded=!0,pm.RegisterGraphicCreator("symbol",bg),ql.load(Cy),ql.load(Yk?rk:QS))}vM.__loaded=!1;const _M=vM;function yM(){yM.__loaded||(yM.__loaded=!0,pm.RegisterGraphicCreator("text",mp),ql.load(Ry),ql.load(Yk?vk:sA))}yM.__loaded=!1;const bM=yM;function xM(){iM(),uM()}const SM=-.5*Math.PI,AM=1.5*Math.PI,kM="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 MM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(MM||(MM={}));const TM={[MM.selectedReverse]:{},[MM.selected]:{},[MM.hover]:{},[MM.hoverReverse]:{}},wM={container:"",width:30,height:30,style:{}},CM={debounce:xt,throttle:St};xM();let EM=class t extends Sb{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"===P_.env?(P_.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),P_.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:CM[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"===P_.env?(P_.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),P_.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",CM[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 PM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&PM(t,e)}))}EM.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 BM=t=>!u(t)&&!1!==t.visible;function RM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function LM(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 IM=["#ffffff","#000000"];function DM(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 FM(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(...IM);for(const n of a)if(t!==n&&FM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function FM(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?jM(t,e)>s:"largeText"===i?jM(t,e)>3:jM(t,e)>4.5}function jM(t,e){const i=zM(t),s=zM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function zM(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 HM(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 VM(t,e){return[t[0]*e,t[1]*e]}function NM(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 GM=(t,e,i,s)=>new Qe(Object.assign({defaultFontParams:Object.assign({fontFamily:kM,fontSize:14},s),getTextBounds:i?void 0:fm,specialCharSet:"-/: .,@%'\"~"+Qe.ALPHABET_CHAR_SET+Qe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function WM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const s=fm({text:t,fontFamily:e.fontFamily||i.fontFamily||kM,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 UM(t){return"rich"===YM(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type")}function YM(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 KM(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 XM(t){const e=YM(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?pm.richtext(KM(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)),pm.text(t))}function $M(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 ZM(){iM(),uM(),_M(),gM(),bM()}var JM=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);nh&&(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,V=JM(a,["visible"]);if(m&&c(H)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},V),{visible:H&&!!s,x:I,y:D,width:k,height:M}),"rect");B(null==f?void 0:f.panel)||(t.states=f.panel),this._bgRect=t}}this._textShape=P}}QM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const tT={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}},eT={poptip:z({},tT)};var iT=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]]}}}}nT.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 rT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 aT=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,nT.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new nT(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,eT.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}))}};aT=rT([Oa()],aT);var oT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 lT=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)}};lT=oT([Oa()],lT);let hT=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)}};hT=oT([Oa()],hT);const cT=new xa(((t,e,i,s)=>{i(aT)||(t(aT).toSelf().inSingletonScope(),t(rp).toService(aT)),i(lT)||(t(lT).toSelf(),t(Vv).toService(lT)),i(hT)||(t(hT).toSelf(),t(Vv).toService(hT))}));class dT extends Sb{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}iM(),aM();class uT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},uT.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})}}uT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},iM(),uM();class pT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},pT.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})}}pT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},iM(),Xk();class gT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},gT.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)}}gT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},iM(),Xk();class mT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},mT.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=SM,endAngle:s=AM}=this.attribute,n=s-i,r=ee(ne(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}mT.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},iM(),lM();class fT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fT.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)}}fT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const vT=new Uint32Array(33),_T=new Uint32Array(33);_T[0]=0,vT[0]=~_T[0];for(let t=1;t<=32;++t)_T[t]=_T[t-1]<<1|1,vT[t]=~_T[t];function yT(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]&vT[31&l]&_T[1+(31&h)])return!0}else{if(i[c]&vT[31&l])return!0;if(i[d]&_T[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,vT[31&n]&_T[1+(31&r)]);else for(s(a,vT[31&n]),s(o,_T[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,_T[31&i]|vT[1+(31&s)]);else for(n(r,_T[31&i]),n(a,vT[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 bT(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 xT(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=bT(t,r),!(s&&e.outOfBounds(r)||e.getRange(r))}function ST(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 ST(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 ST(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 ST(t,e,n,s,h,c)}return!1}const kT=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],MT=["top","inside-top","inside"];function TT(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 wT={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 CT(t,e){var i,s;return null!==(s=null===(i=wT[e])||void 0===i?void 0:i.call(wT,t))&&void 0!==s?s:{from:{},to:{}}}const ET=(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 PT(t,e,i,s){t.attribute.text!==e.attribute.text&&k(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new jc({text:t.attribute.text},{text:e.attribute.text},i,s))}const BT={mode:"same-time",duration:300,easing:"linear"};function RT(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 LT(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 OT(t){return 3===t||4===t}function IT(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 DT=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)}},FT=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 jT(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 zT(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)}}iM(),bM(),gM(),aM();class HT extends Sb{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},HT.defaultAttributes,t)),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(MM.hover,!0),PM(this,(t=>{t===e||B(t.states)||t.addState(MM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(PM(this,(t=>{B(t.states)||(t.removeState(MM.hoverReverse),t.removeState(MM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void PM(this,(t=>{B(t.states)||(t.removeState(MM.selectedReverse),t.removeState(MM.selected))}));B(e.states)||(e.addState(MM.selected,!0),PM(this,(t=>{t===e||B(t.states)||t.addState(MM.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:[];(this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)]).forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(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[zT(g,m,c,d,a,o),zT(-g,-m,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds);if(i){const t=pm.line({points:i});return e&&e.attribute.fill&&t.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&t.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(t),t}}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)),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 XM(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&&y.setRange(bT(v,t.AABBBounds,!0))}))),m.length>0&&m.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&&y.setRange(bT(v,t.AABBBounds,!0))})):t.AABBBounds&&y.setRange(bT(v,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 i=new Map,s=this._graphicToText||new Map,n=[],r=[],{visible:a}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{const o=this.getRelatedGraphic(t.attribute),l=t.attribute.id,h=this._isCollectionBase?l:o,c=(null==s?void 0:s.get(h))?"update":"enter";let d;if(a&&(d=this._createLabelLine(t,o)),"enter"===c){if(n.push(t),i.set(h,d?{text:t,labelLine:d}:{text:t}),o){const{from:i,to:s}=CT(t.attribute,"fadeIn");this.add(t),d&&(r.push(d),this.add(d)),this._syncStateWithRelatedGraphic(o),this._animationConfig.enter.duration>0&&o.once("animate-bind",(a=>{t.setAttributes(i),d&&d.setAttributes(i);const l=this._afterRelatedGraphicAttributeUpdate(t,n,d,r,e,o,s,this._animationConfig.enter);o.on("afterAttributeUpdate",l)}))}}else if("update"===c){const e=s.get(h);s.delete(h),i.set(h,e);const n=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&&PT(t,e,s,n))}i.forEach(((i,s)=>{const{duration:n,easing:r,increaseEffect:a=!0,channel:o}=i,{from:l,to:h}=ET(t,e,o,i.options);B(h)||t.animate().to(h,n,r),"text"in l&&"text"in h&&a&&PT(t,e,n,r)}))})(n,t,this._animationConfig.update),e.labelLine&&d&&e.labelLine.animate().to(d.attribute,r,a)}})),s.forEach((t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(CT(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=i}_renderWithOutAnimation(t){var e;const i=new Map,s=this._graphicToText||new Map,{visible:n}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach((t=>{const e=this.getRelatedGraphic(t.attribute),r=(null==s?void 0:s.get(e))?"update":"enter",a=this._isCollectionBase?t.attribute.id:e;let o;if(n&&(o=this._createLabelLine(t,e)),"enter"===r)i.set(a,o?{text:t,labelLine:o}:{text:t}),this.add(t),o&&this.add(o),this._syncStateWithRelatedGraphic(e);else if("update"===r){const e=s.get(a);s.delete(a),i.set(a,e),e.text.setAttributes(t.attribute),e.labelLine&&o&&e.labelLine.setAttributes(o.attribute)}})),s.forEach((t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)})),this._graphicToText=i}_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)}}VT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};class NT extends HT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},NT.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}}}NT.tag="rect-label",NT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};let GT=class t extends HT{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 jT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};GT.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class WT{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 UT extends HT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UT.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:"…"}),n=this._createLabelText(s),r=this.getGraphicBounds(n),a=r.x2-r.x1,o=e.map((t=>t.attribute)),l=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),o,i,a);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=LT(l.endAngle-d/2),p=RT(h.x,h.y,l.outerRadius,o),g=RT(h.x,h.y,a+e.line.line1MinLength,o),m=new WT(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);m.pointA=RT(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):OT(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=RT(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=OT(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=OT(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=OT(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?OT(t.quadrant)?"left":"right":OT(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*(OT(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;e1&&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 jT(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 extends HT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},KT.defaultAttributes,t)),this.name="line-data-label"}labeling(t,e){return DT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}KT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const XT={rect:NT,symbol:VT,arc:UT,line:GT,area:YT,"line-data":KT};class $T extends Sb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},$T.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=yT(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(){iM(),aM(),cM(),_M()}function ZT(){iM(),aM(),Xk(),_M()}$T.defaultAttributes={pickable:!1},qT();class JT extends Sb{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({},JT.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=pm.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=pm.line;Y(i)[0].cornerRadius&&(t=pm.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=pm.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}}JT.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}}},ZT();class QT extends JT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JT.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=pm.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 tw,ew;!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"}(tw||(tw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(ew||(ew={}));const iw={[ew.selectedReverse]:{},[ew.selected]:{},[ew.hover]:{},[ew.hoverReverse]:{}},sw={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}}},nw=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 rw(t,e,i){return!mt(t,e,0,1e-6)&&!gt(t,i,0,1e-6)}function aw(t,e,i,s){const n=fm(Object.assign({text:i},s)),r=n.width(),a=n.height(),o=nw(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=rw(o,-l,-h)?((o+l)/c-.5)*r:rw(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=rw(o,-l,-h)?.5*-a:rw(o,h,l)?.5*a:Math.cos(o)>=0?(.5-(h-o)/c)*a:(.5-nw(o-l)/c)*a,{x:p,y:g-m}}function ow(t){const e={};return PM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function lw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function hw(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 VM(r,(s?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}const cw=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!B(s.states)?(s.addState(MM.hover,!0),PM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(MM.hoverReverse,!0)})),s):i},dw=(t,e,i)=>i?(PM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(MM.hoverReverse),t.removeState(MM.hover))})),null):i,uw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(MM.selected)?(PM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(MM.selectedReverse),t.removeState(MM.selected))})),null):s.name&&!B(s.states)?(s.addState(MM.selected,!0),PM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(MM.selectedReverse,!0)})),s):i};class pw extends Sb{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=cw(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=dw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=uw(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=pm.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&&ow(this._innerView),this.removeAllChild(!0),this._innerView=pm.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=pm.group({x:0,y:0,zIndex:1});if(a.name=tw.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=pm.group({x:0,y:0,pickable:!1});t.name=tw.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=pm.group({x:0,y:0,pickable:!1});i.name=tw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=pm.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=tw.tick,r.id=this._getNodeId(t.id),B(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=TM;else{const t=this.data[s],e=z({},TM,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=pm.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=tw.subTick,r.id=this._getNodeId(`${n}`),B(s.state))r.states=TM;else{const i=z({},TM,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=pm.group({x:0,y:0,pickable:!1});return r.name=`${tw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=XM(this._getLabelAttribute(t,e,n,i));if(a.name=tw.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=TM;else{const s=z({},TM,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 QM(Object.assign({},e));i.name=tw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return lw(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({},sw.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 gw(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 mw(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 fw={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&&vw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function vw(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 _w(t,e){for(let i,s=1,n=t.length,r=t[0];s1&&e.height()>1}function bw(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Aw(t,e.attribute.angle)),{angle:Sw(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({},kw(t,e.attribute.angle)),{angle:Sw(e.attribute.angle)}))}))}(t,e),gw(e)}function Sw(){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 Aw(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=Sw(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 kw(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=Sw(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 Mw{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 VM([s[1],-1*s[0]],t*(e?1:-1)*i)}}function Tw(){iM(),aM(),gM(),bM()}var ww=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=NM(_,[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({},iw,c.text),shape:z({},iw,c.shape),panel:z({},iw,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 Aw(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return kw(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)})),xw(i,t),!bw(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(yw);if(B(i))return;let s;s=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i),gw(s);const{method:n="parity",separation:r=0}=e,a=d(n)?n:fw[n]||fw.parity;if(s.length>=3&&_w(s,r)){do{s=a(s,r)}while(s.length>=3&&_w(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&&vw(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=pm.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=tw.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=WM(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}}Cw.defaultAttributes=sw,U(Cw,Mw);class Ew{isInValidValue(t){const{startAngle:e=SM,endAngle:i=AM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=SM,endAngle:i=AM,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 hw(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 Pw,Bw=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=pm.circle(c);d.name=tw.line,d.id=this._getNodeId("line"),B(a.state)||(d.states=z({},iw,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=Bw(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({},iw,d.text),shape:z({},iw,d.shape),panel:z({},iw,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 aw(t,e,i,s)}}Rw.defaultAttributes=sw,U(Rw,Ew);class Lw extends mc{constructor(){super(...arguments),this.mode=ko.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},PM(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{Iw[t]=!0}));const Hw=t=>-Math.log(-t),Vw=t=>-Math.exp(-t),Nw=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,Gw=t=>10===t?Nw:t===Math.E?Math.exp:e=>Math.pow(t,e),Ww=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Uw=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),Yw=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function Kw(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 Xw(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function $w(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),$w(t,i,s)*(e/(1-i))}function Zw(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function Jw(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 eC{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=Zw(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 iC=Symbol("implicit");class sC extends eC{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=Pw.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=iC}clone(){const t=(new sC).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!==iC)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 rC extends sC{constructor(t){super(),this.type=Pw.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:nC(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 nC(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 rC(!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:aC}=xe;function oC(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=aC(_e.parseColorString(t),s);return t=>e(t).formatRgb()}return At(Number(t),Number(e))}return e instanceof ye?aC(t,e):e instanceof _e?aC(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 lC extends eC{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:zw,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zw;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=zw,this._piecewise=Xw,this._interpolate=oC}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?Jw:Xw,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:zw),this.rescale(i)):this._clamp!==zw}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 hC=Math.sqrt(50),cC=Math.sqrt(10),dC=Math.sqrt(2),uC=[1,2,5,10],pC=(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=vC(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?mC(0,-(e-1)/s,s):mC((e-1)/s,0,s)},gC=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 pC(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return pC(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=mC(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=mC(t,e,l);return n&&r.reverse(),r})),vC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=uC[0];return i>=hC?s=uC[3]:i>=cC?s=uC[2]:i>=dC&&(s=uC[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function _C(t,e,i){const s=(e-t)/Math.max(0,i);return vC(s)}function yC(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=_C(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 xC(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 SC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),AC=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})),kC=ft(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=fC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?SC(t,e,n):SC(t,e,tC(n)),h=SC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),MC=ft(((t,e,i,s,n)=>yC(s(t),s(e),i).map((t=>tC(n(t))))));class TC extends lC{constructor(){super(...arguments),this.type=Pw.Linear}clone(){return(new TC).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 gC(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=fC(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 yC(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=xC(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=bC(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=bC(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=bC(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function wC(t){return e=>-t(-e)}function CC(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class EC extends lC{constructor(){super(Ww(10),Gw(10)),this.type=Pw.Log,this._limit=CC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new EC).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=Ww(this._base),s=Gw(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=wC(i),this._pows=wC(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=Hw,this.untransformer=Vw):(this._logs=i,this._pows=s,this._limit=CC(),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 zw}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 AC(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 kC(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 MC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return MC(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=xC(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=Qw(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 PC extends TC{constructor(){super(Uw(1),Yw(1)),this.type=Pw.Symlog,this._const=1}clone(){return(new PC).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=Uw(t),this.untransformer=Yw(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 AC(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 kC(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 MC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return MC(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=xC(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=Qw(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 BC{constructor(){this.type=Pw.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 BC).domain(this._domain).range(this._range).unknown(this._unknown)}}const RC=t=>t.map(((t,e)=>({index:e,value:t}))),LC=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 OC(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function IC(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=GM(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=DC(S,y,m[0],m[m.length-1]):a&&c&&s===e.length-1?T=DC(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=DC(A,b,m[0],m[m.length-1]):a&&d&&s===e.length-1?w=DC(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},jC=(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=GM(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=lw(o,hw(s,o,e,n));return aw(l,hw(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},zC={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&OC(i.AABBBounds,t.AABBBounds,e)||(i=t,0))))}},HC=(t,e,i,s)=>FC(t,e,i).map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),VC=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},NC=(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&&!VC(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?NC(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&&LC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},UC=(t,e)=>{if(Dw(t.type))return((t,e)=>{if(!Dw(t.type))return RC(t.domain());const i=t.range(),s=Math.abs(i[i.length-1]-i[0]);if(s<2)return RC([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=FC(t,h,e).map(((t,e)=>({AABBBounds:t,value:h[e]})));for(;n.length>=3&&IC(n,i);)n=zC.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 RC(h)})(t,e);if(jw(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?RC([s[s.length-1]]):RC([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=HC(t,s,e,c),l=Math.min(...n.map((t=>t[2]))),h=GC(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=HC(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 RC(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=jC(t,i,e),r=$(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=WC(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 RC(c)})(t,e)}return RC(t.domain())};function YC(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 KC(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 XC(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=YC(t,!!n),o=YC(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=KC(e,t,!1,!!n),o=KC(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=YC(t,!!n),o=YC(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class $C extends Sb{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&ow(this._innerView),this.removeAllChild(!0),this._innerView=pm.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 lw(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?`${tw.grid}-sub`:`${tw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=YC(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=KC(t,o,!1,!!a)}const u=pm.path(Object.assign({path:c,z:l},d(r)?z({},this.skipDefault?null:$C.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=YC(o,!!a),f=Lt(o[0].x-o[1].x),v=Lt(o[0].y-o[1].y),_=pm.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:$C.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,Mw);var ZC=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(JC,Ew);const QC="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",tE={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:QC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:QC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},eE={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 iE;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(iE||(iE={}));var sE=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=iE.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=iE.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=iE.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=iE.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=iE.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t),"browser"===P_.env&&(P_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),P_.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===iE.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===iE.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=iE.endHandler):h+=l:this._activeTag===iE.endHandler&&(c+l{t.preventDefault();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===iE.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"===P_.env&&(P_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),P_.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===iE.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===iE.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=sE(i,["formatMethod"]),{formatMethod:a}=s,o=sE(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:V={},brushSelect:N,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=V.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:N?"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),N&&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:N?"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:N?"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"},eE.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=V.symbolType)&&void 0!==y?y:"square"},eE.horizontal),V),{pickable:!G&&(null===(b=V.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},eE.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},eE.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"},eE.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=V.symbolType)&&void 0!==R?R:"square"},eE.vertical),V),{pickable:!G&&(null===(L=V.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},eE.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},eE.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 _y(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 QM(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 aE,oE,lE,hE;function cE(){iM(),ZM()}function dE(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 uE(t,e){const{dx:i,dy:s}=dE(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}rE.defaultAttributes=tE,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"}(aE||(aE={})),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"}(oE||(oE={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(lE||(lE={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(hE||(hE={}));class pE extends Sb{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=cw(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=dw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=uw(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=pm.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=pm.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=pm.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 gE(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 mE(t,e,i,s){t&&(gE(t.startSymbol,e,i,s),t.lines.forEach((t=>gE(t,e,i,s))),gE(t.line,e,i,s),gE(t.endSymbol,e,i,s))}function fE(t,e,i,s){t&&(gE(t.getTextShape(),e,i,s),gE(t.getBgRect(),e,i,s))}function vE(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 _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,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;gE(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)})),gE(t.endSymbol,s+r+a,o,n),gE(e.getTextShape(),s+r+a+o,l,n),gE(e.getBgRect(),s+r+a+o,l,n)}function xE(t,e,i,s,n){mE(t,s,i,n),fE(e,s,i,n)}function SE(t,e,i,s,n){gE(t,s,i,n),fE(e,s,i,n)}function AE(t,e,i,s,n){gE(t,s,i,n),fE(e,s,i,n)}function kE(t,e,i,s,n,r){var a;mE(t,n,s,r),gE(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?fE(i,n,s,r):gE(i,n,s,r)}function ME(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;gE(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)})),gE(e,n+o+l,h,r),gE(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(gE(i.getTextShape(),n+o+l+h+c,d,r),gE(i.getBgRect(),n+o+l+c,d,r)):gE(i,n+o+l+c,d,r)}function TE(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?bE(t,e,s,r,a):"fadeIn"===i&&xE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?bE(t,e,s,n,a):"fadeIn"===i&&xE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){_E(t,s,i,n),yE(e,s,i,n)}(t,e,i,s,n)}}function wE(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&&SE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&SE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){vE(t,s,i,n),yE(e,s,i,n)}(t,e,i,s,n)}}function CE(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&&AE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&AE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){vE(t,s,i,n),yE(e,s,i,n)}(t,e,i,s,n)}}function EE(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?kE(n,r,e,i,s,o):"callIn"===t&&ME(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?kE(n,r,e,i,s,a):"callIn"===t&&ME(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;_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)}(n,r,e,t,i,s)}}const PE={type:"clipIn",duration:500,easing:"linear",delay:0},BE={type:"fadeIn",duration:500,easing:"linear",delay:0},RE={type:"callIn",duration:500,easing:"linear",delay:0},LE={type:"fadeOut",duration:500,easing:"linear",delay:0};class OE extends pE{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=PE,this.defaultExitAnimation=LE}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;uE(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 QM(Object.assign(Object.assign({},e),{state:{panel:z({},TM,null==i?void 0:i.labelBackground),text:z({},TM,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({},TM,null==e?void 0:e.labelBackground),text:z({},TM,null==e?void 0:e.label)}})),this.setLabelPos())}}const IE=.001,DE={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:aE.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]}},FE={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"}}},jE={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:lE.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]}},zE={interactive:!0,label:{position:oE.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}},HE={interactive:!0,label:{position:lE.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}},VE={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"}},NE={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"}},GE={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 WE(){UE._animate=TE}cE(),qT();class UE extends OE{markerAnimate(t){UE._animate&&this._animationConfig&&UE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UE.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(RM(t)?t:t-Math.PI)+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}getTextStyle(t,e,i){return LM(Math.abs(e),Math.PI/2,IE)||LM(Math.abs(e),3*Math.PI/2,IE)?OM(i,e,t):RM(e)?FE.postiveXAxis[t]:FE.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new JT({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},TM,null==a?void 0:a.line),startSymbol:z({},TM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},TM,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({},TM,null==a?void 0:a.line),startSymbol:z({},TM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},TM,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 YE(){KE._animate=wE}UE.defaultAttributes=DE,cE(),cM();class KE extends pE{markerAnimate(t){KE._animate&&this._animationConfig&&KE._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({},KE.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=BE,this.defaultExitAnimation=LE}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({},NE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;uE(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=pm.polygon(Object.assign({points:e},s));r.states=z({},TM,null==n?void 0:n.area),r.name="mark-area-polygon",this._area=r,t.add(r);const a=new QM(Object.assign(Object.assign({},i),{state:{panel:z({},TM,null==n?void 0:n.labelBackground),text:z({},TM,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({},TM,null==s?void 0:s.area)),this._label&&this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},e),{state:{panel:z({},TM,null==s?void 0:s.labelBackground),text:z({},TM,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}}KE.defaultAttributes=zE,cE(),ZT();class XE extends OE{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,{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 lE.arcInnerStart:l=s;case lE.arcOuterStart:l=s;break;case lE.arcInnerEnd:l=n;case lE.arcOuterEnd:l=n;break;case lE.center:case lE.arcInnerMiddle:case lE.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 VE[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 QT({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},TM,null==o?void 0:o.line),startSymbol:z({},TM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},TM,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({},TM,null==o?void 0:o.line),startSymbol:z({},TM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},TM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}}XE.defaultAttributes=jE,cE(),Xk();class $E extends pE{markerAnimate(t){$E._animate&&this._animationConfig&&$E._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({},$E.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcArea",this.defaultUpdateAnimation=BE,this.defaultExitAnimation=LE}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 lE.center:h=(i+s)/2,c=(n+r)/2;break;case lE.arcInnerStart:h=i,c=n;break;case lE.arcOuterStart:h=s,c=n;break;case lE.arcInnerEnd:h=i,c=r;break;case lE.arcOuterEnd:h=s,c=r;break;case lE.arcInnerMiddle:h=i,c=(n+r)/2;break;case lE.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({},VE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;uE(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=pm.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));h.states=z({},TM,null==l?void 0:l.area),h.name="polar-mark-area-area",this._area=h,t.add(h);const c=new QM(Object.assign(Object.assign({},o),{state:{panel:z({},TM,null==l?void 0:l.labelBackground),text:z({},TM,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({},TM,null==o?void 0:o.area)),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},a),{state:{panel:z({},TM,null==o?void 0:o.labelBackground),text:z({},TM,null==o?void 0:o.label)}})),this.setLabelPos())}isValidPoints(){return!0}}function qE(){ZE._animate=EE}$E.defaultAttributes=HE,cE(),qT(),ZT(),_M(),nM(),aM();class ZE extends pE{markerAnimate(t){ZE._animate&&this._animationConfig&&ZE._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ZE.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=RE,this.defaultExitAnimation=LE,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return LM(Math.abs(s),Math.PI/2,IE)||LM(Math.abs(s),3*Math.PI/2,IE)?OM(t,s,n):RM(s)?GE.postiveXAxis[n]:GE.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=hE.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({},TM,null==m?void 0:m.textBackground),text:z({},TM,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({},TM,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({},TM,null==m?void 0:m.image));const y=RM(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=pm.symbol(Object.assign(Object.assign({},i),r)),h.states=z({},TM,null==s?void 0:s.symbol)):"text"===n?h=new QM(Object.assign(Object.assign({},i),{state:{panel:z({},TM,null==s?void 0:s.textBackground),text:z({},TM,null==s?void 0:s.text)}})):"richText"===n?(h=pm.richtext(Object.assign(Object.assign({},i),a)),h.states=z({},TM,null==s?void 0:s.richText)):"image"===n?(h=pm.image(Object.assign(Object.assign({},i),o)),h.states=z({},TM,null==s?void 0:s.image)):"custom"===n&&l&&(h=l(),h.states=z({},TM,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=LM(c,0,IE)||LM(d,0,IE),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(aP.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(aP.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===aP.focus||"focus"===o){const s=a.hasState(nP.focus);a.toggleState(nP.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[nP.unSelected,nP.unSelectedHover,nP.focus],t),this._setLegendItemState(e,nP.selected,t)})):(this._setLegendItemState(a,nP.selected,t),this._removeLegendItemState(a,[nP.unSelected,nP.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[nP.selected,nP.selectedHover,nP.focus],t),this._setLegendItemState(e,nP.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(nP.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(nP.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(rP.legendItemClick,a,t);i?(this._removeLegendItemState(a,[nP.selected,nP.selectedHover],t),this._setLegendItemState(a,nP.unSelected,t)):(this._setLegendItemState(a,nP.selected,t),this._removeLegendItemState(a,[nP.unSelected,nP.unSelectedHover],t))}else this._setLegendItemState(a,nP.selected,t),this._removeLegendItemState(a,[nP.unSelected,nP.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[nP.selected,nP.selectedHover],t),this._setLegendItemState(e,nP.unSelected,t))}))}this._dispatchLegendEvent(rP.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,nP.selected),this._removeLegendItemState(e,[nP.unSelected,nP.unSelectedHover])):(this._removeLegendItemState(e,[nP.selected,nP.selectedHover]),this._setLegendItemState(e,nP.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=eP,spaceRow:h=iP}=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;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):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=pm.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,aP.item,t,w)):(w=pm.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,aP.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?nP.selected:nP.unSelected);const C=pm.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=pm.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,aP.itemShape,t,w,S.state),s.addState(e?nP.selected:nP.unSelected),C.add(s)}let O=0;if(d){const e=R(g,"size",10);E=pm.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},g),{visible:!0,pickMode:"imprecise",boundsPadding:T})),this._appendDataToShape(E,aP.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=XM(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,aP.itemLabel,t,w,A.state),D.addState(e?nP.selected:nP.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=XM(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,aP.itemValue,t,w,k.state),r.addState(e?nP.selected:nP.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(),V=p(this.attribute.item.width)?this.attribute.item.width:z+T[1]+T[3],N=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=V,w.attribute.height=N,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 tP(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 tP(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 EM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:12},t),{width:e})):new EM(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=pm.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=eP,spaceRow:a=iP}=s,o=this._itemsContainer,{space:l=sP,defaultCurrent:h=1}=n,c=cP(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 _=pm.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(nP.selected)?this._setLegendItemState(t,nP.selectedHover,e):this._setLegendItemState(t,nP.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===aP.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(rP.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(nP.unSelectedHover)||t.hasState(nP.selectedHover))&&(i=!0),t.removeState(nP.unSelectedHover),t.removeState(nP.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(nP.unSelectedHover)&&!t.hasState(nP.selectedHover)||(i=!0),t.removeState(nP.unSelectedHover),t.removeState(nP.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===aP.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(rP.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(rP.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!==aP.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(rP.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!==aP.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(rP.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(nP.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({},dP,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(nP.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 pP;function gP(t){return y(t)?t:[t,t]}function mP(t){return t?"ew-resize":"ns-resize"}uP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:eP,spaceRow:iP,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:sP,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"}(pP||(pP={})),lP();class fP extends Sb{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({},fP.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"===P_.env?(P_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),P_.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"===P_.env?(P_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),P_.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"===P_.env?(P_.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),P_.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"===P_.env?(P_.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),P_.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:gP(d)[0],endValue:gP(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const m=pm.group({x:0,y:0});m.name=pP.innerView,this.add(m),this._innerView=m;let f,v=0;if(r&&r.visible){f=pm.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=pP.startText,m.add(f);const e=p(r.space)?r.space:0;v+=(g?f.AABBBounds.width():f.AABBBounds.height())+e}const _=pm.group({x:g?v:0,y:g?0:v});m.add(_);const y=pm.group({x:0,y:0});let b;if(y.name=pP.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=pm.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=pP.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=pm.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=pP.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]=gP(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":mP(p)},r));if(v.name=pP.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=f,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=pP.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":mP(p)},r));if(i.name=pP.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(m,"end");e.name=pP.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=pm.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=pP.trackContainer;const f=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===f?"pointer":mP(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=pm.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=pP.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return pm.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":mP(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),pm.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=pm.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=pm.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===pP.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===pP.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===pP.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===pP.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}}}fP.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}}},hP(),lP();class vP extends oP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},vP.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 _P(){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`}vP.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"}}},hP(),lP(),lM();class yP extends oP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},yP.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=pm.group({x:0,y:0});this._innerView.add(x);const S=new fP({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:_P(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=pm.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))}}yP.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)"}},iM(),bM(),gM();let bP=class t extends Sb{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,V,N,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},wM),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},wM),$),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!==(V=K.width)&&void 0!==V?V: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!==(N=$.width)&&void 0!==N?N: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"))}}}};bP.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 xP={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"}}};iM(),bM(),gM();let SP=class extends Sb{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==e)return void(o&&o.hideAll());if(p(i))if(!1!==i.visible){const t=z({},R(xP,"title.style"),i.style);UM(t)?this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},KM(t)),{visible:i.visible,x:0,y:0}),"richtext"):this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},t),{lineHeight:p(t.lineHeight)?t.lineHeight:t.fontSize,visible:i.visible,x:0,y:0}),"text"),i.autoFit&&k(a)&&this._setLocalAutoFit(a,this._title,i),i.autoLimit&&k(r)&&this._title.setAttribute("maxLineWidth",a)}else{const t=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}if(p(s)){const t=Y(s),e=[];t.forEach(((t,s)=>{if(!1!==t.visible){const n=z({},R(xP,"content.style"),t.style);let l;l=UM(n)?o.createOrUpdateChild("indicator-content-"+s,Object.assign(Object.assign({},KM(n)),{visible:i.visible,x:0,y:0}),"richtext"):o.createOrUpdateChild("indicator-content-"+s,Object.assign(Object.assign({},n),{lineHeight:p(n.lineHeight)?n.lineHeight:n.fontSize,visible:t.visible,x:0,y:0}),"text"),t.autoFit&&k(a)&&this._setLocalAutoFit(a,l,t),t.autoLimit&&k(r)&&l.setAttribute("maxLineWidth",a),e.push(l)}else{const t=o.find((t=>t.name==="indicator-content-"+s),!1);t&&o.removeChild(t)}})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.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=WM(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 AP extends yg{constructor(t){super(t)}}var kP,MP;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(kP||(kP={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(MP||(MP={}));class TP extends Sb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},TP.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"},TP.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"},TP.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},TP.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},TP.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 AP(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new AP(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new AP(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(kP.OnPlay)},this.pause=()=>{this._dispatchEvent(kP.OnPause)},this.forward=()=>{this._dispatchEvent(kP.OnForward)},this.backward=()=>{this._dispatchEvent(kP.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()}}TP.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},TP.defaultAttributes={[MP.Start]:{},[MP.Pause]:{},[MP.Backward]:{},[MP.Forward]:{}};const wP={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},CP=[200,10];var EP,PP;!function(t){t.Default="default",t.Reverse="reverse"}(EP||(EP={})),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"}(PP||(PP={}));const BP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===EP.Default&&s===i})({direction:e,maxIndex:i,dataIndex:n})||(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===EP.Reverse&&s===i})({direction:e,minIndex:s,dataIndex:n})},RP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===EP.Default&&s===i})({direction:e,minIndex:s,dataIndex:n})||(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===EP.Reverse&&s===i})({direction:e,maxIndex:i,dataIndex:n})},LP=t=>"top"===t||"bottom"===t;class OP extends Sb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},OP.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(LP(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:CP[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:CP[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 fP(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 LP(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 TP(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=LP(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:CP[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?(LP(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:LP(this._orient)?t+s:(this._size.width-r)/2,y:LP(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:LP(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:LP(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:LP(this._orient)?t+s:(this._size.width-r)/2,y:LP(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 IP(){lP(),iM(),_M()}OP.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({},wP),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},wP),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},wP),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},wP),{key:"backward",position:"start"})}},IP();class DP extends OP{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:EP.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(kP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(kP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(kP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(kP.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(PP.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(BP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||RP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===EP.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(PP.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=P_.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(PP.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(PP.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=P_.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(),P_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(PP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,P_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(PP.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(PP.change),this.dispatchCustomEvent(PP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var FP,jP=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())}))};IP();class zP extends OP{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(kP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(kP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(kP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(kP.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(PP.change))},this.play=()=>jP(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(PP.play),this._rafId=P_.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=P_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,P_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(PP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,P_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(PP.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(PP.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(PP.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"}(FP||(FP={}));const HP={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}},VP=5;const NP={debounce:xt,throttle:St};iM(),cM();let GP=class t extends Sb{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:NP[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(FP.brushClear,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._container.incrementalClearChild(),this._brushMaskAABBBoundsDict={}):(this._activeDrawState&&this._dispatchEvent(FP.drawEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._activeMoveState&&this._dispatchEvent(FP.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=HP.trigger,updateTrigger:e=HP.updateTrigger,endTrigger:i=HP.endTrigger,resetTrigger:s=HP.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(FP.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(FP.moveStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_drawing(t){var e,i;const s=this.eventPosToStagePos(t),{sizeThreshold:n=VP,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(FP.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(FP.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=pm.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)})},UP=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}},YP={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:kM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:kM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:kM,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},KP=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];iM(),uM(),_M(),bM(),gM();let XP=class t extends Sb{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:BM(u)&&BM(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:BM(u)&&BM(u.value)},UP(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:BM(u)&&BM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:BM(u)&&BM(u.value)},UP(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},wM),u.value),visible:BM(u)&&BM(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=BM(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 _=BM(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(!BM(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)+(BM(n.key)?r+n.key.spacing:0)+(BM(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&&($M(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:BM(n.key)||"right"===c||(t="left"),m.setAttribute("textAlign",t),$M(c,m,t,u,a),m.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(BM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Fc(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(BM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},UP(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},UP(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},wM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(BM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},UP(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},UP(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=>KP.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)&&BM(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=BM(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=GM(u),y=GM(p);let b=0;if(BM(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(BM(p)){const{width:t,height:e}=y.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}f&&mg[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 WP({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return WP({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};XP.defaultAttributes=YP;const $P=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 ZP(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function JP(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function QP(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 tB(t,e){const i=QP(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 eB(t,e){const i=iB(t),s=iB(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 iB(t,e={x:0,y:0}){return qt.distancePP(t,e)}function sB(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 nB(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const rB=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var oB,lB;!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"}(oB||(oB={})),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.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(lB||(lB={}));const hB="__VCHART",cB=500,dB=500,uB=`${hB}_LABEL_LIMIT`,pB=`${hB}_LABEL_ALIGN`,gB=`${hB}_LABEL_TEXT`,mB=`${hB}_LABEL_VISIBLE`,fB=`${hB}_LABEL_X`,vB=`${hB}_LABEL_Y`,_B=`${hB}_ARC_TRANSFORM_VALUE`,yB=`${hB}_ARC_RATIO`,bB=`${hB}_ARC_START_ANGLE`,xB=`${hB}_ARC_END_ANGLE`,SB=`${hB}_ARC_K`,AB=`${hB}_ARC_MIDDLE_ANGLE`,kB=`${hB}_ARC_QUADRANT`,MB=`${hB}_ARC_RADIAN`,TB=-Math.PI/2,wB=3*Math.PI/2,CB=-90,EB=.6;var PB,BB,RB,LB,OB,IB,DB,FB,jB,zB,HB,VB,NB,GB,WB;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(PB||(PB={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(BB||(BB={})),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"}(RB||(RB={})),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"}(LB||(LB={})),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"}(OB||(OB={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(IB||(IB={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(DB||(DB={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(FB||(FB={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(jB||(jB={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(zB||(zB={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(HB||(HB={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(VB||(VB={})),t.VGRAMMAR_HOOK_EVENT=void 0,(NB=t.VGRAMMAR_HOOK_EVENT||(t.VGRAMMAR_HOOK_EVENT={})).BEFORE_EVALUATE_DATA="beforeEvaluateData",NB.AFTER_EVALUATE_DATA="afterEvaluateData",NB.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",NB.AFTER_EVALUATE_SCALE="afterEvaluateScale",NB.BEFORE_PARSE_VIEW="beforeParseView",NB.AFTER_PARSE_VIEW="afterParseView",NB.BEFORE_TRANSFORM="beforeTransform",NB.AFTER_TRANSFORM="afterTransform",NB.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",NB.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",NB.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",NB.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",NB.BEFORE_STAGE_RESIZE="beforeStageResize",NB.AFTER_STAGE_RESIZE="afterStageResize",NB.BEFORE_VRENDER_DRAW="beforeVRenderDraw",NB.AFTER_VRENDER_DRAW="afterVRenderDraw",NB.BEFORE_MARK_JOIN="beforeMarkJoin",NB.AFTER_MARK_JOIN="afterMarkJoin",NB.BEFORE_MARK_UPDATE="beforeMarkUpdate",NB.AFTER_MARK_UPDATE="afterMarkUpdate",NB.BEFORE_MARK_STATE="beforeMarkState",NB.AFTER_MARK_STATE="afterMarkState",NB.BEFORE_MARK_ENCODE="beforeMarkEncode",NB.AFTER_MARK_ENCODE="afterMarkEncode",NB.BEFORE_DO_LAYOUT="beforeDoLayout",NB.AFTER_DO_LAYOUT="afterDoLayout",NB.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",NB.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",NB.BEFORE_DO_RENDER="beforeDoRender",NB.AFTER_DO_RENDER="afterDoRender",NB.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",NB.AFTER_MARK_RENDER_END="afterMarkRenderEnd",NB.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",NB.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",NB.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",NB.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",NB.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",NB.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",NB.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",NB.BEFORE_ELEMENT_STATE="beforeElementState",NB.AFTER_ELEMENT_STATE="afterElementState",NB.BEFORE_ELEMENT_ENCODE="beforeElementEncode",NB.AFTER_ELEMENT_ENCODE="afterElementEncode",NB.ANIMATION_START="animationStart",NB.ANIMATION_END="animationEnd",NB.ELEMENT_ANIMATION_START="elementAnimationStart",NB.ELEMENT_ANIMATION_END="elementAnimationEnd",NB.ALL_ANIMATION_START="allAnimationStart",NB.ALL_ANIMATION_END="allAnimationEnd",function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(GB||(GB={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(WB||(WB={}));const UB="__vgrammar_scene_item__",YB=[RB.line,RB.area],KB=[RB.arc3d,RB.rect3d,RB.pyramid3d],XB="key",$B=[{}],qB=["key"],ZB=!0,JB=!0,QB=!1,tR=!0,eR="VGRAMMAR_IMMEDIATE_ANIMATION",iR=0,sR=1e3,nR=0,rR=0,aR=!1,oR=!1,lR="quintInOut",hR={stopWhenStateChange:!1,immediatelyApply:!0};function cR(t,e){return Y(t).reduce(((t,i)=>{const s=_(i)?e.getGrammarById(i):i;return s&&t.push(s),t}),[])}function dR(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 cR(t.dependency,e);var i;return[]}function uR(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function pR(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 gR(t,e){return mR(t)?t.output():e[t]}const mR=t=>t&&!u(t.grammarType),fR=t=>d(t)?t:e=>e[t];function vR(t){return!!(null==t?void 0:t.scale)}function _R(t){return!!(null==t?void 0:t.field)}function yR(t,e){if(!t)return[];let i=[];return t.scale&&(i=mR(t.scale)?[t.scale]:Y(e.getScaleById(t.scale))),i.concat(dR(t,e))}function bR(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 xR(t,e,i,s,n){i&&(uR(i)?e.forEach((e=>{const n=pR(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 RB.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case RB.group:case RB.rect:case RB.image:return["width","height","y1"].includes(e);case RB.path:case RB.shape:return["path","customPath"].includes(e);case RB.line:return"defined"===e;case RB.area:return["x1","y1","defined"].includes(e);case RB.rule:return["x1","y1"].includes(e);case RB.symbol:return"size"===e;case RB.polygon:return"points"===e;case RB.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(vR(l)){const t=gR(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?cb(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(_R(l)){const t=cb(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=pR(l,s,e.datum,t)}))})))}function SR(t,e,i,s){if(!t)return null;if(uR(t))return pR(t,s,e,i);const n={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(vR(h)){const t=gR(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?cb(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(_R(h)){const t=cb(h.field);n[r]=t(e)}else n[r]=pR(h,s,e,i)})),n}class AR{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 kR=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]}};kR._plotMarks={},kR._marks={},kR._components={},kR._graphicComponents={},kR._transforms={},kR._grammars={},kR._glyphs={},kR._animations={},kR._interactions={},kR._graphics={},kR.registerGlyph=(t,e,i,s,n)=>(kR._glyphs[t]=new AR(e,i,s,n),kR._glyphs[t]),kR.registerAnimationType=(t,e)=>{kR._animations[t]=e},kR.getAnimationType=t=>kR._animations[t],kR.registerInteraction=(t,e)=>{kR._interactions[t]=e},kR.registerGraphic=(t,e)=>{kR._graphics[t]=e},kR.getGraphicType=t=>kR._graphics[t],kR.createGraphic=(t,e)=>{const i=kR._graphics[t];return i?i(e):null};const MR=t=>!!RB[t];function TR(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var s;const n=kR.getGraphicType(e)?kR.createGraphic(e,i):kR.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 wR=t=>{t&&(t[UB]=null,t.release(),t.parent&&t.parent.removeChild(t))},CR=["fillOpacity"],ER=(t,e,i)=>{var s;return"fillOpacity"===e?(t.fillOpacity=null!==(s=i.fillOpacity)&&void 0!==s?s:1,["fillOpacity"]):[]};const PR={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"}],[RB.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"}],[RB.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"}],[RB.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 BR=(t,e,i,s)=>{const n={},r=e?Object.keys(e):[],a=_(t)?PR[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||(CR.includes(r)?ER(n,r,e):n[r]=e[r])}))}else r.forEach((t=>{CR.includes(t)?ER(n,t,e):n[t]=e[t]}));return n},RR=(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),LR=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],OR=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(LR);function IR(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)?OR:LR,r=[];let a=null;return t.forEach(((t,e)=>{a&&n.every((e=>RR(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=DR(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function DR(t){const e={};return t?(Object.keys(t).forEach((i=>{"x"!==i&&"y"!==i&&"x1"!==i&&"y1"!==i&&"defined"!==i&&"size"!==i&&"width"!==i&&"height"!==i&&"context"!==i&&(e[i]=t[i])})),e):e}let FR=class{constructor(t){this.data=null,this.states=[],this.diffState=BB.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:{}})));xR(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?BR(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[UB]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?BR(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t)))}updateGraphicItem(){if(!this.graphicItem)return;this.diffState===BB.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&&(wR(this.graphicItem),this.graphicItem[UB]=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=fR(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(pR(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===BB.unChange&&(this.diffState=BB.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&(this.mark.isCollectionMark()&&delete t.defined,Object.assign(e,t)),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==BB.enter&&this.diffState!==BB.update||!this.states.length||this.useStates(this.states),this.mark.markType===RB.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 cl))}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[PB.update],a=e[PB.enter],o=e[PB.exit],l=this.mark.isLargeMode()||n&&!this.mark.getSpec().enableSegments;this.diffState===BB.enter?(a&&xR(this,t,a,s,l),r&&xR(this,t,r,s,l)):this.diffState===BB.update?((n&&a||i)&&xR(this,t,a,s,l),r&&xR(this,t,r,s,l)):this.diffState===BB.exit&&o&&(i&&xR(this,t,a,s,l),xR(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)gb(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[RB.line,RB.area,RB.largeRects,RB.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(s=l.nextAttrs)||void 0===s?void 0:s.points)&&(!0===i||bR(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[PB.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=DR(h),e===RB.line||e===RB.area){const i=function(t,e,i,s){return t&&t.length&&(1!==t.length||e)?t.some((t=>bR(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===RB.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=IR(e.items,e.points,i);if(s)return void s.forEach((e=>{t.push(e)}))}const n=DR(e.items[0]);n.points=e.points,t.push(n)})),t}return s?IR(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=SR(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=IR(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t)}else h.points=i,h.segments=null}else e===RB.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===RB.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}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&&(wR(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 jR{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 zR=(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 HR extends jR{constructor(t,e){super(t,e),this.type=HR.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({},HR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=zR(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()}}HR.type="element-select",HR.defaultOptions={state:WB.selected,trigger:"click"};class VR extends jR{constructor(t,e){super(t,e),this.type=VR.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},VR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=zR(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 NR(t){if(t)return t.type===Pw.Band?t.bandwidth():t.type===Pw.Point?t.step():void 0}VR.type="element-highlight",VR.defaultOptions={highlightState:WB.highlight,blurState:WB.blur,trigger:"pointerover",triggerOff:"pointerout"};class GR{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 WR=()=>{U(HR,GR),kR.registerInteraction(HR.type,HR)},UR=()=>{U(VR,GR),kR.registerInteraction(VR.type,VR)},YR=(t,e)=>mR(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,KR=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,s)=>{const n=t[s];return i[s]=YR(n,e),i}),{}):t.map((t=>YR(t,e))):t;let XR=-1;class $R extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++XR}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(dR(this.spec[e],this.view)),this.spec[e]=t,this.attach(dR(t,this.view)),this.commit(),this}}const qR=(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=dR(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}},ZR=(t,e)=>{const i=kR.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(cR(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(y(e)){const s=e.map((e=>qR(t,e,i)));return{references:s.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:s.map((t=>t.value))}}return qR(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}},JR=(t,e)=>{if(null==t?void 0:t.length){const i=[];let s=[];return t.forEach((t=>{var n;const r=ZR(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},QR={csv:Yr,dsv:Ur,tsv:Kr,json:function(t){if(!_(t))return Y(t);try{return Y(JSON.parse(t))}catch(t){return[]}}};class tL extends $R{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||!QR[e.type])return Y(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return QR[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?dR(t.format,this.view)[0]:null;if(s&&e.push(s),t.values){const s=dR(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=dR(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=mR(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=JR(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=JR(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 eL="window",iL="view",sL={trap:!1},nL="width",rL="height",aL="viewWidth",oL="viewHeight",lL="padding",hL="viewBox",cL="autoFit";function dL(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 uL(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,dL(t,e,n,s)}class pL{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 dL(this.nodes,e,0,this.compare),uL(this.nodes,e,null,this.compare)}return this.nodes.push(t),dL(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)),dL(this.nodes,e,0,this.compare),uL(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,uL(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class gL{constructor(t){this.list=[],this.ids={},this.idFunc=t||db}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 mL{constructor(){this.grammars=[],this.logger=at.getInstance(),this._curRank=0,this._committed=new gL((t=>t.uid)),this._heap=new pL(((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 gL((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 fL=(t,e,i,s,n)=>{const r=t=>{if(n||!t||s&&!s(t)||i.call(null,t),t.markType===RB.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}n&&(!t||s&&!s(t)||i.call(null,t))};r(t)};class vL{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 $d(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Il.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 J_(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 $b(o)),null===(r=this._eventConfig)||void 0===r?void 0:r.gesture){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new Jb(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 _L(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 yL(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 bL(t,e,i,s,n){if(n===eL){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{yL(t,_L(t),!1)}))}));const e=_L(t);yL(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e}class xL extends $R{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?pR(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}},ML=(t,e)=>e&&e.debounce?xt(t,e.debounce):e&&e.throttle?St(t,e.throttle):t;class TL extends FR{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 xR(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[UB]=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?BR(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);this.graphicItem||this.initGraphicItem(),this.diffState===BB.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==BB.enter&&this.diffState!==BB.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.diffState===BB.enter&&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=BR(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=PR[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===RB.shape&&(o.datum=d[0].datum)})),s}}_generateGlyphItems(t,e,i){const s=e.map((t=>Object.assign({},t,{nextAttrs:i})));return YB.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)gb(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[UB]=null})),this.glyphGraphicItems=null),super.release()}}const wL=t=>t.markType===RB.glyph?new TL(t):new FR(t);function CL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(XB,i?t.slice().sort(i):t.slice()),{keys:qB,data:s};const n=fR(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 EL{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?CL(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 PL=(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=bR(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=bR(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 BL=(t,e,i,s,n)=>d(i)?i(t.getDatum(),t,n):i;class RL extends mc{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 LL extends mc{getEndProps(){return this.to}onBind(){var t;const e=null!==(t=this.target.constructor.NOWORK_ANIMATE_ATTR)&&void 0!==t?t:Fd,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)}}vc.mode|=ko.SET_ATTR_IMMEDIATELY;let OL=0;const IL=t=>!u(t)&&(t.prototype instanceof mc||"onBind"in t.prototype&&"onStart"in t.prototype&&"onEnd"in t.prototype&&"onUpdate"in t.prototype);class DL{constructor(t,e,i){this.id=OL++,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||!kR.getAnimationType(e.type))return null;const r=kR.getAnimationType(e.type)(t,n,i);return PL(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?BL(t,0,n[i].from,0,s):void 0,e.to[i]=l?BL(t,0,n[i].to,0,s):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),PL(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=IL(o);return u(o)||IL(o)?h?new o(r.from,r.to,a,t.easing,l):r.to?new LL(r.from,r.to,a,t.easing):void 0:new RL(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 Uc(a,e))}r>0&&t.wait(r)}}function FL(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(jL(i,t[i]))})),e}function jL(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:iR,totalTime:h.totalTime,oneByOne:null!==(i=h.oneByOne)&&void 0!==i?i:oR,loop:null!==(s=h.loop)&&void 0!==s?s:aR,controlOptions:z({},hR,null!==(n=h.controlOptions)&&void 0!==n?n:{}),timeSlices:[{duration:null!==(r=h.duration)&&void 0!==r?r:sR,delay:null!==(a=h.delay)&&void 0!==a?a:nR,delayAfter:null!==(o=h.delayAfter)&&void 0!==o?o:rR,effects:[{type:h.type,channel:h.channel,custom:h.custom,easing:null!==(l=h.easing)&&void 0!==l?l:lR,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:iR,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:oR,loop:null!==(d=t.loop)&&void 0!==d?d:aR,controlOptions:z({},hR,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:nR,delayAfter:null!==(i=t.delayAfter)&&void 0!==i?i:rR,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:lR,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 zL(t,e,i){return d(t)?t.call(null,e.getDatum(),e,i):t}class HL{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 VL{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=FL(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=FL(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!==BB.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 HL(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=jL(eR,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 HL(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===BB.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 DL(s,i,e);if(l.animate(n,r),!l.isAnimating)return;s.diffState===BB.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=pR(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,s,n){const r=[],a=zL(t.startTime,e,n),o=zL(t.totalTime,e,n),l=zL(t.oneByOne,e,n),h=zL(t.loop,e,n);let c=0;t.timeSlices.forEach((t=>{var i;const a=zL(t.delay,e,n),l=zL(t.delayAfter,e,n),h=null!==(i=zL(t.duration,e,n))&&void 0!==i?i:o/s,d=Y(t.effects).map((t=>Object.assign({},t,{customParameters:zL(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===BB.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===BB.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===eR,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===BB.exit&&0===o[BB.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 NL extends $R{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new VL(this,{}),this.differ=new EL([]),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===BB.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(e,i){var s;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===VB.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:$B,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===RB.group)return;const e=CL(null!=t?t:$B,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(BB.update,t,e,i)}encodeState(t,e,i,s){if(t===BB.enter&&(this._isReentered=!0),this.spec.encode[t]){const n=this.spec.encode[t];if(uR(n))this.detach(yR(n,this.view));else{const r=_(e);r&&s||!r&&i?(Object.keys(n).forEach((t=>{this.detach(yR(n[t],this.view))})),this.spec.encode[t]={}):r?this.detach(yR(n[e],this.view)):Object.keys(e).forEach((t=>{this.detach(yR(n[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),_(e)?(this.spec.encode[t][e]=i,this.attach(yR(i,this.view))):uR(e)?(this.spec.encode[t]=e,this.attach(yR(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(yR(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=JR(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=JR(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 YB.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!==BB.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===GB.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&&!uR(n)&&Object.keys(n).forEach((t=>{vR(n[t])&&(e[t]=gR(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];uR(s)||Object.keys(s).forEach((t=>{_R(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[UB];if((null==s?void 0:s.mark)===this){const i=bL(this.view,t,s,0,iL);this.emitGrammarEvent(e,i,s)}},this.initEvent()),this.animate||(this.animate=new VL(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=gR(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!==RB.group){if(!this.graphicItem){const t=TR(this,RB.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||KB.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||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==RB.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=fR(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:()=>XB),a=fR(null!==(n=this.spec.groupBy)&&void 0!==n?n:()=>XB),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===BB.enter))),c=[];this.differ.setCallback(((t,e,i)=>{const s=t;let n;if(u(e))n=this.elementMap.get(s),n&&(n.diffState=BB.exit);else if(u(i)){n=this.elementMap.has(s)?this.elementMap.get(s):wL(this),n.diffState===BB.exit&&(n.diffState=BB.enter,this.animate.getElementAnimators(n,BB.exit).forEach((t=>t.stop("start")))),n.diffState=BB.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=BB.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:$B;l||this.differ.setCurrentData(CL(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]=SR(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[PB.group],s);e.forEach((t=>{this.markType===RB.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._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:TR(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!==RB.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=fR(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:()=>XB),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=wL(this);e.diffState=BB.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=wL(this);i.diffState=BB.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!==RB.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=TR(this,RB.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!==BB.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:PR[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=BB.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&&wR(this.graphicItem),this.detachAll(),super.release()}}let GL=class extends NL{constructor(t,e){super(t,RB.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===RB.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 PR.rect}evaluateJoin(t){if(!this.elements.length){const t=wL(this);t.updateData(XB,$B,(()=>""),this.view),this.elements=[t],this.elementMap.set(XB,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 xR(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[PB.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:TR(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 WL(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 UL(t,e){return Math.min(t<0?t+e:t-1,e)}function YL(t,e,i){let s=UL(t,i),n=UL(e,i);if(k(t)||k(e)?k(t)?k(e)||(s=UL(Math.max(0,n-1),i)):n=UL(s+1,i):(s=1,n=2),s>n){const t=n;n=s,s=t}return{start:s,end:n}}const KL=(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=>WL(t,i))),u=l.map((t=>WL(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}=YL(e,i,r),{start:h,end:c}=YL(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()}))},XL={[LB.axis]:0,[LB.legend]:1,[LB.slider]:2,[LB.player]:3,[LB.datazoom]:4},$L=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=XL[t.componentType])&&void 0!==s?s:1/0},qL=(t,e,i,s)=>{const n=i.clone(),r=t.getSpec().layout,a=mb(r.maxChildWidth,n.width()),o=mb(r.maxChildHeight,n.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=kL(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&&d$L(t)-$L(e)));for(let t=0,e=f.length;t{null==t||t.forEach((t=>{var s;if(t.markType!==RB.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=qL(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(aL,o),i.updateSignal(oL,l),i.updateSignal(lL,h)}else qL(t,n,a,e);else"grid"===r.display&&KL(t,n,a);ZL(n,e,i)}}))};class JL extends NL{constructor(t,e,i){super(t,RB.glyph,i),this.glyphType=e,this.glyphMeta=kR.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(!kR.getGraphicType(RB.glyph))return;const s=kR.createGraphic(RB.glyph,i),n=e.getMarks(),r=Object.keys(n).map((t=>{if(kR.getGraphicType(n[t])){const e=kR.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 QL=Symbol.for("key");class tO{diffGrammar(t,e){return function(t,e,i){const s={enter:[],exit:[],update:[]},n=new EL(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(CL(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!==RB.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==RB.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=CL(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=CL(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=fR(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 EL(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(CL(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:QL})),r=CL(e,(t=>{var e;return null!==(e=s(t))&&void 0!==e?e:QL}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==QL){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=pR(i.animation.delay,n,o,l),d=pR(i.animation.duration,n,o,l),u=pR(i.animation.oneByOne,n,o,l),p=pR(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)?Td:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:wd)(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);Sd(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)?Td:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:wd)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>_d(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>bd(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 xd({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Sc,null!==(l=i.easing)&&void 0!==l?l:Ac))}))}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 Ad({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Sc,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Ac))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Sd(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 eO{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 iO extends eO{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===RB.group&&s.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===RB.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=>{const s=t.mark;s.markType===RB.group&&s.includesChild(e,!1)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===RB.group&&e.includesChild(s,!1)&&(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 sO{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 nO extends NL{addGraphicItem(t,e){const i=t&&t.limitAttrs,s=TR(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?RB.richtext:RB.text,t);return super.addGraphicItem(t,e,s)}release(){super.release()}}nO.markType=RB.text;const rO={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)"}}},aO={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},oO=Object.assign({},rO);oO.axis=Object.assign({},oO.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),oO.circleAxis=Object.assign({},oO.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),oO.grid=Object.assign({},oO.grid,{style:{stroke:"#404349"}}),oO.circleGrid=Object.assign({},oO.circleGrid,{style:{stroke:"#404349"}}),oO.rectLabel=Object.assign({},oO.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),oO.lineLabel=Object.assign({},oO.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),oO.symbolLabel=Object.assign({},oO.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),oO.title=Object.assign({},oO.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const lO={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:aO,components:oO},hO={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:aO,components:rO};let cO=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")}};cO._themes=new Map,cO.registerTheme("default",hO),cO.registerTheme("dark",lO);class dO extends NL{constructor(t,e,i,s){super(t,RB.component,i),this._componentDatum={[XB]: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:kR.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,XB)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[XB]+=1}evaluateJoin(t){return this.spec.key=XB,t?(t[XB]=this._componentDatum[XB],this._componentDatum=t):this._componentDatum={[XB]:this._componentDatum[XB]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}class uO 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[UB],n=bL(0,t,s,0,iL);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(mR(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)):MR(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 xL(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 tL(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=kR.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=kR.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 RB.group:n=new GL(this,s);break;case RB.glyph:n=new JL(this,null==i?void 0:i.glyphType,s);break;case RB.component:n=kR.hasComponent(null==i?void 0:i.componentType)?kR.createComponent(null==i?void 0:i.componentType,this,s,null==i?void 0:i.mode):new dO(this,null==i?void 0:i.componentType,s,null==i?void 0:i.mode);break;case RB.text:n=new nO(this,t,s);break;default:n=kR.hasMark(t)?kR.createMark(t,this,s):new NL(this,t,s)}return this.grammars.record(n),this._dataflow.add(n),n}group(t){return this.mark(RB.group,t)}glyph(t,e){return this.mark(RB.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(RB.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(RB.component,t,{componentType:LB.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(RB.component,t,{componentType:LB.grid,mode:e})}legend(t){return this.mark(RB.component,t,{componentType:LB.legend})}slider(t){return this.mark(RB.component,t,{componentType:LB.slider})}label(t){return this.mark(RB.component,t,{componentType:LB.label})}datazoom(t){return this.mark(RB.component,t,{componentType:LB.datazoom})}player(t){return this.mark(RB.component,t,{componentType:LB.player})}title(t){return this.mark(RB.component,t,{componentType:LB.title})}scrollbar(t){return this.mark(RB.component,t,{componentType:LB.scrollbar})}customized(t,e){const i=kR.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&&AL.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&(wR(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_"+ ++SL;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(cO.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(nL,t.width),this.updateSignal(rL,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=kR.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=VB.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var s,n,r,a,o;return[{id:nL,value:null!==(s=t[nL])&&void 0!==s?s:0},{id:rL,value:null!==(n=t[rL])&&void 0!==n?n:0},{id:lL,value:kL(null!==(a=null!==(r=t[lL])&&void 0!==r?r:e[lL])&&void 0!==a?a:null==i?void 0:i.padding)},{id:aL,update:{callback:(t,e)=>{const i=kL(e[lL]);return e[nL]-i.left-i.right},dependency:[nL,lL]}},{id:oL,update:{callback:(t,e)=>{const i=kL(e[lL]);return e[rL]-i.top-i.bottom},dependency:[rL,lL]}},{id:hL,update:{callback:(t,e)=>{const i=kL(e[lL]);return(t||new Jt).setValue(i.left,i.top,i.left+e[aL],i.top+e[oL])},dependency:[aL,oL,lL]}},{id:cL,value:null!==(o=t[cL])&&void 0!==o?o:e[cL]}]})(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===RB.glyph?{glyphType:t.glyphType}:t.type===RB.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=cO.getTheme(t))&&void 0!==e?e:cO.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(nL);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(rL);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(aL);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(oL);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(lL);if(arguments.length){const i=kL(t);return this.updateSignal(e,i),i}return kL(e.output())}autoFit(t){const e=this.getSignalById(cL);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(hL);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=VB.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===RB.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var e;const i=this._options.doLayout||ZL;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=>{fL(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),fL(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=ZB,morph:o=JB,morphAll:l=QB,animation:h={},enableExitAnimation:c=tR}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:lR,delay:null!==(i=h.delay)&&void 0!==i?i:nR,duration:null!==(s=h.duration)&&void 0!==s?s:sR,oneByOne:null!==(n=h.oneByOne)&&void 0!==n?n:oR,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=VB.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=VB.reevaluate,this._dataflow.evaluate()),this._layoutState=VB.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=>!AL.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 fL(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(nL,t)),e!==this.height()&&(s=!0,this.updateSignal(rL,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]:iL;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):MR(t)?(i.markType=t,i.source=e):i.source=t===eL?eL: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=cR(l,this),v=ML(((t,e)=>{const s=c===iL&&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===eL&&(t=bL(0,t,e,0,eL));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===iL){if(function(t,e,i){const s=null==t?void 0:t[e];return!(!1===s||g(s)&&!s[i])}(this._eventConfig,iL,d))return this.addEventListener(d,v,sL),()=>{this.removeEventListener(d,v)}}else if(c===eL)return P_.addEventListener(d,v),this._eventListeners.push({type:d,source:P_,handler:v}),()=>{P_.removeEventListener(d,v);const t=this._eventListeners.findIndex((t=>t.type===d&&t.source===P_&&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=kR.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 vL(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e;this.grammars=new eO((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new iO((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 mL,this.animate=new sO(this),this._morph=new tO,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,[iL,eL]),e}(this._options.eventConfig),this._theme=this._options.disableTheme?null:cO.getDefaultTheme(),this.parseBuiltIn(),(e=this._options).mode&&P_.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=VB.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!==RB.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=P_.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&P_.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(),kR.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 pO=()=>{fM(),lM(),kR.registerGraphic(RB.path,Ng)},gO=()=>{fM(),uM(),kR.registerGraphic(RB.rect,Tg)},mO=()=>{fM(),aM(),kR.registerGraphic(RB.rule,Ag)},fO=()=>{fM(),_M(),kR.registerGraphic(RB.symbol,bg)},vO=()=>{fM(),bM(),gM(),kR.registerGraphic(RB.text,mp)},_O=()=>{fM(),tM(),kR.registerGraphic(RB.glyph,Cg)},yO=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},bO=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},xO=(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(yb(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},SO=(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&&yb(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},AO=yO(xO),kO=bO(xO);const MO=(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(yb(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},TO=(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&&yb(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},wO=yO(MO),CO=bO(MO);const EO=(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`},PO=(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`},BO=(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)?PO:EO,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)}}:{}},RO=(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}},LO=(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})}},OO=(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 IO extends dO{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 DO=(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 FO extends IO{constructor(t,e,i){super(t,LB.axis,e),this.spec.componentType=LB.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=kR.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=SR(n,e,i,s);const h=pR(this.spec.inside,s,e,i),c=pR(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(DO(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=pR(this.spec.tickCount,s,e,i);switch(this._getAxisComponentType()){case IB.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 IB.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?IB.circleAxis:IB.lineAxis,this._axisComponentType}}FO.componentType=LB.axis;let jO=class extends dO{constructor(t,e){super(t,LB.label,e),this.spec.componentType=LB.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=pR(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=pR(s,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case RB.line:case RB.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case RB.rect:case RB.rect3d:case RB.interval:g=p.rectLabel;break;case RB.symbol:case RB.circle:case RB.cell:g=p.symbolLabel;break;case RB.arc:case RB.arc3d:g=p.arcLabel;break;case RB.polygon:case RB.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=SR(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=SR(i,t,e,d);m.push(z({},f,s))}));else{const t=SR(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}};jO.componentType=LB.label;const zO=()=>{kR.registerGraphicComponent(LB.label,(t=>new $T(t))),kR.registerComponent(LB.label,jO)};class HO extends IO{constructor(t,e,i){super(t,LB.grid,e),this.spec.componentType=LB.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=kR.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=SR(s,t,e,i);const d=pR(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 DB.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 DB.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=pR(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(DO(h,n,s,d,this.spec.layout,!0),c))}this._getGridComponentType()===DB.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=pR(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case DB.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 DB.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=DB.circleAxisGrid:this._gridComponentType=DB.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case IB.circleAxis:this._gridComponentType=DB.circleAxisGrid;break;case IB.lineAxis:default:this._gridComponentType=DB.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()?DB.lineAxisGrid:DB.circleAxisGrid:DB.lineAxisGrid}else this._gridComponentType=DB.lineAxisGrid;return this._gridComponentType}}HO.componentType=LB.grid;const VO=(t,e,i)=>e.filter((e=>t.callback(e,i))),NO=(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 GO(t){return t.reduce(((t,e)=>t+e),0)}const WO={min:$,max:X,average:function(t){return 0===t.length?0:GO(t)/t.length},sum:GO};function UO(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 YO(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 KO(t,e,i,s){return YO(t,e,i,"min",s)}function XO(t,e,i,s){return YO(t,e,i,"max",s)}function $O(t,e,i,s){return YO(t,e,i,"average",s)}function qO(t,e,i,s){return YO(t,e,i,"sum",s)}const ZO=(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=UO;if("min"===n?l=KO:"max"===n?l=XO:"average"===n?l=$O:"sum"===n&&(l=qO),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[]},JO="_mo_hide_";const QO=(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(JO)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(JO,!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(JO,!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},tI=()=>{kR.registerTransform("filter",{transform:VO,markPhase:"beforeJoin"},!0)},eI=()=>{kR.registerTransform("map",{transform:NO,markPhase:"beforeJoin"},!0)},iI=()=>{kR.registerTransform("sampling",{transform:ZO,markPhase:"afterEncode"},!0)},sI=()=>{kR.registerTransform("markoverlap",{transform:QO,markPhase:"afterEncode"},!0)},nI=(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}}},rI=(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}}},aI=(t,e,i)=>{var s,n,r,a;const o=null!==(s=t.getFinalGraphicAttributes())&&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}}},oI=(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}}},lI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("y",!1),i=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1),n=t.getGraphicAttribute("y",!1),r=t.getGraphicAttribute("y1",!1),a=t.getGraphicAttribute("height",!1),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}}}}},hI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("y",!1),i=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("x1",!1),n=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicAttribute("height",!1),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 cI=(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.getGraphicAttribute("x",!1),r=t.getGraphicAttribute("x1",!1),a=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);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 dI=(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.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);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 uI=(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.getGraphicAttribute("y",!1),r=t.getGraphicAttribute("y1",!1),a=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("y",!1),n=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);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 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.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("y",!1),n=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);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)},gI=(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.getFinalGraphicAttributes();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.getFinalGraphicAttributes();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)},mI=(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.getFinalGraphicAttributes();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)},fI=(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.getFinalGraphicAttributes(),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.getFinalGraphicAttributes();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)},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=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.getFinalGraphicAttributes();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)},_I=(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((()=>Object.assign(n)))},yI=(t,e,i)=>({from:{points:_I(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),bI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:_I(t,e)}}),xI=(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),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}})),SI=(t,e,i)=>({from:{points:xI(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),AI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:xI(t,e,i)}}),kI=(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),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,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)=>{var s,n;const{offset:r=0,orient:a,direction:o,point:l}=null!=e?e:{};let h=0,c=0;"negative"===a&&(i.group?(h=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),c=null!==(n=i.groupHeight)&&void 0!==n?n:i.group.getBounds().height(),i.groupWidth=h,i.groupHeight=c):(h=i.width,c=i.height)),h+=r,c+=r;const u=d(l)?l.call(null,t.getDatum(),t,i):l,p=u&&k(u.x)?u.x:h,g=u&&k(u.y)?u.y:c,m=t.getFinalGraphicAttributes();switch(o){case"x":return{from:{x:p},to:{x:null==m?void 0:m.x}};case"y":return{from:{y:g},to:{y:null==m?void 0:m.y}};default:return{from:{x:p,y:g},to:{x:null==m?void 0:m.x,y:null==m?void 0:m.y}}}},CI=(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}}}},EI=(t,e,i)=>{var s,n,r,a;const o=t.getFinalGraphicAttributes();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}}}},PI=(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}}}},BI={symbol:["_mo_hide_","visible"]},RI=(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=BI[t.mark.markType])&&r.forEach((t=>{delete s[t],delete n[t]})),Object.keys(n).forEach((t=>{gb(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}},LI=(t,e,i)=>{var s,n;const r=null!==(n=null===(s=t.getFinalGraphicAttributes())||void 0===s?void 0:s.angle)&&void 0!==n?n:0;let a=0;return a=pt(r/(2*Math.PI),0)?Math.round(r/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(r/(2*Math.PI))*Math.PI*2:Math.floor(r/(2*Math.PI))*Math.PI*2,{from:{angle:a},to:{angle:r}}},OI=(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}}},II=()=>{kR.registerAnimationType("clipIn",nI)},DI=()=>{kR.registerAnimationType("clipOut",rI)},FI=()=>{kR.registerAnimationType("fadeIn",aI)},jI=()=>{kR.registerAnimationType("fadeOut",oI)},zI=()=>{kR.registerAnimationType("growCenterIn",lI)},HI=()=>{kR.registerAnimationType("growCenterOut",hI)},VI=()=>{kR.registerAnimationType("growHeightIn",uI)},NI=()=>{kR.registerAnimationType("growHeightOut",pI)},GI=()=>{kR.registerAnimationType("growWidthIn",cI)},WI=()=>{kR.registerAnimationType("growWidthOut",dI)},UI=()=>{kR.registerAnimationType("growPointsIn",yI)},YI=()=>{kR.registerAnimationType("growPointsOut",bI)},KI=()=>{kR.registerAnimationType("growPointsXIn",SI)},XI=()=>{kR.registerAnimationType("growPointsXOut",AI)},$I=()=>{kR.registerAnimationType("growPointsYIn",MI)},qI=()=>{kR.registerAnimationType("growPointsYOut",TI)},ZI=()=>{kR.registerAnimationType("growAngleIn",gI)},JI=()=>{kR.registerAnimationType("growAngleOut",mI)},QI=()=>{kR.registerAnimationType("growRadiusIn",fI)},tD=()=>{kR.registerAnimationType("growRadiusOut",vI)},eD=()=>{kR.registerAnimationType("moveIn",wI)},iD=()=>{kR.registerAnimationType("moveOut",CI)},sD=()=>{kR.registerAnimationType("scaleIn",EI)},nD=()=>{kR.registerAnimationType("scaleOut",PI)},rD=()=>{kR.registerAnimationType("rotateIn",LI)},aD=()=>{kR.registerAnimationType("rotateOut",OI)},oD=()=>{kR.registerAnimationType("update",RI)};class lD extends NL{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=uR(e)?null:Object.keys(e).reduce(((t,s)=>(vR(e[s])&&(t[s]=gR(e[s].scale,i)),t)),{});this._encoders[t]={callback:(t,i,n)=>{const r=SR(e,t,i,n);if(u(r.size)){const t=s.x?NR(s.x):void 0,e=s.y?NR(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(PR.symbol)}release(){super.release(),this._encoders=null}}lD.markType=RB.cell;const hD=["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 cD,dD,uD;t.ChartEvent=void 0,(cD=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",cD.rendered="rendered",cD.renderFinished="renderFinished",cD.animationFinished="animationFinished",cD.regionSeriesDataFilterOver="regionSeriesDataFilterOver",cD.afterInitData="afterInitData",cD.afterInitEvent="afterInitEvent",cD.afterInitMark="afterInitMark",cD.rawDataUpdate="rawDataUpdate",cD.viewDataFilterOver="viewDataFilterOver",cD.viewDataUpdate="viewDataUpdate",cD.viewDataStatisticsUpdate="viewDataStatisticsUpdate",cD.markDeltaYUpdate="markDeltaYUpdate",cD.viewDataLabelUpdate="viewDataLabelUpdate",cD.scaleDomainUpdate="scaleDomainUpdate",cD.scaleUpdate="scaleUpdate",cD.dataZoomChange="dataZoomChange",cD.drill="drill",cD.layoutStart="layoutStart",cD.layoutEnd="layoutEnd",cD.layoutRectUpdate="layoutRectUpdate",cD.playerPlay="playerPlay",cD.playerPause="playerPause",cD.playerEnd="playerEnd",cD.playerChange="playerChange",cD.playerForward="playerForward",cD.playerBackward="playerBackward",cD.scrollBarChange="scrollBarChange",cD.brushStart="brushStart",cD.brushChange="brushChange",cD.brushEnd="brushEnd",cD.brushClear="brushClear",cD.legendSelectedDataChange="legendSelectedDataChange",cD.legendFilter="legendFilter",cD.legendItemClick="legendItemClick",cD.legendItemHover="legendItemHover",cD.legendItemUnHover="legendItemUnHover",cD.tooltipShow="tooltipShow",cD.tooltipHide="tooltipHide",cD.tooltipRelease="tooltipRelease",cD.afterResize="afterResize",cD.afterRender="afterRender",cD.afterLayout="afterLayout",t.Event_Source_Type=void 0,(dD=t.Event_Source_Type||(t.Event_Source_Type={})).chart="chart",dD.window="window",dD.canvas="canvas",t.Event_Bubble_Level=void 0,(uD=t.Event_Bubble_Level||(t.Event_Bubble_Level={})).vchart="vchart",uD.chart="chart",uD.model="model",uD.mark="mark";const pD=`${hB}_waterfall_default_seriesField`,gD=`${hB}_CORRELATION_X`,mD=`${hB}_CORRELATION_Y`,fD=`${hB}_CORRELATION_SIZE`,vD=`${hB}_MEASURE_CANVAS_ID`,_D=`${hB}_DEFAULT_DATA_INDEX`,yD=`${hB}_DEFAULT_DATA_KEY`,bD=`${hB}_DEFAULT_DATA_SERIES_FIELD`,xD=`${hB}_DEFAULT_SERIES_STYLE_NAME`;var SD;t.AttributeLevel=void 0,(SD=t.AttributeLevel||(t.AttributeLevel={}))[SD.Default=0]="Default",SD[SD.Theme=1]="Theme",SD[SD.Chart=2]="Chart",SD[SD.Base_Series=3]="Base_Series",SD[SD.Series=4]="Series",SD[SD.Mark=5]="Mark",SD[SD.User_Chart=6]="User_Chart",SD[SD.User_Series=7]="User_Series",SD[SD.User_Mark=8]="User_Mark",SD[SD.Built_In=99]="Built_In";const AD=`${hB}_STACK_KEY`,kD=`${hB}_STACK_START`,MD=`${hB}_STACK_END`,TD=`${hB}_STACK_START_PERCENT`,wD=`${hB}_STACK_END_PERCENT`,CD=`${hB}_STACK_START_OffsetSilhouette`,ED=`${hB}_STACK_END_OffsetSilhouette`,PD=`${hB}_STACK_TOTAL`,BD=`${hB}_STACK_TOTAL_PERCENT`,RD=`${hB}_STACK_TOTAL_TOP`,LD=`${hB}_SEGMENT_START`,OD=`${hB}_SEGMENT_END`;var ID,DD;t.LayoutZIndex=void 0,(ID=t.LayoutZIndex||(t.LayoutZIndex={}))[ID.Axis_Grid=50]="Axis_Grid",ID[ID.CrossHair_Grid=100]="CrossHair_Grid",ID[ID.Region=450]="Region",ID[ID.Mark=300]="Mark",ID[ID.Node=400]="Node",ID[ID.Axis=100]="Axis",ID[ID.MarkLine=500]="MarkLine",ID[ID.MarkArea=100]="MarkArea",ID[ID.MarkPoint=500]="MarkPoint",ID[ID.DataZoom=500]="DataZoom",ID[ID.ScrollBar=500]="ScrollBar",ID[ID.Player=500]="Player",ID[ID.Legend=500]="Legend",ID[ID.CrossHair=500]="CrossHair",ID[ID.Indicator=500]="Indicator",ID[ID.Title=500]="Title",ID[ID.Label=500]="Label",ID[ID.Brush=500]="Brush",ID[ID.CustomMark=500]="CustomMark",ID[ID.Interaction=700]="Interaction",t.LayoutLevel=void 0,(DD=t.LayoutLevel||(t.LayoutLevel={}))[DD.Indicator=10]="Indicator",DD[DD.Region=20]="Region",DD[DD.Axis=30]="Axis",DD[DD.DataZoom=40]="DataZoom",DD[DD.Player=40]="Player",DD[DD.ScrollBar=40]="ScrollBar",DD[DD.Legend=50]="Legend",DD[DD.Title=70]="Title",DD[DD.CustomMark=70]="CustomMark";const FD=["linear","radial","conical"],jD={x0:0,y0:0,x1:1,y1:1},zD={x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},HD={x:.5,y:.5,startAngle:0,endAngle:2*Math.PI},VD={linear:jD,radial:zD,conical:HD},ND={label:{name:"label",type:"text"}},GD=`${hB}_rect_x`,WD=`${hB}_rect_x1`,UD=`${hB}_rect_y`,YD=`${hB}_rect_y1`,KD=Object.assign(Object.assign({},ND),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),XD=Object.assign(Object.assign({},ND),{bar3d:{name:"bar3d",type:"rect3d"}}),$D={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},qD=Object.assign(Object.assign({},ND),$D),ZD=Object.assign(Object.assign({},ND),{point:{name:"point",type:"symbol"}}),JD=Object.assign(Object.assign(Object.assign({},ND),$D),{area:{name:"area",type:"area"}}),QD=Object.assign(Object.assign(Object.assign({},ND),$D),{area:{name:"area",type:"area"}}),tF=Object.assign(Object.assign({},ND),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),eF=Object.assign(Object.assign({},ND),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}}),iF=Object.assign(Object.assign({},ND),{rose:{name:"rose",type:"arc"}}),sF=Object.assign(Object.assign({},ND),{area:{name:"area",type:"path"}}),nF=Object.assign(Object.assign({},ND),{group:{name:"group",type:"group"}}),rF=Object.assign(Object.assign({},nF),{track:{name:"track",type:"arc"},progress:{name:"progress",type:"arc"}}),aF=Object.assign(Object.assign({},ND),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),oF=Object.assign(Object.assign({},ND),{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"}}),lF=Object.assign(Object.assign({},ND),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"}}),hF=Object.assign(Object.assign({},ND),{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"}}),cF=Object.assign(Object.assign({},ND),{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"}}),dF=Object.assign(Object.assign({},ND),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),uF=Object.assign(Object.assign({},KD),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),pF=Object.assign(Object.assign({},ND),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),gF=Object.assign(Object.assign({},ND),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),mF=Object.assign(Object.assign({},ND),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}}),fF=Object.assign(Object.assign({},nF),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),vF=Object.assign(Object.assign({},ND),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),_F=Object.assign(Object.assign({},ND),{sunburst:{name:"sunburst",type:"arc"}}),yF=Object.assign(Object.assign({},KD),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),bF=Object.assign(Object.assign({},XD),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),xF=Object.assign(Object.assign({},ND),{circlePacking:{name:"circlePacking",type:"arc"}}),SF=Object.assign(Object.assign({},ND),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}}),AF=Object.assign(Object.assign({},ND),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),kF=Object.assign({},JD),MF=Object.assign(Object.assign({},ND),{liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"symbol"}}),TF=Object.assign(Object.assign({},ND),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});var wF;!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"}(wF||(wF={}));const CF={[oB.bar]:KD,[oB.bar3d]:XD,[oB.line]:qD,[oB.scatter]:ZD,[oB.area]:JD,[oB.radar]:QD,[oB.pie]:tF,[oB.pie3d]:eF,[oB.rose]:iF,[oB.geo]:ND,[oB.map]:sF,[oB.circularProgress]:rF,[oB.link]:aF,[oB.dot]:oF,[oB.wordCloud]:lF,[oB.wordCloud3d]:lF,[oB.funnel]:hF,[oB.funnel3d]:cF,[oB.linearProgress]:dF,[oB.waterfall]:uF,[oB.boxPlot]:pF,[oB.treemap]:gF,[oB.sankey]:mF,[oB.gauge]:fF,[oB.gaugePointer]:vF,[oB.sunburst]:_F,[oB.rangeColumn]:yF,[oB.rangeColumn3d]:bF,[oB.circlePacking]:xF,[oB.heatmap]:SF,[oB.correlation]:AF,[oB.rangeArea]:kF,[oB.liquid]:MF,[oB.venn]:TF};function EF(t){var e,i;const{type:s}=t;return s===oB.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}const PF={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},BF={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function RF(t,e){var i;if(!t)return[];const s=zF(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?FF(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>DF(i)?OF(t,i,e):i)).filter(p)}))):i.map((i=>DF(i)?OF(t,i,e):i)).filter(p):[]}return[]}function LF(t,e){var i,s;return FF(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 OF(t,e,i){var s;const n=zF(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=PF[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=BF[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 IF=(t,e,i)=>{if(e&&DF(t)){const s=OF(e,t,i);if(s)return s}return t};function DF(t){return t&&"palette"===t.type&&!!t.key}function FF(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function jF(t){return y(t)?{dataScheme:t}:t}function zF(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=EF(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 HF extends sC{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(!FF(this._range))return void super.range(this._range);const t=LF(this._range,this._domain);super.range(t)}}const VF={linear:TC,band:rC,point:class extends rC{constructor(t){super(!1),this.type=Pw.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:sC,threshold:BC,colorOrdinal:HF};function NF(t){const e=VF[t];return e?new e:null}function GF(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 WF(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function UF(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function YF(t){return!!_(t)&&(!!t.endsWith("%")&&nb(t.substring(0,t.length-1)))}function KF(t,e,i,s=0){var n,r;return S(t)?t:YF(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 XF(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]=KF(t[s],e.size,i)}))})),o}function $F(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)||YF(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 qF(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const ZF=(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},JF=[{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"]}],QF={default:{dataScheme:JF,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"}}},tj="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",ej={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:tj,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:tj,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:CB,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"}}}}},ij={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}}},sj=Object.assign(Object.assign({},ij),{label:{space:0}}),nj={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}}}}},rj="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;",aj={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:rj,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:rj,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}}}},oj={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}},lj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}},hj={horizontal:Object.assign(Object.assign({},oj),{rail:{width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:lj}),vertical:Object.assign(Object.assign({},oj),{rail:{width:8,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:lj})},cj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}},dj={horizontal:Object.assign(Object.assign({},oj),{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:cj}),vertical:Object.assign(Object.assign({},oj),{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:cj})},uj={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"}}}}},pj={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"}}}}},gj={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 mj(t,e){return t&&e.key in t?t[e.key]:e.default}function fj(t){return t&&"token"===t.type&&!!t.key}const vj={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%"},_j={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:QF,token:vj,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:ej,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},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:hj,sizeLegend:dj,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:ij,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:sj,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:pj,markArea:uj,markPoint:gj,polarMarkLine:pj,polarMarkArea:uj,polarMarkPoint:gj,geoMarkPoint:gj,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",textAlign:"left",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"},textAlign:"left",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:aj,crosshair:nj,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},yj={name:"dark",colorScheme:{default:{dataScheme:JF,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"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},bj=(t,e)=>t===e||!d(t)&&!d(e)&&(y(t)&&y(e)?e.every((e=>t.some((t=>bj(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>bj(t[i],e[i])))),xj=(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]={}),xj(t[s],e.slice(1),i))};function Sj(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]=Sj(n,e)}return s}function Aj(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])?kj(t,e,r,i):Mj(t,r,s[r])}}}}function kj(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?Tj({},t[n][e.index],i):i):t[n]=s?Tj({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?Tj({},t[n][r],i):i)}else t.id===e&&(t[n]=s?Tj({},t[n],i):i)}))}function Cj(t,...e){return Tj(Ej(t),...e.map(Ej))}function Ej(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]=jF(s),e}),{}));return t}(t.colorScheme),{series:s}=t,{mark:n,markByName:r}=t;let a;return(n||r)&&(a=Object.keys(CF).reduce(((t,e)=>{var i;const a=null!==(i=null==s?void 0:s[e])&&void 0!==i?i:{};return t[e]=Pj(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 Pj(t,e,i,s){if(!CF[e])return t;const n={};return Object.values(CF[e]).forEach((({type:e,name:r})=>{n[r]=Tj({},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 Bj=["animationThreshold","colorScheme","name","padding"];function Rj(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];Bj.includes(r)?n[r]=a:f(a)?DF(a)?n[r]=IF(a,e,s):fj(a)?n[r]=mj(i,a):n[r]=Rj(a,e,i,s):n[r]=a})),n}const Lj={[_j.name]:_j},Oj=_j.name,Ij=new Map(Object.keys(Lj).map((t=>[t,Lj[t]]))),Dj=new Map(Object.keys(Lj).map((t=>[t,Rj(Lj[t])]))),Fj=new Map(Object.keys(Lj).map((t=>[t,t===Oj]))),jj=(t,e)=>{if(!t)return;const i=Nj(e);Ij.set(t,i),Dj.set(t,Rj(i)),Fj.set(t,!0)},zj=(t=Oj,e=!1)=>(Fj.has(t)&&!Fj.get(t)&&jj(t,Ij.get(t)),e?Dj.get(t):Ij.get(t)),Hj=t=>Ij.delete(t)&&Dj.delete(t)&&Fj.delete(t),Vj=t=>!!_(t)&&Ij.has(t),Nj=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:Oj;return Cj({},zj(i),t)};class Gj{static registerInstance(t){Gj.instances.set(t.id,t)}static unregisterInstance(t){Gj.instances.delete(t.id)}static getInstance(t){return Gj.instances.get(t)}static instanceExist(t){return Gj.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return Gj.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}Gj.instances=new Map;class Wj{static registerTheme(t,e){jj(t,e)}static getTheme(t,e=!1){return zj(t,e)}static removeTheme(t){return Hj(t)}static themeExist(t){return Vj(t)}static getDefaultTheme(){return Wj.themes.get(Oj)}static setCurrentTheme(t){Wj.themeExist(t)&&(Wj._currentThemeName=t,Gj.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return Wj.getTheme(Wj._currentThemeName,t)}static getCurrentThemeName(){return Wj._currentThemeName}}function Uj(t,e){return _(t)?Wj.themeExist(t)?Wj.getTheme(t,e):{}:g(t)?t:{}}function Yj(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]=Yj(t[s],e)}return i}return y(t)?t.map((t=>Yj(t,e))):t}function Kj(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]=Kj(t[s],e)}return i}return y(t)?t.map((t=>Kj(t,e))):t}Wj.themes=Ij,Wj._currentThemeName=Oj;function Xj(t,e){for(let i=0;it.key===e))}function qj(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 Zj(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:{}},iz(t,a,n[o],l,e,r))})),s?Jj(n):n}function Jj(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))):Jj(t[e].nodes);return t}function Qj(t,e){if("values"in t&&t.values.length){const i=JP(t.values,e),s=ZP(t.values,wD);t.values.forEach((t=>{t[PD]=i,t[BD]=s,delete t[RD]}));const n=t.values.reduce(((t,e)=>e[MD]>t[MD]?e:t));n[RD]=!0}else for(const i in t.nodes)Qj(t.nodes[i],e)}function tz(t){if(!t.values.length)return;const e=t.values[t.values.length-1][MD]/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[kD]=s,s+=r[MD],r[MD]=s):(r[kD]=n,n+=r[MD],r[MD]=n),r[AD]=t.key}if(i)for(let i=0;i=0?s:n;r=a>=0?1:-1,l[TD]=0===h?0:Math.min(1,l[kD]/h)*r,l[wD]=0===h?0:Math.min(1,l[MD]/h)*r}}for(const s in t.nodes)ez(t.nodes[s],e,i)}function iz(t,e,i,s,n,r,a){if("values"in e)if(n&&e.values.forEach((t=>t[MD]=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}),iz(t,e.nodes[o],i.nodes[o],s,n,r,l)}}const sz=(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]=rz(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function az(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>lz(t.style(e,i,s,n)):B(t.style)||(e.style=lz(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>lz(t.state[e](i,s,n,r)):B(t.state[e])||(i[e]=lz(t.state[e]))})),e.state=i}return e}function oz(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>lz(t[i](e,s,n,r)):B(t[i])||(e[i]=lz(t[i]))})),e}function lz(t){return(null==t?void 0:t.angle)&&(t.angle=te(t.angle)),t}class hz{static registerChart(t,e){hz._charts[t]=e}static registerSeries(t,e){hz._series[t]=e}static registerComponent(t,e,i){hz._components[t]={cmp:e,alwaysCheck:i}}static registerMark(t,e){hz._marks[t]=e}static registerRegion(t,e){hz._regions[t]=e}static registerTransform(t,e){hz.transforms[t]=e}static registerLayout(t,e){hz._layout[t]=e}static registerAnimation(t,e){hz._animations[t]=e}static registerImplement(t,e){hz._implements[t]=e}static registerChartPlugin(t,e){hz._chartPlugin[t]=e}static registerComponentPlugin(t,e){hz._componentPlugin[t]=e}static createChart(t,e,i){if(!hz._charts[t])return null;return new(0,hz._charts[t])(e,i)}static createChartSpecTransformer(t,e){if(!hz._charts[t])return null;const i=hz._charts[t];return new(0,i.transformerConstructor)(Object.assign({seriesType:i.seriesType},e))}static createRegion(t,e,i){if(!hz._regions[t])return null;return new(0,hz._regions[t])(e,i)}static createRegionSpecTransformer(t,e){if(!hz._regions[t])return null;return new(0,hz._regions[t].transformerConstructor)(e)}static createSeries(t,e,i){if(!hz._series[t])return null;return new(0,hz._series[t])(e,i)}static createSeriesSpecTransformer(t,e){if(!hz._series[t])return null;return new(0,hz._series[t].transformerConstructor)(e)}static createMark(t,e,i){if(!hz._marks[t])return null;const s=new(0,hz._marks[t])(e,i);return"group"===s.type&&s.setInteractive(!1),s}static getComponents(){return Object.values(hz._components)}static getComponentInKey(t){return hz._components[t].cmp}static getLayout(){return Object.values(hz._layout)}static getLayoutInKey(t){return hz._layout[t]}static getSeries(){return Object.values(hz._series)}static getSeriesInType(t){return hz._series[t]}static getRegionInType(t){return hz._regions[t]}static getAnimationInKey(t){return hz._animations[t]}static getImplementInKey(t){return hz._implements[t]}static getSeriesMarkMap(t){return hz._series[t]?hz._series[t].mark:{}}static getChartPlugins(){return Object.values(hz._chartPlugin)}static getComponentPlugins(){return Object.values(hz._componentPlugin)}static getComponentPluginInType(t){return hz._componentPlugin[t]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}}hz._charts={},hz._series={},hz._components={},hz._marks={},hz._regions={},hz._animations={},hz._implements={},hz._chartPlugin={},hz._componentPlugin={},hz.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}},hz.dataParser={csv:Yr,dsv:Ur,tsv:Kr},hz._layout={};const cz=(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))},dz=(t,e,i,s)=>{var n;const r=jw(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:uz(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("_")}`,pz=(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},gz=(t,e)=>{if(!t)return null;if(!rB(t.getRegionsInIndex(),"polar"))return null;const{x:i,y:s}=e,n=pz(t,(t=>"angle"===t.getOrient()),e),r=pz(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&&jw(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=eB({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=iB(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=dz(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&&jw(r.type)){const h=t.getCenter(),c={x:i-t.getLayoutStartPoint().x-h.x,y:s-t.getLayoutStartPoint().y-h.y};let d=eB({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=iB(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 _=dz(f,t,"polar",o);a.push({index:v,value:f,position:r.scale(f),axis:t,data:_})}})),a.length?a:null};function mz(t){return"bottom"===t||"top"===t}function fz(t){return"left"===t||"right"===t}function vz(t){return"z"===t}function _z(t,e){return UF(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function yz(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function bz(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?mz(t)?"linear":"band":mz(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const xz=t=>t.fieldX[0],Sz=t=>t.fieldY[0],Az=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},kz=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},Mz=(t,e)=>t?e?xz:Az:e?Sz:kz,Tz=(t,e,i)=>{var s,n;if(!t)return null;if(!rB(t.getRegionsInIndex(),"cartesian"))return null;const{x:r,y:a}=e,o=null!==(s=pz(t,(t=>mz(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=pz(t,(t=>fz(t.getOrient())),e))&&void 0!==n?n:[],h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{jw(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=wz(s,i,t,Mz(e,jw(s.getScale().type)));n&&u.push(n)}}else{const n=h.size>0;if((n?h:c).has(s)){const r=wz(s,i,t,Mz(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},wz=(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 Cz(t,a,s)},Cz=(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=dz(e,t,"cartesian",null!=i?i:mz(t.getOrient())?xz:Sz);return{index:n,value:e,position:s.scale(e),axis:t,data:r}};class Ez{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:$y)("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:$y)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s;const n=null!==(i=Tz(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(s=gz(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=>jw(t.getScale().type))),r=n.length?n:s.filter((t=>{const e=t.getOrient();return mz(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=Cz(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var Pz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Pz||(Pz={}));const Bz={[Pz.dimensionHover]:class extends Ez{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)=>!cz(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}),tb(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}),tb(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[Pz.dimensionClick]:class extends Ez{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 Rz=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(Bz[t]){const e=new Bz[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(Bz[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}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class Lz{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}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const Oz={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 Iz{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 Lz);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}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 Oz[a]&&(a=Oz[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.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 hD.includes(e)||Object.values(t.VGRAMMAR_HOOK_EVENT).includes(e)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&kR.hasInteraction(e)}}function Dz(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function Fz(t,e,i){t.getParser(e)||t.registerParser(e,i)}const jz=new Map;let zz;function Hz(){zz||(zz=new va,Fz(zz,"geojson",da),Fz(zz,"topojson",pa),Dz(zz,"simplify",Rr))}function Vz(t,e,i={type:"geojson",centroid:!0}){jz.has(t)&&Xy(`map type of '${t}' already exists, will be overwritten.`),Hz();const s=new ya(zz),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}),jz.set(t,s)}function Nz(t){jz.has(t)?jz.delete(t):Xy(`map type of '${t}' does not exists.`)}function Gz(t,e=!1){let i=e;return t.latestData instanceof ya&&(i=!1),i?I(t.latestData):t.latestData.slice()}const Wz=(t,e)=>0===t.length?[]:1===t.length?Gz(t[0],null==e?void 0:e.deep):t.map((t=>Gz(t,null==e?void 0:e.deep)));function Uz(t,e,i){Dz(e=e instanceof va?e:t.dataSet,"copyDataView",Wz);const s=new ya(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:Xz.copyDataView}),s}function Yz(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:$y)(`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:$y)(`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([]),Xy("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 Kz(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var Xz;!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"}(Xz||(Xz={}));const $z=(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 uO(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:tH(this._option.mode),autoFit:!1,eventConfig:{gesture:tb(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())}clear(t,e=!1){const{chart:i}=t;i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=P_.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this._nextRafId&&(P_.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null),this._isRunning||(this.initView(),this._view&&(this._isRunning=!0,null===(e=this._view)||void 0===e||e.run(t),this._isRunning=!1,this._nextRafId&&(P_.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,this._isRunning=!0,null===(i=this._view)||void 0===i||i.run(t),this._isRunning=!1))))}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.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 Qy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function iH(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:$y)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function sH(t){t.crosshair=Y(t.crosshair||{}).map((e=>Tj({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function nH(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&&Qy(e.mode)){let t;t=_(h)?null===document||void 0===document?void 0:document.getElementById(h):h;const{width:e,height:s}=ii(t,i.width,i.height);a=e,o=s}else if(eb(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 rH(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")}),t}function aH(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"}(Jz||(Jz={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(Qz||(Qz={}));class oH{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({},oH.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]))))}}oH.defaultMarkInfo={};class lH{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new oH,this._markReverse=new oH,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement(Jz.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement(Jz.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement(Jz.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement(Jz.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement(Jz.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(Jz.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[Jz.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[Jz.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(Pz.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 hH={};Object.values(Jz).forEach((t=>{hH[t]=!0}));const cH={[Jz.STATE_HOVER]:Jz.STATE_HOVER_REVERSE,[Jz.STATE_SELECTED]:Jz.STATE_SELECTED_REVERSE,[Jz.STATE_DIMENSION_HOVER]:Jz.STATE_DIMENSION_HOVER_REVERSE};function dH(t){return cH[t]}class uH{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=dH(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=dH(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=dH(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=dH(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 pH{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 gH extends pH{constructor(){super(...arguments),this.id=sb(),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 mH extends gH{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,s){super(t),this.grammarType=Zz.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 fH extends pH{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 mH(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 vH extends fH{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 _H extends vH{constructor(){super(...arguments),this.id=sb(),this.stateKeyToSignalName=t=>`${hB}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===qz.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===qz.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?qz.none:qz.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?qz.exit:qz.appear}}}}class yH{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=>Tj({},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 bH extends pH{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=yH,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new oH,this._lastLayoutRect=null,this.id=sb(),this.userId=t.id,this._spec=t,this.effect={},this.event=new Rz(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=`${hB}_${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=hz.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 xH{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=XF($F(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:KF(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:KF(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:KF(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:KF(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:KF(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:KF(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=KF(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=KF(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]=KF(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 SH extends bH{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 xH(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 AH extends yH{_initTheme(t,e){return{spec:t,theme:this._theme}}}class kH extends SH{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=AH,this.modelType="region",this.specKey="region",this.type=kH.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.interaction=new uH,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 _H({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 lH(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 Qz)B(t.stateStyle[Qz[e]])||this.interaction.registerMark(Qz[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 MH(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 TH(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 wH(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 CH(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),wH(c,!0,u,o),s&&TH(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function EH(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),wH(c,!1,u,a),s&&TH(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function BH(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}=MH(t);s.length&&CH(s,e,i,!1,"left"),n.length&&CH(n,e,i,!0,"left"),r.length&&EH(r,e,0,"left")}(e,this,a),s.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=MH(t);s.length&&PH(s,e,i,!1,"top"),n.length&&PH(n,e,i,!0,"top"),r.length&&BH(r,e,0,"top")}(s,this,r),i.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=MH(t);s.length&&CH(s,e,i,!1,"right"),n.length&&CH(n,e,i,!0,"right"),r.length&&EH(r,e,0,"right")}(i,this,a),n.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=MH(t);s.length&&PH(s,e,i,!1,"bottom"),n.length&&PH(n,e,i,!0,"bottom"),r.length&&BH(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:$y)("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}}}RH.type="base";const LH=["line","area","trail"];function OH(t){return LH.includes(t)}class IH extends vH{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(OH)?s:!t.mark||OH(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=>!!hH[t])).map((t=>[t,10])),s=!t.mark||OH(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(hB)));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(hB)));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(Dw(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 DH extends gH{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=Zz.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 FH extends DH{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${hB}_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 jH extends gH{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=Zz.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 IH(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 Rz(s.getOption().eventDispatcher,s.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new FH(t)}stateKeyToSignalName(t){return`${hB}_${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=Jz.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=Jz.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===qz.appear&&this.runAnimationByState(qz.normal)})):this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,(()=>{this.runAnimationByState(qz.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),this._morph&&this._morphKey&&(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 zH extends jH{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].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))}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&&Tj(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(Fw(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=NF(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()):FD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Fw(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=LF(RF(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({},VD[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)FD.includes(null===(o=n.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(n.stroke)(t,e));else{const e=LF(RF(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 HH extends zH{constructor(){super(...arguments),this.type=HH.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)?(Xy("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?(Xy("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})}))}}HH.type="group";const VH=()=>{fM(),iM(),kR.registerGraphic(RB.group,ku),hz.registerMark(HH.type,HH)},NH={type:"clipIn"},GH={type:"fadeIn"};function WH(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 GH;default:return NH}}const UH={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"}},YH={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},KH={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},XH=()=>{hz.registerAnimation("scaleInOut",(()=>YH))},$H=()=>{hz.registerAnimation("fadeInOut",(()=>KH))},qH=(t,e)=>({appear:WH(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:Hc,duration:UH.update.duration,easing:UH.update.easing}],disappear:{type:"clipOut"}}),ZH=()=>{hz.registerAnimation("line",qH)},JH=()=>{uO.useRegisters([UI,YI,KI,XI,$I,qI,II,DI])},QH={measureText:(t,e,i,s)=>((t,e,i)=>GM(t,e,i,{fontFamily:vj.fontFamily,fontSize:vj.fontSize}))(e,i,s).measure(t)};class tV{static instance(){return tV.instance_||(tV.instance_=new tV),tV.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 eV{constructor(){this.id=sb(),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))?Xy("不要重复添加相同的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 iV extends eV{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 sV{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>hz.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>hz.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>hz.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return hz.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>hz.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){hz.registerTransform(t,e)}static registerFunction(t,e){t&&e&&tV.instance().registerFunction(t,e)}static unregisterFunction(t){t&&tV.instance().unregisterFunction(t)}static getFunction(t){return t?tV.instance().getFunction(t):null}static getFunctionList(){return tV.instance().getFunctionNameList()}static registerMap(t,e,i){const s=hz.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=hz.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,jz.get(e);var e}static hideTooltip(t=[]){Gj.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,c;this.id=sb(),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 d=this._option,{dom:u,renderCanvas:p,mode:g,stage:m,poptip:f}=d,v=e(d,["dom","renderCanvas","mode","stage","poptip"]),y=Qy(g);y&&u&&(this._container=_(u)?null===document||void 0===document?void 0:document.getElementById(u):u),p&&(this._canvas=p),m&&(this._stage=m),"node"===g||this._container||this._canvas||this._stage?(y?Cx(ql):"node"===g&&TA(ql),this._viewBox=this._option.viewBox,this._currentThemeName=Wj.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new eH({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:p},Object.assign(Object.assign({mode:this._option.mode,stage:m,pluginList:!1!==f?["poptipForText"]:[]},v),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new Iz(this,this._compiler),this._event=new Rz(this._eventDispatcher,g),this._compiler.initView(),null===(o=this.getStage())||void 0===o||o.setTheme({text:{fontFamily:null===(l=this._currentTheme)||void 0===l?void 0:l.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!y&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),Gj.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=Tj({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=Yj(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;sV.getFunctionList()&&sV.getFunctionList().length&&(t=Kj(t,sV)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=hz.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=hz.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=hz.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 nH(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:cB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:dB})}_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,Fz(this._dataSet,"dataview",ga),Fz(this._dataSet,"array",s),Dz(this._dataSet,"stackSplit",$z),Dz(this._dataSet,"copyDataView",Wz);for(const t in hz.transforms)Dz(this._dataSet,t,hz.transforms[t]);for(const t in hz.dataParser)Fz(this._dataSet,t,hz.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),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;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,null===(s=this._compiler)||void 0===s||s.releaseGrammar(!1===(null===(n=this._option)||void 0===n?void 0:n.animation)||!1===(null===(r=this._spec)||void 0===r?void 0:r.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.reCompile&&(null===(a=this._compiler)||void 0===a||a.clear({chart:this._chart,vChart:this},!this._option.animation||!this._spec.animation),null===(o=this._compiler)||void 0===o||o.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(){var t,e;this._option.animation&&(null===(t=this._chart)||void 0===t||t.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(qz.update,!0)})),null===(e=this._chart)||void 0===e||e.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(qz.update,!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,Gj.unregisterInstance(this)}updateData(t,e,s){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s)}))}_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){return u(this._dataSet)?this:this._chart?(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){if(this._chart)return this._chart.updateFullData(t),e&&this._compiler.render(),this;const i=Y(this._spec.data);return Y(t).forEach((t=>{var e;const{id:s,values:n,parser:r,fields:a}=t,o=i.find((t=>t.name===s));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 s=Yz(t,this._dataSet,i,{onError:null===(e=this._option)||void 0===e?void 0:e.onError});y(this._spec.data)&&this._spec.data.push(s)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i){const s=this._updateSpec(t,e);return s?(this.updateCustomConfigAndRerender(s,!0,{morphConfig:i,transformSpec:s.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){var i,s;const n=this._spec;if(!this._setNewSpec(t,e))return;G(n.theme,this._spec.theme)||this._setCurrentTheme();const r=this._shouldChartResize(n);return null===(s=null===(i=this._compiler)||void 0===i?void 0:i.getVGrammarView())||void 0===s||s.updateLayoutTag(),this._spec.type!==n.type?{reTransformSpec:!0,change:!0,reMake:!0,reCompile:!1,reSize:r}:(this._initChartSpec(this._spec,"render"),rH(this._chart.updateSpec(this._spec),{reTransformSpec:!1,change:r,reMake:!1,reCompile:!1,reSize:r}))}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)||wj(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)||wj(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=Tj({},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=Uj(this._currentThemeName,!0);else if(_(s)&&(!n||_(n))||_(n)&&(!s||_(s))){const t=Cj({},Uj(this._currentThemeName,!0),Uj(s,!0),Uj(n,!0));this._currentTheme=t}else{const t=Cj({},Uj(this._currentThemeName),Uj(s),Uj(n));this._currentTheme=Rj(t)}var r;r=R(this._currentTheme,"component.poptip"),z(eT.poptip,tT,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=!!Qy(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?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return Uj(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){if(!Wj.themeExist(t))return this;const e=this._setCurrentTheme(t);return yield this.updateCustomConfigAndRerender(e,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){if(!Wj.themeExist(t))return this;const e=this._setCurrentTheme(t);return this.updateCustomConfigAndRerender(e,!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}}_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 iH(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(!Qy(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)?null===document||void 0===document?void 0:document.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?qF(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 Xy("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?qF(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Xy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return tV.instance().getFunction(t)}registerFunction(t,e){t&&e&&tV.instance().registerFunction(t,e)}unregisterFunction(t){t&&tV.instance().unregisterFunction(t)}getFunctionList(){return tV.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}_initChartPlugin(){const t=hz.getChartPlugins();t.length>0&&(this._chartPlugin=new iV(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}}}sV.InstanceManager=Gj,sV.ThemeManager=Wj,sV.globalConfig={uniqueTooltip:!0},sV.Utils=QH,sV.vglobal=P_;hz.registerRegion("region",kH),hz.registerLayout("base",RH),VH(),uO.useRegisters([tI,eI]),uO.useRegisters([sD,nD,FI,jI,eD,iD,rD,aD,oD]),UR(),WR(),jj(yj.name,yj),at.getInstance(rt.Error);const nV=(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(oB).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=hz.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=hz.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},rV=(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=nV(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):bj(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const m=Tj({},i),f=d(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:Tj(m,f),hasChanged:!0};const i=Tj({},t,f);xj(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 aV{constructor(t){this.id=sb(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}const oV=t=>{hz.registerChartPlugin(t.type,t)};class lV extends aV{constructor(){super(lV.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[lV.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[lV.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=Sj(this._option.globalInstance.getSpec(),["data",lV.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=Sj(this._baseChartSpec,["data",lV.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=rV(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=Sj(i,["data",lV.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()}}lV.pluginType="chart",lV.specKey="media",lV.type="MediaQueryPlugin";const hV=/\{([^}]+)\}/,cV=/\{([^}]+)\}/g,dV=/:/;class uV extends aV{constructor(){super(uV.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[uV.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)),hz.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=hV.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(cV,((t,i)=>{if(!dV.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}}uV.pluginType="chart",uV.specKey="formatter",uV.type="formatterPlugin";const pV=()=>{oV(uV)};function gV(t){return 2===t.length&&k(t[0])&&k(t[1])&&t[1]>=t[0]}function mV(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 fV(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 vV(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 _V(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 yV(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 bV=(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 RC(v)};class xV extends aV{constructor(){super(xV.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!Dw(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&&gV(c)&&gV(d)))return;const u=mV(t,c),p=mV(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(!vV(u,p))return}else if(0===y&&0===b){if(!vV(p,u))return}else if(_||A)if(_&&!A){if(!fV(u,p))return}else if(A&&!_){if(!fV(p,u))return}else{if(m===b)return;if(m>b){if(!_V(u,p))return}else if(!_V(p,u))return}else{if(0===m&&0===y){if(!yV(u,p))return}else if(0===b&&0===g&&!yV(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){Dz(e.getOption().dataSet,"tickAlign",bV);const t={targetAxis:()=>s,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}xV.pluginType="component",xV.type="AxisSyncPlugin";const SV=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,AV=(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},mm||(mm=pm.CreateGraphic("richtext",{})),mm.setAttributes(a),mm.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}},kV="vchart-tooltip-container",MV={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}};function TV(t,e){return R(e,`component.${t}`)}function wV(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=hz.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const CV={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function EV(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 PV(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 BV(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function RV(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}const LV=(t,e,i)=>{var s;const n=null!==(s="band"===e?TV("axisBand",i):["linear","log","symlog"].includes(e)?TV("axisLinear",i):{})&&void 0!==s?s:{},r=mz(t)?TV("axisX",i):fz(t)?TV("axisY",i):TV("axisZ",i);return Tj({},TV("axis",i),n,r)},OV=(t,e,i)=>{var s;const n=null!==(s="band"===e?TV("axisBand",i):"linear"===e?TV("axisLinear",i):{})&&void 0!==s?s:{},r=TV("angle"===t?"axisAngle":"axisRadius",i);return Tj({},TV("axis",i),n,r)},IV=t=>"band"===t||"ordinal"===t||"point"===t;function DV(t,e){return{id:t,label:t,value:e,rawValue:t}}function FV(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 jV(t,e,i,s){let n=0,r=t.length-1;for(;n<=r;){const a=Math.floor((n+r)/2),o=t[a];if(o[i]<=e&&o[s||i]>=e)return o;o[i]>e?r=a-1:n=a+1}return null}const zV=(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(jw(a.type))A=a.bandwidth(),0===A&&a.step&&(M=a.step());else if(Dw(a.type)){const s=e.fieldX[0],r=e.fieldX2,a=jV(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=EV(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(jw(r.type))k=r.bandwidth(),0===k&&r.step&&(T=r.step());else if(Dw(r.type)){const s=e.fieldY[0],r=e.fieldY2,a=jV(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=EV(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(VV(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&&HV(t,"top",r.label),e.visible&&HV(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(VV(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&&HV(t,"left",a.label),e.visible&&HV(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}},HV=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=wV(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},VV=(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)}))}))},NV=(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=WV(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},GV=(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=WV(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},WV=(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},UV=(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},YV={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"]},KV=(t,e)=>{var i,s;return null!==(s=null===(i=YV[t])||void 0===i?void 0:i[0])&&void 0!==s?s:e},XV=(t,e)=>{var i,s;return null!==(s=null===(i=YV[t])||void 0===i?void 0:i[1])&&void 0!==s?s:e},$V=(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}=zV(3,e,i,s,n,r,a);return o?NV(r,o,d,h):l?GV(a,l,u,c):void 0},qV={fontFamily:vj.fontFamily,spacing:10,wordBreak:"break-word"};function ZV(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:qV),{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 JV=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},QV=(t,e)=>p(e)?t.map((t=>e[t])):void 0,tN=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),eN=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function iN(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=sN(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=>tN(i,s)(t)&&tN(n,r)(t)&&(u(a)||tN([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 sV.globalConfig.uniqueTooltip&&sV.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 sV.globalConfig.uniqueTooltip&&sV.hideTooltip(u.id),d}return"none"}const sN=(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=QV(c,t);let _=QV(d,t);const y=eN(_),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(tN(c,v));if(!y&&(_=QV(d,i),!eN(_)))return;const n=e.type===oB.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=jw(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(tN(c,n));f.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=QV(d,o),!eN(_))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(tN(c,n));if(!y&&(_=QV(d,r),!eN(_)))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===oB.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(tN(c,v))).find((t=>t[g]===m));f.forEach((n=>{if(_=QV(d,i),!eN(_))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},nN=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 rN=(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 aN{constructor(){this.activeTriggerSet={mark:new Set,dimension:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set,dimension:new Set,group:new Set}}}class oN extends aN{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:hN(e.title,{seriesId:this.series.id},!0),content:cN(e.content,{seriesId:this.series.id},!0)}))})),this.spec=a,this.activeType=nN(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 lN=(t,e,i)=>{const s=d(e)?e(t):e;return i?Object.assign(Object.assign({},t),s):Object.assign(Object.assign({},s),t)},hN=(t,e,i)=>p(t)?d(t)?(...s)=>lN(t(...s),e,i):lN(t,e,i):void 0,cN=(t,e,i)=>{const s=p(t)?Y(t).map((t=>d(t)?(...s)=>Y(t(...s)).map((t=>lN(t,e,i))):lN(t,e,i))):void 0;return s},dN=(t,e,i)=>{var s;let n={};switch(t){case"mark":case"group":e&&(n=null!==(s=rN(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=rN(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},uN=(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=pN(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)&&nN(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},pN=ft((t=>t.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(p))),[]))),gN=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},mN=(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}=wV(void 0,s,t,e);i&&r&&(n=i(...r))}return n},vN=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;class _N{}_N.dom=`${hB}_TOOLTIP_HANDLER_DOM`,_N.canvas=`${hB}_TOOLTIP_HANDLER_CANVAS`;const yN=20,bN={key:"其他",value:"..."},xN=(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)},SN=(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=vN(t.title,e,i),{visible:h,value:c,valueTimeFormat:p,valueTimeFormatMode:g,valueStyle:m,hasShape:f,valueFormatter:v}=null!=l?l:{},_=!1!==fN(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:xN(fN(c,t,i,v),p,g),valueStyle:fN(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=yN}=t,x=t.othersLine?Object.assign(Object.assign({},bN),t.othersLine):bN,S=t=>{if(null==t?void 0:t.length)for(const e of t)for(const t of null!=y?y:[]){const s=AN(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=AN(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},AN=(t,e,i)=>{const s=xN(fN(e.key,t,i,e.keyFormatter),e.keyTimeFormat,e.keyTimeFormatMode),n=xN(fN(e.value,t,i,e.valueFormatter),e.valueTimeFormat,e.valueTimeFormatMode),r=!1!==fN(e.visible,t,i)&&(p(s)||p(n)),a=fN(e.isKeyAdaptive,t,i),o=fN(e.spaceRow,t,i),l=fN(e.shapeType,t,i),h=fN(e.shapeColor,t,i),c=fN(e.shapeFill,t,i),d=fN(e.shapeStroke,t,i),u=fN(e.shapeLineWidth,t,i),g=fN(e.shapeHollow,t,i),m=fN(e.keyStyle,t,i),f=fN(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 kN extends aV{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=vN(x.position,b,e),M=null!==(n=vN(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:cB,R=null!==(o=null==P?void 0:P.height)&&void 0!==o?o:dB;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(Qy(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=SV(t,e),j=SV(T,D)}}else O.width=B,O.height=R;const z=j/F;let H,V,N,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=$V(e.dimensionInfo,rB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.x,a=t.end.x)}else W=t;if(L)switch(KV(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=$V(e.dimensionInfo,rB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.y,a=t.end.y)}else U=t;if(L)switch(XV(t)){case"top":V=r-C*z-_;break;case"bottom":V=a+_;break;case"center":V=(r+a)/2-C*z/2;break;case"centerTop":V=(r+a)/2-C*z-_;break;case"centerBottom":V=(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=UV(t,c),V=UV(i,c),N=UV(e,c),G=UV(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=UV(t,c):Y(t),S(e)||d(e)?V=UV(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(N))$=B-w*z-N;else{const t=Z;switch(KV(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(V))q=V;else if(k(G))q=R-C*z-G;else{const t=J;switch(XV(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,Qy(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"===KV(A,"right")?$+=v+w/2:$+=2*v+w)},at=()=>{et()&&($=-D.x/j)},ot=()=>{it()&&(L?$=(Q-D.x)/j-w:"center"===KV(A,"right")?$-=v+w/2:$-=2*v+w)},lt=()=>{it()&&($=(Q-D.x)/j-w)},ht=()=>{st()&&(L?q=-D.y/j:"center"===XV(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"===XV(A,"bottom")?q-=_+C/2:q-=2*_+C)},ut=()=>{nt()&&(q=(tt-D.y)/j-C)};switch(KV(A,"right")){case"center":case"centerLeft":case"centerRight":et()?(rt(),lt()):(ot(),at());break;case"left":rt(),lt();break;case"right":ot(),at()}switch(XV(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({},MV),{offsetX:null!==(t=null==i?void 0:i.x)&&void 0!==t?t:MV.offsetX,offsetY:null!==(e=null==i?void 0:i.y)&&void 0!==e?e:MV.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:_}=l,y=ei(d.padding),b=$F(d.padding),x=ZV(u,i),S=ZV(m,i),A=ZV(f,i),k={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},M={panel:JV(d),padding:y,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,maxContentHeight:_,enterable:h,transitionDuration:c},{title:T={},content:w=[]}=t;let C=b.left+b.right,E=b.top+b.bottom,P=b.top+b.bottom,B=0;const R=w.filter((t=>(t.key||t.value)&&!1!==t.visible)),L=!!R.length;let O=0,I=0,D=0,F=0;if(L){const t=[],e=[],i=[],s=[];let n=0;M.content=R.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:M,shapeColor:T}=r,w={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=Tj({},S,ZV(b,void 0,{})),{width:s,height:n,text:r}=AV(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=Tj({},A,ZV(x,void 0,{})),{width:e,height:s,text:n}=AV(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;M?t.stroke=e:t.fill=e,t.stroke=null!=u?u:e,t.lineWidth=g,w.shape=t;const i=null!=m?m:k.size;o=Math.max(i,o),s.push(i)}else w.shape={visible:!1};return w.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(V){U=Tj({},x,ZV(G,void 0,{})),Y()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:L?Math.ceil(B):void 0);const{text:t,width:e,height:i}=AV(N,U);M.title.value=Object.assign(Object.assign({width:Y()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),j=M.title.value.width,z=M.title.value.height,H=z+(L?M.title.spaceRow:0)}return E+=H,P+=H,M.title.width=j,M.title.height=z,Y()?C+=B||j:C+=Math.max(j,B),L&&M.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=C-b.left-b.right-F-O-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),M.valueWidth=Math.max(M.valueWidth,i.width))})),M.panel.width=C,M.panel.height=E,M.panelDomHeight=P,M})(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(Qy(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=SV(t,s),u=SV(l,c)}return s*=d,n*=d,Qy(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()}}kN.specKey="tooltip";const MN=(t,e)=>p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",TN=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 wN;const CN=(t=document.body)=>{if(u(wN)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),wN=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return wN};function EN(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}=null!=t?t:{},{fill:m,shadow:f,shadowBlur:v,shadowColor:_,shadowOffsetX:y,shadowOffsetY:b,shadowSpread:x,cornerRadius:S,stroke:A,lineWidth:k=0,width:M=0}=n,{value:T={}}=o,{shape:w={},key:C={},value:E={}}=l,P=function(t,e){if(!t)return;const{size:i}=Tj({},e,t),s={};return s.width=MN(i),s}(w),B=PN(C),R=PN(E),{bottom:L,left:O,right:I,top:D}=$F(h);return{panel:{width:MN(M+2*k),minHeight:MN(g+2*k),paddingBottom:MN(L),paddingLeft:MN(O),paddingRight:MN(I),paddingTop:MN(D),borderColor:A,borderWidth:MN(k),borderRadius:MN(S),backgroundColor:m?`${m}`:"transparent",boxShadow:f?`${y}px ${b}px ${v}px ${x}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)?MN(null==r?void 0:r.spaceRow):"0px"},PN(Tj({},T,null==r?void 0:r.value))),content:{},shapeColumn:{common:P,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 BN.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=BN.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==Jy?void 0:Jy.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(BN.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}}BN.type="tooltipModel";const RN={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},LN={boxSizing:"border-box"},ON={display:"inline-block",verticalAlign:"top"},IN={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},DN={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},FN={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},jN={lineHeight:"normal",boxSizing:"border-box"};class zN extends BN{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,l;if(!(null==t?void 0:t.hasShape)||!t.symbolType)return"";const{symbolType:h,fill:c,stroke:d,hollow:u=!1}=t,p=t.size?e(t.size):"8px",m=t.lineWidth?e(t.lineWidth)+"px":"0px";let f="currentColor";const v=()=>d?e(d):f,y=TN(p),b=t=>new yg({symbolType:t,size:y,fill:!0});let x=b(null!==(i=HN[h])&&void 0!==i?i:h);const S=x.getParsedPath();S.path||(x=b(S.pathStr));const A=x.getParsedPath().path,k=A.toString(),M=A.bounds;let T=`${M.x1} ${M.y1} ${M.width()} ${M.height()}`;if("0px"!==m){const[t,e,i,s]=T.split(" ").map((t=>Number(t))),n=Number(m.slice(0,-2));T=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}if(!c||_(c)||u)return f=u?"none":c?e(c):"currentColor",`\n \n \n \n `;if(g(c)){f=null!==(s="gradientColor"+t.index)&&void 0!==s?s:"";let i="";const h=(null!==(n=c.stops)&&void 0!==n?n:[]).map((t=>``)).join("");return"radial"===c.gradient?i=`\n ${h}\n `:"linear"===c.gradient&&(i=`\n ${h}\n `),`\n \n ${i}\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=""}}const HN={star:"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"};class VN extends BN{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 NN={overflowWrap:"normal",wordWrap:"normal"};class GN extends BN{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(Tj({},ON,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=Tj({},o?DN:IN,Object.assign(Object.assign(Object.assign({height:MN(l)},NN),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 Tj({},FN,Object.assign(Object.assign(Object.assign({height:MN(s)},NN),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 Tj({},jN,Object.assign(Object.assign({height:MN(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 WN extends BN{init(){this.product||(this.product=this.createElement("div",["container-box"])),this.shapeBox||this._initShapeBox(),this.keyBox||this._initKeyBox(),this.valueBox||this._initValueBox()}_initShapeBox(){const t=new GN(this.product,this._option,"shape-box",0);t.init(),this.shapeBox=t,this.children[t.childIndex]=t}_initKeyBox(){const t=new GN(this.product,this._option,"key-box",1);t.init(),this.keyBox=t,this.children[t.childIndex]=t}_initValueBox(){const t=new GN(this.product,this._option,"value-box",2);t.init(),this.valueBox=t,this.children[t.childIndex]=t}setStyle(t){super.setStyle(Tj(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+TN(e)),0);return Object.assign(Object.assign({},t),{width:`${a+CN(this._option.getContainer())}px`,maxHeight:MN(s),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class UN extends BN{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{title:e}=t;(null==e?void 0:e.hasShape)&&(null==e?void 0:e.shapeType)?this.shape||this._initShape():this.shape&&this._releaseShape(),this.textSpan||this._initTextSpan()}_initShape(){const t=new zN(this.product,this._option,0);t.init(),this.shape=t,this.children[t.childIndex]=t}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(){const t=new VN(this.product,this._option,1);t.init(),this.textSpan=t,this.children[t.childIndex]=t}setStyle(t){var e,i,s,n;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),{title:o}=a;super.setStyle(Tj({},RN,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 YN="99999999999999";class KN extends BN{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:YN,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 UN(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 WN(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(Tj({},LN,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 XN=t=>{hz.registerComponentPlugin(t.type,t)};class $N extends kN{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($N.type),this.type=_N.dom,this._tooltipContainer=null==Jy?void 0:Jy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(Jy&&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=EN(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()}))}}$N.type=_N.dom;class qN extends kN{constructor(){super(qN.type),this.type=_N.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 XP({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()}}qN.type=_N.canvas;const ZN=()=>{XN(qN)},JN=(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},QN={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}},tG=(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=Xj([],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 eG(a,n,o)},eG=(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)=>{nb(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=>{nb(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]=QN[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},iG=(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=>{nb(t[e])||(t[e]=0)}))})),t};class sG extends DH{_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 nG=`${hB}_HIERARCHY_DEPTH`,rG=`${hB}_HIERARCHY_ROOT`,aG=`${hB}_HIERARCHY_ROOT_INDEX`;function oG(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function lG(t,e,i){t&&(i.needDefaultSeriesField&&(t[bD]=i.defaultSeriesField),t[_D]=e,t[yD]=i.getKey(t,e,i))}function hG(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function cG(t,e,i,s=0,n,r){void 0===r&&(r=e),lG(t,e,i),t[nG]=s,t[rG]=n||t[i.categoryField],t[aG]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>cG(e,s,i,t[nG]+1,t[rG],r)))}const dG=["appear","enter","update","exit","disappear","normal"];function uG(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 vG(n)&&delete n.type,n.oneByOne&&(n=gG(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:mG,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=Tj({},o[e],a);return vG(n)&&delete n.type,n.oneByOne&&(n=gG(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:mG,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s.state=s.update,s}function pG(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),_G(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 gG(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 mG(t,e){var i,s;return null!==(i=null==t?void 0:t[_D])&&void 0!==i?i:null===(s=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===s?void 0:s.elementIndex}function fG(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 vG(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function _G(t,e){if(y(t))t.forEach(((i,s)=>{t[s]=e(t[s],s),_G(t[s],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),_G(t[i],e)}class yG extends yH{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=EF(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=Pj(R(a,`series.${h}`),h,l,o),d=R(a,`series.${h}_${r}`);return Tj({},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),c(t.stackOffsetSilhouette)&&(this.stack=t.stackOffsetSilhouette||this.stack),p(t.stackValue)&&(this.stack=!0),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=Tj({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>Tj({},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 bG extends bH{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:`${hB}_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=yG,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=function(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)}(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)&&(Dz(this._rawData.dataSet,"invalidTravel",iG),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=Yz(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=Uz(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=Uz(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new sG(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;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){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];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):this._rawStatisticsCache[t]=eG(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t]}}return e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))&&(this._rawStatisticsCache[t].min=$(this._rawStatisticsCache[t].values),this._rawStatisticsCache[t].max=X(this._rawStatisticsCache[t].values)),this._rawStatisticsCache[t]}_statisticViewData(){Dz(this._dataSet,"dimensionStatistics",tG);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&&Xj(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){Dz(this._dataSet,"dimensionStatistics",tG);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=Xj(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&Xj(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)&&(Dz(this._rawData.dataSet,"addVChartProperty",JN),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:oG.bind(this),call:lG}},!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=uG({},pG(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"}}:tb(s)||eb(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=Tj(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=Tj(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:Jz.STATE_HOVER_REVERSE,highlightState:Jz.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:Jz.STATE_SELECTED_REVERSE,state:Jz.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 t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:bD;this.getMarksWithoutRoot().forEach((t=>{const s={},n={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(s[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{n[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:xD,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][i]]:!0===s[t[i]]});const a={};Object.keys(n).forEach((e=>{a[e]=s=>{var n,a;let o;if(Array.isArray(s)){if(0===s.length)return;o=null===(n=r[s[0][i]])||void 0===n?void 0:n[e]}return o=null===(a=r[s[i]])||void 0===a?void 0:a[e],o||t.getAttribute(e,s)}})),this.setMarkStyle(t,a,xD)}))}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 oN(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=null!=i?i:{data:!0}).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((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||Kz(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()}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:bD,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new HF).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return RF(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:bD}}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()}`),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,Tj({},h,d||a[T.name]))}return T}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:yD}_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!==MD&&t!==wD&&t!==kD&&t!==TD||(t=this.getStackValueField()),null!==(e=qj(this.getRawData(),t))&&void 0!==e?e:t}getMarkInfoList(){var t;const e=super.getMarkInfoList();return e.length?e:Object.values(null!==(t=CF[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=>nb(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:bD]}}function xG(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();Dw(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 SG(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}}}bG.mark=ND,bG.transformerConstructor=yG;class AG extends bG{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);Dw(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:`${hB}_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(MD),this.setFieldX2(kD)):(this.setFieldY(MD),this.setFieldY2(kD))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(wD),this.setFieldX2(TD)):(this.setFieldY(wD),this.setFieldY2(TD))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(ED),this.setFieldX2(CD)):(this.setFieldY(ED),this.setFieldY2(CD))}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)&&(xG("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 kG="monotone",MG="linear";class TG{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($D.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:MG,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===kG?"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($D.point,{morph:fG(this._spec,$D.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:`${hB}_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(Pz.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:Jz.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[$D.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(Pz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,Tj({},this._spec[$D.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:Jz.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 wG extends zH{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)&&(Fw(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);let c=this._styleConvert(h);a&&"angle"===l&&(c=this.convertAngleToRadian(c)),this.setAttribute(l,c,e,i,s)})),o&&this.setEnableSegments(o)}}class CG extends wG{constructor(){super(...arguments),this.type=CG.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)===oB.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}CG.type="line";const EG=()=>{hz.registerMark(CG.type,CG),fM(),aM(),kR.registerGraphic(RB.line,Ag),JH()};class PG extends zH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class BG extends PG{constructor(){super(...arguments),this.type=BG.type}}BG.type="symbol";const RG=()=>{hz.registerMark(BG.type,BG),fO()};class LG extends yG{_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 OG extends eV{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function IG(t,e,i,s){switch(t){case r.cartesianBandAxis:return LV(_z(i,["z"]),"band",e);case r.cartesianLinearAxis:return LV(_z(i,["z"]),"linear",e);case r.cartesianLogAxis:return LV(_z(i,["z"]),"log",e);case r.cartesianSymlogAxis:return LV(_z(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return LV(_z(i),void 0,e);case r.polarBandAxis:return OV(i.orient,"band",e);case r.polarLinearAxis:return OV(i.orient,"linear",e);case r.polarAxis:return OV(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=TV(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>mz(t.orient)));let d;d=p(c)?Tj({},IV(c.type)?a:o,l):l;const u=n.find((t=>fz(t.orient)));let g;return g=p(u)?Tj({},jw(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=TV(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>"angle"===t.orient));let d;d=p(c)?Tj({},IV(c.type)?a:o,l):l;const u=n.find((t=>"radius"===t.orient));let g;return g=p(u)?Tj({},jw(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 DG(i,TV(t,e));default:return TV(t,e)}}const DG=(t,e)=>{var i;const s=Tj({},e,e[yz(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class FG extends yH{getTheme(t,e){return IG(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({},$F(e)),{[s]:0}))}}class jG extends SH{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 OG(this)}constructor(e,i){super(e,i),this.name="component",this.modelType="component",this.transformerConstructor=FG,this._delegateEvent=(e,i,s,n=null,r=null)=>{var a,o;i instanceof ec||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 _H({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}}}jG.transformerConstructor=FG;class zG extends zH{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(RB.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}zG.type="component";const HG=()=>{hz.registerMark(zG.type,zG)},VG=t=>t;class NG extends jG{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()?DB.circleAxisGrid:DB.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=uG(null===(o=hz.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 DH(this._option,t)]}collectData(t,e){const i=[];return sB(this._regions,(s=>{var n;let r=this.collectSeriesField(t,s);if(r=y(r)?Dw(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 sB(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=nB(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()})),sB(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(sB(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;tthis._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=az(s=t.domainLine)).startSymbol=az(s.startSymbol),s.endSymbol=az(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 lz(Tj({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:lz(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)=>lz(t[i](e.rawValue,s,e,n,r)):B(t[i])||(e[i]=lz(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 lz(Tj({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:lz(t.tick.style)),t.tick.state&&(i.tick.state=oz(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 lz(Tj({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:lz(t.subTick.style)),t.subTick.state&&(i.subTick.state=oz(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=CV[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?te(p):null,textStyle:Tj({},d,lz(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:lz(h.style)}),h.state&&(i.title.state.shape=oz(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:lz(o.style)}),o.state&&(i.title.state.background=oz(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=oz(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=lz(t.background.style)),t.background.state&&(i.panel.state=oz(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 lz(Tj({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:lz(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:lz(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=wV(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){Fz(this._option.dataSet,"scale",VG),Dz(this._option.dataSet,"ticks",UC);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)}}NG.specKey="axes";const GG=()=>{kR.registerGraphicComponent(IB.lineAxis,((t,e)=>new Cw(t,e))),kR.registerGraphicComponent(IB.circleAxis,(t=>new Rw(t))),kR.registerComponent(LB.axis,FO),kR.registerGraphicComponent(DB.lineAxisGrid,((t,e)=>new qC(t,e))),kR.registerGraphicComponent(DB.circleAxisGrid,((t,e)=>new JC(t,e))),kR.registerComponent(LB.grid,HO),HG(),hz.registerAnimation("axis",(()=>({appear:{custom:Ow},update:{custom:Lw},exit:{custom:Wc}})))},WG=[xV];class UG extends NG{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),sB(this._regions,(t=>{const e=this.getOrient();mz(e)?t.setXAxisHelper(this.axisHelper()):fz(e)?t.setYAxisHelper(this.axisHelper()):vz(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=Tj({x:t.x,y:t.y},this._axisStyle,n);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(Tj({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=mz(this.getOrient()),n=t=>{var e;return(s?!mz(t.getOrient()):mz(t.getOrient()))&&Dw(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=_z(i,["z"]),vz(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(!BV(e))return null;const{axisType:t,componentName:s}=bz(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=>fz(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(!BV(t))return;const{axisType:s,componentName:n}=bz(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=hz.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=[];mz(this.getOrient())?k(e)&&(o=this._inverse?[e-n,s]:[s,e-n]):vz(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(WG.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){mz(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&&!mz(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),!vz(this.getOrient())&&this._spec.innerOffset){const t=this._spec;fz(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=KF(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=KF(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=mz(this.getOrient())?t.fieldX:vz(this.getOrient())?t.fieldZ:t.fieldY,Dw(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:Dw(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&&(mz(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=mz(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 sB(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]:mz(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:vz(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();sB(this._regions,(e=>{mz(t)?(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):fz(t)?(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):vz(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=mz(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=mz(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=Tj(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 DV(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}=PV(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>=YG?10:n>=KG?5:n>=XG?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 qG extends UG{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new TC}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}}qG.type=r.cartesianLinearAxis,qG.specKey="axes",U(qG,$G);const ZG=()=>{GG(),hz.registerComponent(qG.type,qG)};class JG{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=DV(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=>DV(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 QG extends UG{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new rC}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{GG(),hz.registerComponent(QG.type,QG)};class eW extends qG{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),sB(this._regions,(t=>{mz(this.getOrient())?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=Tj({},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 DH(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=>DV(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=>DV(e.value,this._getNormalizedValue([e.value],t))))),s}transformScaleDomain(){}}eW.type=r.cartesianTimeAxis,eW.specKey="axes";class iW extends qG{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new EC}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(){}}iW.type=r.cartesianLogAxis,iW.specKey="axes",U(iW,$G);class sW extends qG{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new PC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}transformScaleDomain(){}}sW.type=r.cartesianSymlogAxis,sW.specKey="axes",U(sW,$G);class nW extends AG{constructor(){super(...arguments),this.type=oB.line,this.transformerConstructor=LG,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(uG(null===(i=hz.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),pG("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=SG(this);this._symbolMark.setAnimationConfig(uG(null===(s=hz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),pG("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]}}nW.type=oB.line,nW.mark=qD,nW.transformerConstructor=LG,U(nW,TG);class rW{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)=>{Kz(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 aW{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)=>{rb(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{Xj(e,[{key:t,operations:Dw(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&&Xj(e,[{key:i.field,operations:Dw(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?NF("colorOrdinal"):NF(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(rb(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),rb(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(!rb(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=Dw(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=Dw(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;Dw(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(Dw(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=Dw(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)));Dw(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 oW{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=Zj(t,!0);for(const e in a)for(const i in a[e].nodes)ez(a[e].nodes[i],t.getStackInverse(),n);if(r)for(const t in a)for(const e in a[t].nodes)tz(a[t].nodes[e]);s&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&Qj(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 lW extends pH{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=sb(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:cB,height:dB},this._viewRect={width:cB,height:dB},this._viewBox={x1:0,y1:0,x2:cB,y2:dB},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=$F(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new Rz(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new rW(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._spec.background&&"object"==typeof this._spec.background&&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 oW(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=function(t){if(!t)return null;if("string"==typeof t)return{fill:t,fillOpacity:1};if("object"!=typeof t)return null;const e=H(t,["x","y","width","height","x1","y1","image"]);return e.background=t.image,e}(this._spec.background);t&&(this._backgroundMark=hz.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({},t),{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=hz.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 bH)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 zH))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof zH)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&&Kz(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=nH(this._spec,this._option,{width:cB,height:dB})),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=RF(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new aW(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){rH(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=RF(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{rH(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{var s,n;const r=i.specKey||i.type,a=null!==(s=this._spec[r])&&void 0!==s?s:{};y(a)?(e[r]=e[r]||{specCount:a.length,componentCount:0},e[r].componentCount++,rH(t,i.updateSpec(null!==(n=a[i.getSpecIndex()])&&void 0!==n?n:{},a))):rH(t,i.updateSpec(a))}));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()];rH(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=XF(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(Jz.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(Jz.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(Jz.STATE_SELECTED)}clearHovered(){this.clearState(Jz.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===Pz.dimensionHover||s===Pz.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>jw(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=>{r?i[t.series.fieldY[0]]=s:i[t.series.fieldX[0]]=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 hW=(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 cW{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);xj(t,r,l.spec),xj(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}));xj(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=hW(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=hW(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(hz.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(hz.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=hz.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=hz.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=hz.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 dW extends cW{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")&&Tj(i,aH(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 uW extends dW{_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),sH(t)}}class pW extends lW{constructor(){super(...arguments),this.transformerConstructor=uW,this.type="line",this.seriesType=oB.line,this._canStack=!0}}pW.type="line",pW.seriesType=oB.line,pW.transformerConstructor=uW;class gW extends wG{constructor(){super(...arguments),this.type=gW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}gW.type="area";const mW=()=>{hz.registerMark(gW.type,gW),fM(),qk(),kR.registerGraphic(RB.area,Ug),JH()};class fW extends oN{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 vW=()=>{hz.registerAnimation("area",qH),ZH(),XH()};class _W extends LG{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=Tj({},m.style,g.style),l.state=Tj({},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 yW extends AG{constructor(){super(...arguments),this.type=oB.area,this.transformerConstructor=_W,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(yW.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===kG?"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 GF(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 GF(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(uG(null===(e=hz.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),pG("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(uG(null===(i=hz.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),pG("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=SG(this);this._symbolMark.setAnimationConfig(uG(null===(s=hz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),pG("point",this._spec,this._markAttributeContext),t))}}initTooltip(){this._tooltipHelper=new fW(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}}}yW.type=oB.area,yW.mark=JD,yW.transformerConstructor=_W,U(yW,TG);class bW extends dW{_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),sH(t)}}class xW extends lW{constructor(){super(...arguments),this.transformerConstructor=bW,this.type="area",this.seriesType=oB.area,this._canStack=!0}}xW.type="area",xW.seriesType=oB.area,xW.transformerConstructor=bW;function SW(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 AW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:SW(t,e)}),kW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:SW(t,e)}),MW={type:"fadeIn"},TW={type:"growCenterIn"};function wW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return MW;case"scaleIn":return TW;default:return AW(t)}}class CW extends zH{constructor(){super(...arguments),this.type=CW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}CW.type="rect";const EW=()=>{hz.registerMark(CW.type,CW),gO(),uO.useRegisters([VI,NI,GI,WI,zI,HI])};function PW(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[GD]):this._spec.barMinHeight?this._calculateRectPosition(t,!1):GF(this._dataToPosX(t),e),this._getBarXEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[WD]):GF(this._dataToPosX1(t),e),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[UD]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):GF(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[YD]):GF(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({},LW.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{morph:fG(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(LW.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(Dz(this._option.dataSet,"addVChartProperty",JN),s){const t=([t],{scaleDepth:e})=>{var i;let s=[{}];const n=this.getDimensionField(),r=u(e)?n.length:Math.min(n.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};Dz(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:oG.bind(this),call:lG}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new sG(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=YD,s=UD,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=WD,s=GD,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=Zj(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)PW(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=GF(this[n](t),o),d=GF(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[kD],n=t[MD],r=t[TD],h=t[wD];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]),{[kD]:i,[MD]:s}),a?{[TD]:o,[wD]:l}:void 0);t.push(Tg(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=>GF(this._dataToPosY(t),a),y1:t=>GF(this._dataToPosY1(t),a)}:{y:t=>GF(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=>GF(this._dataToPosX(t),r),x1:t=>GF(this._dataToPosX1(t),r)}:{x:t=>GF(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=SG(this);this._barMark.setAnimationConfig(uG(null===(e=hz.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),pG(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;if(void 0!==this._spec.barWidth&&r===n)return ZF(this._spec.barWidth,a);const o=void 0!==this._spec.barMinWidth,l=void 0!==this._spec.barMaxWidth;let h=a;return o&&(h=Math.max(h,ZF(this._spec.barMinWidth,a))),l&&(h=Math.min(h,ZF(this._spec.barMaxWidth,a))),h}_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=ZF(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=Dw(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}}LW.type=oB.bar,LW.mark=KD,LW.transformerConstructor=RW;const OW=()=>{iI(),EW(),hz.registerAnimation("bar",((t,e)=>({appear:wW(t,e),enter:AW(t,!1),exit:kW(t,!1),disappear:kW(t)}))),tW(),ZG(),hz.registerSeries(LW.type,LW)};class IW extends dW{_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),sH(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 DW extends lW{constructor(){super(...arguments),this.transformerConstructor=IW,this.type="bar",this.seriesType=oB.bar,this._canStack=!0}}DW.type="bar",DW.seriesType=oB.bar,DW.transformerConstructor=IW;class FW extends zH{constructor(){super(...arguments),this.type=FW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}FW.type="rect3d";class jW extends LW{constructor(){super(...arguments),this.type=oB.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d"}}jW.type=oB.bar3d,jW.mark=XD;class zW extends IW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}class HW extends DW{constructor(){super(...arguments),this.transformerConstructor=zW,this.type="bar3d",this.seriesType=oB.bar3d}}HW.type="bar3d",HW.seriesType=oB.bar3d,HW.transformerConstructor=zW;const VW=[10,20],NW=Pw.Linear,GW="circle",WW=Pw.Ordinal,UW=["circle","square","triangle","diamond","star"],YW=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class KW extends yG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class XW extends AG{constructor(){super(...arguments),this.type=oB.scatter,this.transformerConstructor=KW,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=`${hB}_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=`${hB}_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:NW,defaultRange:VW},"size")}getShapeAttribute(t,e){return u(e)?GW:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:WW,defaultRange:UW},"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(XW.mark.point,{morph:fG(this._spec,XW.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=SG(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(uG(null===(i=hz.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),pG("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:GW},Jz.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},Jz.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},Jz.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},Jz.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},Jz.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]}}XW.type=oB.scatter,XW.mark=ZD,XW.transformerConstructor=KW;const $W=()=>{RG(),hz.registerAnimation("scatter",((t,e)=>Object.assign({appear:YW(0,e)},YH))),tW(),ZG(),hz.registerSeries(XW.type,XW)};class qW extends dW{_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 ZW extends lW{constructor(){super(...arguments),this.transformerConstructor=qW,this.type="scatter",this.seriesType=oB.scatter,this._canStack=!0}}ZW.type="scatter",ZW.seriesType=oB.scatter,ZW.transformerConstructor=qW;Ln();const JW={},QW=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function tU(t,e){t&&_(t)||lb("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(JW[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 QW.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}(i,e)),JW[i]||null}const eU={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(eU).forEach((t=>{tU(t,eU[t])}));const iU="Feature",sU="FeatureCollection";function nU(t){const e=Y(t);return 1===e.length?e[0]:{type:sU,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===sU?t.features:Y(t).filter((t=>!u(t))).map((t=>t.type===iU?t:{type:iU,geometry:t}))}(e))),[])}}const rU=QW.concat(["pointRadius","fit","extent","size"]);function aU(t,e){let i=[];return t?(Object.keys(t).forEach((s=>{rU.includes(s)&&(i=i.concat(dR(t[s],e)))})),i):i}let oU=class extends $R{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(dR(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(dR(t,this.view)),this.commit(),this}size(t){return u(this.spec.size)||this.detach(dR(this.spec.size,this.view)),this.spec.size=t,this.attach(dR(t,this.view)),this.commit(),this}extent(t){return u(this.spec.extent)||this.detach(dR(this.spec.extent,this.view)),this.spec.extent=t,this.attach(dR(t,this.view)),this.commit(),this}fit(t){return u(this.spec.fit)||this.detach(dR(this.spec.fit,this.view)),this.spec.fit=t,this.attach(dR(t,this.view)),this.commit(),this}configure(t){return this.detach(aU(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(aU(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=tU((t||"mercator").toLowerCase());return e||lb("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),QW.forEach((t=>{u(this.spec[t])||function(t,e,i){d(t[e])&&t[e](i)}(this.projection,t,pR(this.spec[t],e,tU))})),u(this.spec.pointRadius)||this.projection.path.pointRadius(pR(this.spec.pointRadius,e,tU)),!(u(this.spec.fit)||u(this.spec.extent)&&u(this.spec.size))){const t=nU(pR(this.spec.fit,e,tU));this.spec.extent?this.projection.fitExtent(pR(this.spec.extent,e,tU),t):this.spec.size&&this.projection.fitSize(pR(this.spec.size,e,tU),t)}return this.projection}output(){return this.projection}};const lU=(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 hU extends bG{constructor(){super(...arguments),this.type=oB.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=`${hB}_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 cU=`${hB}_MAP_LOOK_UP_KEY`,dU=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[_D]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[cU]=e.nameMap[n]:t[cU]=n})),t.features);class uU extends oN{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 pU extends zH{constructor(){super(...arguments),this.type=pU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}pU.type="path";const gU=()=>{hz.registerMark(pU.type,pU),pO()};class mU{constructor(t){this.projection=tU(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 fU{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 vU{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 _U(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:fU}:tb(e)||eb(e)?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:vU}:null}const yU={debounce:xt,throttle:St};class bU{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=tb(this._renderMode)||eb(this._renderMode),_U(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return _U(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;u(n)||De({x:r,y:a},this._getRegionOrSeriesLayout(e),!1)&&(i&&i({zoomDelta:n,zoomX:r,zoomY:a},s),this._eventObj.emit("zoom",{scale:s.zoomDelta,scaleCenter:{x:s.zoomX,y:s.zoomY},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,yU[o]((t=>{this._zoomableTrigger.clearZoom()}),l)),h.on(...c,yU[o]((t=>{this._zoomEventDispatch(t,i,s)}),l))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||_U(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||_U(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,yU[o]((t=>{this._zoomableTrigger.clearScroll()}),l)),h.on(...c,yU[o]((t=>this._scrollEventDispatch(t,i,s)),l))}initScrollEventOfSeries(t,e,i){_U(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||_U(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||_U(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||_U(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=yU[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)}),l),_=yU[o]((t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1;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 xU(t,e){return`${hB}_${e}_${t}`}class SU extends jG{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:xU(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),e&&(e.zoomDelta=l),this.zoom(l,[t.zoomX,t.zoomY]),l},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=Tj(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},s=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,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 mU(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===oB.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),sB(this._regions,(t=>{var e;if(t.type===oB.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===oB.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[cU],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}}SU.type=r.geoCoordinate,U(SU,bU);const AU=()=>{hz.registerComponent(SU.type,SU)};class kU extends yG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class MU extends hU{constructor(){super(...arguments),this.type=oB.map,this.transformerConstructor=kU,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 !`),jz.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),Dz(this._dataSet,"copyDataView",Wz),Dz(this._dataSet,"map",dU),Dz(this._dataSet,"lookup",lU);const i=jz.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:Xz.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:cU,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 sG(this._option,s)}initMark(){this._pathMark=this._createMark(MU.mark.area,{morph:fG(this._spec,MU.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:bD])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:bD]):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(uG(null===(t=hz.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),pG("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new uU(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[_D]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[_D],{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 _D}getActiveMarks(){return[this._pathMark]}}MU.type=oB.map,MU.mark=sF,MU.transformerConstructor=kU;const TU=()=>{kR.registerGrammar("projection",oU,"projections"),AU(),gU(),hz.registerSeries(MU.type,MU),hz.registerImplement("registerMap",Vz),hz.registerImplement("unregisterMap",Nz),$H()},wU=(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,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},a=o[t];if(null==a||a.forEach(((t,e)=>{e===a.length-1?t[RD]=!0:delete t[RD]})),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=CU([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}=EU(m,i,s,n,u);i.start=f,i.end=v;let _=v-f;return p.forEach((t=>{t[c]=+f,t[d]=Kt(t[c],+t[h]),f=t[d],_=Xt(_,+t[h])})),g.forEach((t=>{t[c]=+f,t[d]=Kt(t[c],_),t[h]=_})),Object.assign(Object.assign({},i),{lastIndex:e})}(a,t,n,r,h,l,i,e,o),void r.push(n)}h=CU(a,t,n,r,h,l,i,e),r.push(n)})),r};function CU(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}=EU(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);e||(t[h]=+i.end,t[c]=Kt(t[h],+t[l]),i.end=t[c]),i.isTotal=e,(u(p)||p===pD)&&(t[pD]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function EU(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?Xy("total.collectCountField error"):n=e[a].start;o<0?Xy("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 PU=(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},BU={type:"fadeIn"},RU={type:"growCenterIn"};function LU(t,e){switch(e){case"fadeIn":return BU;case"scaleIn":return RU;default:return AW(t,!1)}}class OU extends zH{constructor(){super(...arguments),this.type=OU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}OU.type="rule";const IU=()=>{hz.registerMark(OU.type,OU),mO()},DU=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:FU(t.map((t=>t.latestData)).flat(),e.fields,i)}};function FU(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)=>FU(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class jU{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"}),Dz(e,"dimensionTree",DU),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 zU extends RW{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel")}}const HU={rect:UU,symbol:GU,arc:KU,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=GU(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1);return e},stackLabel:XU,line:$U,area:$U,rect3d:UU,arc3d:KU,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function VU(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}=wV(i,s,o.text,e);return h&&(o.text=h(...c,{series:a})),o}function NU(t){return d(t)?e=>t(e.data):t}function GU(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=NU(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:WU(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function WU(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function UU(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=NU(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:YU(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function YU(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 KU(t){var e;const{labelSpec:i}=t,s=null!==(e=NU(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 XU(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=VU(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),mp(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 $U(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 qU extends LW{constructor(){super(...arguments),this.type=oB.waterfall,this.transformerConstructor=zU,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 jU(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=pD)}getSeriesKeys(){return this._seriesField===pD?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),Dz(this._dataSet,"waterfallFillTotal",PU),Dz(this._dataSet,"waterfall",wU),(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=Uz(this.getViewData(),this._dataSet,{name:`${hB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new sG(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:kD,endAs:MD,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=SG(this);this._barMark.setAnimationConfig(uG(null===(i=hz.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),pG("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(uG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),pG("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(qU.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){if(!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible))return super.initLabelMarkStyle(t),void(this._labelMark=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 XU(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?GF(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):GF(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))}}qU.type=oB.waterfall,qU.mark=uF,qU.transformerConstructor=zU;const ZU=()=>{IU(),EW(),hz.registerAnimation("waterfall",((t,e)=>({appear:LU(t,e),enter:AW(t,!1),exit:kW(t,!1),disappear:kW(t,!1)}))),$H(),tW(),ZG(),hz.registerSeries(qU.type,qU)},JU=`${hB}_BOX_PLOT_OUTLIER_VALUE`;var QU;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(QU||(QU={}));const tY=(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={[JU]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class eY extends oN{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===QU.OUTLIER)return this.series.getOutliersField();if(t===QU.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case QU.MIN:return this.series.getMinField();case QU.MAX:return this.series.getMaxField();case QU.MEDIAN:return this.series.getMedianField();case QU.Q1:return this.series.getQ1Field();case QU.Q3:return this.series.getQ3Field();case QU.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===QU.OUTLIER)return e[JU];if(t===QU.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case QU.MIN:return e[this.series.getMinField()];case QU.MAX:return e[this.series.getMaxField()];case QU.MEDIAN:return e[this.series.getMedianField()];case QU.Q1:return e[this.series.getQ1Field()];case QU.Q3:return e[this.series.getQ3Field()];case QU.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[JU])}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.getContentKey(QU.OUTLIER),value:this.getContentValue(QU.OUTLIER),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(QU.MAX),value:this.getContentValue(QU.MAX),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(QU.Q3),value:this.getContentValue(QU.Q3),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(QU.MEDIAN),value:this.getContentValue(QU.MEDIAN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(QU.Q1),value:this.getContentValue(QU.Q1),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(QU.MIN),value:this.getContentValue(QU.MIN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(QU.SERIES_FIELD),value:this.getContentValue(QU.SERIES_FIELD),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]}}}class iY extends zH{constructor(){super(...arguments),this.type=iY.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}}iY.type="boxPlot";const sY=()=>{hz.registerMark(iY.type,iY),kR.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(SO).registerChannelEncoder("x",((t,e,i,s,n,r)=>r&&yb(r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,s,n,r)=>r&&yb(r.direction)?{shaft:{y:e,y1:e}}:null)).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&yb(r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&yb(r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&yb(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&&yb(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&&yb(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&&yb(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}}))),kR.registerAnimationType("boxplotScaleIn",AO),kR.registerAnimationType("boxplotScaleOut",kO),_O(),gO(),mO(),kR.registerGlyph("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(TO).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&yb(r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&yb(r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&yb(r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&yb(r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&yb(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}}))),kR.registerAnimationType("barBoxplotScaleIn",wO),kR.registerAnimationType("barBoxplotScaleOut",CO),_O(),gO(),mO()};class nY extends AG{constructor(){super(...arguments),this.type=oB.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(nY.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(nY.mark.outlier,{progressive:t,key:_D,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,Jz.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"},Jz.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=>GF(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>GF(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>GF(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>GF(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>GF(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},Jz.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=>GF(e(this.getDatumPositionValues(t,JU),{bandPosition:this._bandPosition}),s)}:{x:this.dataToPositionX.bind(this),y:t=>GF(e(this.getDatumPositionValues(t,JU),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,Jz.STATE_NORMAL,t.AttributeLevel.Series)}}initData(){if(super.initData(),!this._data)return;Dz(this._dataSet,"foldOutlierData",tY),Dz(this._dataSet,"addVChartProperty",JN);const t=new ya(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${hB}_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:oG.bind(this),call:lG}},!1),this._outlierDataView=new sG(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=SG(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=hz.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(pG("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(uG(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(uG(null===(a=hz.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new eY(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]}}nY.type=oB.boxPlot,nY.mark=pF;class rY extends zH{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=rY.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})}}rY.type="text";const aY=()=>{hz.registerMark(rY.type,rY),vO(),fM(),gM(),kR.registerGraphic(RB.richtext,zg)};function oY(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 lY extends oN{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 hY=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),cY={type:"fadeIn"},dY=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function uY(t,e){return"fadeIn"===e?cY:hY(t)}class pY extends RW{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 gY extends LW{constructor(){super(...arguments),this.type=oB.rangeColumn,this._barMarkType="rect",this._barName=oB.bar,this.transformerConstructor=pY}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(gY.mark.bar,{morph:fG(this._spec,gY.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(gY.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(gY.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}});oY(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}});oY(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=SG(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(uG(null===(i=hz.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),pG("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(uG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),pG("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(uG(null===(n=hz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),pG("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new lY(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)}}gY.type=oB.rangeColumn,gY.mark=yF,gY.transformerConstructor=pY;const mY=()=>{EW(),aY(),hz.registerAnimation("rangeColumn",((t,e)=>({appear:uY(t,e),enter:hY(t),exit:dY(t),disappear:dY(t)}))),$H(),tW(),ZG(),hz.registerSeries(gY.type,gY)};class fY extends gY{constructor(){super(...arguments),this.type=oB.rangeColumn3d,this._barMarkType="rect3d",this._barName=oB.bar3d}}fY.type=oB.rangeColumn3d,fY.mark=bF;class vY extends oN{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 _Y extends yW{constructor(){super(...arguments),this.type=oB.rangeArea}initMark(){var t;const{customShape:e,stateSort:i}=null!==(t=this._spec.area)&&void 0!==t?t:{};this._areaMark=this._createMark(_Y.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 vY(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))}}_Y.type=oB.rangeArea,_Y.mark=kF;class yY extends bG{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=EB,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:[]};Dw(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:[]};Dw(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)&&xG(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 bY=(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[_B],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[_B]*t;g(e,b,i),b+=i}))}return 0!==m&&(i[i.length-1][l]=r),i};function xY(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const SY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:xY(t,!0,qz.appear)}),AY={type:"fadeIn"},kY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:xY(t,!0,qz.enter)}),MY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:xY(t,!0,qz.exit)}),TY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:xY(t,!0,qz.exit)});function wY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return AY;case"growRadius":return SY(Object.assign(Object.assign({},t),{growField:"radius"}));default:return SY(Object.assign(Object.assign({},t),{growField:"angle"}))}}class CY extends zH{constructor(t,e){super(t,e),this.type=EY.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[AB])[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 EY extends CY{constructor(){super(...arguments),this.type=EY.type}}EY.type="arc";const PY=()=>{fM(),Xk(),kR.registerGraphic(RB.arc,Xg),uO.useRegisters([QI,tD,ZI,JI]),hz.registerMark(EY.type,EY)};class BY extends yG{_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=Tj({},this._theme,i,t);const n=(t,e)=>Tj({},"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 RY extends yY{constructor(){super(...arguments),this.transformerConstructor=BY,this._pieMarkName="pie",this._pieMarkType="arc",this._startAngle=TB,this._endAngle=wB,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this.dataToCentralPosition=t=>{const e=t[AB];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;Dz(this._dataSet,"pie",bY),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:bB,asEndAngle:xB,asRatio:yB,asMiddleAngle:AB,asRadian:MB,asQuadrant:kB,asK:SB}},!1);const e=new ya(this._dataSet,{name:`${hB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new sG(this._option,e)}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},RY.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{morph:fG(this._spec,this._pieMarkName),defaultMorphElementKey:this._seriesField,key:yD,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 aB(bB)(t)}endAngleScale(t){return aB(xB)(t)}initMarkStyle(){const e=this._pieMark;e&&this.setMarkStyle(e,{x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:WF(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:WF(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:aB(mB).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[AB];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===qz.appear)return this._startAngle;if(i===qz.disappear)return this._endAngle;const n=[qz.disappear,qz.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[_D];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[_D]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[_D])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[_D])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+se({x:0,y:0},a,e[AB]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+se({x:0,y:0},a,e[AB]).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[AB]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+se({x:0,y:0},a,e[AB]).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]}}RY.transformerConstructor=BY,RY.mark=tF;class LY extends RY{constructor(){super(...arguments),this.type=oB.pie}}LY.type=oB.pie;const OY=()=>{PY(),hz.registerAnimation("pie",((t,e)=>({appear:wY(t,e),enter:kY(t),exit:MY(t),disappear:TY(t)}))),hz.registerSeries(LY.type,LY)};class IY extends CY{constructor(){super(...arguments),this.type=IY.type,this._support3d=!0}}IY.type="arc3d";class DY extends BY{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class FY extends RY{constructor(){super(...arguments),this.type=oB.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=DY}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[AB];return"inside"===i.position?ee(e):0},this.setMarkStyle(e,Object.assign(Object.assign({},s),{z:100}),void 0,t.AttributeLevel.Mark)}}FY.type=oB.pie3d,FY.mark=eF,FY.transformerConstructor=DY;const jY=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)=>e.getGraphicAttribute("innerRadius")},outerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("outerRadius")}}}},zY={type:"fadeIn"},HY=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),VY=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),NY=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function GY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return zY;case"growAngle":return jY(Object.assign(Object.assign({},t),{growField:"angle"}));default:return jY(Object.assign(Object.assign({},t),{growField:"radius"}))}}class WY extends yY{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(MD),this.setInnerRadiusField(kD)}setValueFieldToPercent(){this.setRadiusField(wD),this.setInnerRadiusField(TD)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}class UY extends yG{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}const YY=(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:CB,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:EB,layoutRadius:e.layoutRadius}};class KY extends NG{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(!RV(e))return null;const{axisType:i,componentName:s,startAngle:n,endAngle:r,center:a,outerRadius:o,layoutRadius:l}=YY(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(!RV(e))return;const{axisType:a,componentName:o,startAngle:l,endAngle:h,center:c,outerRadius:d,layoutRadius:u}=YY(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=hz.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=TB,this._endAngle=wB,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),sB(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:EV(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(){sB(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 Dw(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:Dw(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:KF(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:KF(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=>DV(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=EB,e=0;const i=this.getChart().getSpec();return sB(this.getRegions(),(s=>{const n=s;if(r=n.type,[oB.rose,oB.radar,oB.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(Tj({},this._axisStyle,s)),this._gridMark){this._gridMark.getProduct().encode(Tj({},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)}}KY.type=r.polarAxis,KY.specKey="axes";class XY extends KY{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new TC}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}}XY.type=r.polarLinearAxis,XY.specKey="axes",U(XY,$G);const $Y=()=>{GG(),hz.registerComponent(XY.type,XY)};class qY extends KY{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new rC}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(){}}qY.type=r.polarBandAxis,qY.specKey="axes",U(qY,JG);const ZY=()=>{GG(),hz.registerComponent(qY.type,qY)};class JY extends WY{constructor(){super(...arguments),this.type=oB.rose,this.transformerConstructor=UY,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(JY.mark.rose,{morph:fG(this._spec,JY.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=>GF(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=GF(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(uG(null===(i=hz.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),pG("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}JY.type=oB.rose,JY.mark=iF,JY.transformerConstructor=UY;const QY=()=>{hz.registerSeries(JY.type,JY),PY(),hz.registerAnimation("rose",((t,e)=>({appear:GY(t,e),enter:HY(t),exit:VY(t),disappear:NY(t)}))),ZY(),$Y()};class tK extends mc{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);k(t*e)||(this.valid=!1),this._fromAngle=t,this._fromRadius=e;const{angle:i,radius:s}=this._pointToCoord(this.to);k(i*s)||(this.valid=!1),this._toAngle=i,this._toRadius=s}onUpdate(t,e,i){if(!1!==this.valid)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 eK extends Hc{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}),r=re(s.angle),a=re(n.angle),o=this._pointToCoord(e),l=this._pointToCoord({x:e.x1,y:e.y1}),h=re(o.angle),c=re(l.angle),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 iK=t=>({type:"in"===t?"fadeIn":"fadeOut"});function sK(t,e,i){return"fadeIn"===e?iK(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function nK(t,e,i){return"fadeIn"===e?iK(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 rK=(t,e)=>({custom:Nc,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 aK extends WY{constructor(){super(...arguments),this.type=oB.radar,this.transformerConstructor=LG,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(aK.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:MG,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):TB,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(uG(null===(s=hz.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),pG("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=hz.getAnimationInKey(e);t.setAnimationConfig(uG(null==i?void 0:i(n,r),pG(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}}}aK.type=oB.radar,aK.mark=QD,aK.transformerConstructor=LG,U(aK,TG);const oK=()=>{hz.registerSeries(aK.type,aK),sI(),mW(),EG(),RG(),hz.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:sK(t,e,"in"),enter:sK(t,e,"in"),exit:sK(t,e,"out"),disappear:"clipIn"===e?void 0:sK(t,e,"out"),update:[{options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:eK,customParameters:t,duration:UH.update.duration,easing:UH.update.easing}]}))),hz.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:nK(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:nK(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:tK,customParameters:t,duration:UH.update.duration,easing:UH.update.easing}]}))),hz.registerAnimation("radarGroup",((t,e)=>({appear:rK(t,"in"),disappear:rK(t,"out")}))),Xk(),ZY(),$Y()};class lK extends oN{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 hK=(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},cK={fill:"#bbb",fillOpacity:.2};class dK extends AG{constructor(){super(...arguments),this.type=oB.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]])),Dz(this._option.dataSet,"objFlat",hK),Dz(this._option.dataSet,"copyDataView",Wz),Fz(this._option.dataSet,"dataview",ga),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:Xz.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(Tj(cK,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(dK.mark.group),this._containerMark=this._createMark(dK.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(dK.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(dK.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(dK.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(dK.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(dK.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(dK.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:bD}}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 HF).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:bD}}initTooltip(){this._tooltipHelper=new lK(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]}}dK.type=oB.dot,dK.mark=oF;class uK extends oN{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 pK=(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 gK extends AG{constructor(){super(...arguments),this.type=oB.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(),Dz(this._option.dataSet,"linkDotInfo",pK),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:Xz.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(gK.mark.group),this._containerMark=this._createMark(gK.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(gK.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(gK.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:bD}}initInteraction(){const t=[];this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new uK(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]}}gK.type=oB.link,gK.mark=aF;class mK extends yY{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()?kD:LD],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()?MD: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):TB;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?te(r):wB,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=GF(this.angleAxisHelper.dataToPosition([t[kD]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=GF(this.angleAxisHelper.dataToPosition([t[MD]]),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(mK.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 Xg(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[Tg({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 _K=()=>{hz.registerAnimation("circularProgress",((t,e)=>({appear:vK(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class yK extends yG{constructor(){super(...arguments),this._supportStack=!0}}class bK extends mK{constructor(){super(...arguments),this.type=oB.circularProgress,this.transformerConstructor=yK,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(bK.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(bK.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()?kD:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?MD: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(uG(null===(i=hz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),pG("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(uG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),pG("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}bK.type=oB.circularProgress,bK.mark=rF,bK.transformerConstructor=yK;function xK(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const SK=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:xK(t)}),AK={type:"fadeIn"};function kK(t,e){return!1===e?{}:"fadeIn"===e?AK:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:xK(t)}))(t)}class MK extends oN{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 TK extends AG{constructor(){super(...arguments),this.type=oB.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(TK.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 GF(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 GF(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 GF(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 GF(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(TK.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 GF(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 GF(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(TK.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=GF(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(Tg({x:i,y:0,height:r,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=GF(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(Tg({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(uG(null===(i=hz.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),pG("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(uG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),pG("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new MK(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}TK.type=oB.linearProgress,TK.mark=dF;const wK=()=>{EW(),hz.registerAnimation("linearProgress",((t,e)=>({appear:kK(t,e),enter:{type:"grow"},disappear:SK(t)}))),$H(),hz.registerSeries(TK.type,TK)},CK=[0],EK=[20,40],PK=[200,500],BK={shrink:!1,enlarge:!1,fontSizeLimitMin:0},RK=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],LK=`${hB}_WORD_CLOUD_WEIGHT`,OK=`${hB}_WORD_CLOUD_TEXT`;class IK extends bG{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=EK}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:PK,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:CK,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)?OK:this._nameField,this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:BK},this._spec.wordCloudConfig),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:CK,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=!RK.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(IK.mark.word,{key:yD,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(uG(hz.getAnimationInKey("wordCloud")(n,s),pG("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 HF).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:bD])}}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 TC,o=this._fontWeightRange;if(r){const[e,i]=pb(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:LK,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:OK,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:Qy(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[r,a],shape:this._maskShape,dataIndexKey:yD,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:LK}: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:yD,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:LK}: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)}}IK.mark=lF;function DK(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)||UH.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 jK(){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 zK(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 HK=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function VK(t){return d(t)?t:function(){return t}}class NK{constructor(t){var e,i,s;switch(this.options=z({},NK.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=(s=this.options.shape,FK[s]?FK[s]():FK.circle()),this.getText=null!==(e=VK(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=VK(this.options.fontWeight),this.getTextFontSize=VK(this.options.fontSize),this.getTextFontStyle=VK(this.options.fontStyle),this.getTextFontFamily=VK(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>HK(10,50);break;case"random-light":this.getTextColor=()=>HK(50,90);break;default:this.getTextColor=VK(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 WK extends NK{constructor(t){var e;super(z({},WK.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<=WK.defaultOptions.minFontSize&&(this.options.minFontSize=WK.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=GK[this.options.spiral])&&void 0!==e?e:GK.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=VK(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}=zK(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(P_.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(XK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(KK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}XK(p,this._size)&&(p=$K(p,this._size))}else if(XK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||YK(p,i))&&(!i||!UK(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 UK(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 YK(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,XK=(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 $K(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}=zK(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)}ZK.defaultOptions={enlarge:!1};const QK={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},tX=(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?eX(t.fontFamily):"sans-serif",d=t.fontStyle?eX(t.fontStyle):"normal",u=t.fontWeight?eX(t.fontWeight):"normal",p=t.rotate?eX(t.rotate):0,g=eX(t.text),m=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",f=t.padding?eX(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||QK,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?eX(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=sX(nX(t,l),C);w=i=>e(t(i))}let E=WK;"fast"===t.layoutType?E=ZK:"grid"===t.layoutType&&(E=qK);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()},eX=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],iX=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),sX=(t,e)=>{if(t[0]===t[1])return t=>e[0];const i=iX(t[0]),s=iX(t[1]),n=Math.min(i,s),r=Math.max(i,s);return t=>(iX(t)-n)/(r-n)*(e[1]-e[0])+e[0]},nX=(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 rX(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{kR.registerTransform("wordcloud",{transform:tX,markPhase:"beforeJoin"},!0),aY(),hz.registerAnimation("wordCloud",((t,e)=>({appear:DK(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),hz.registerSeries(aX.type,aX)};(class extends IK{constructor(){super(...arguments),this.type=oB.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(IK.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(uG(null===(e=hz.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}})),pG("word",this._spec,this._markAttributeContext)))}}).type=oB.wordCloud3d;const lX=(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},hX=(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},cX=`${hB}_FUNNEL_TRANSFORM_RATIO`,dX=`${hB}_FUNNEL_REACH_RATIO`,uX=`${hB}_FUNNEL_HEIGHT_RATIO`,pX=`${hB}_FUNNEL_VALUE_RATIO`,gX=`${hB}_FUNNEL_LAST_VALUE_RATIO`,mX=`${hB}_FUNNEL_NEXT_VALUE_RATIO`,fX=`${hB}_FUNNEL_LAST_VALUE`,vX=`${hB}_FUNNEL_CURRENT_VALUE`,_X=`${hB}_FUNNEL_NEXT_VALUE`,yX=`${hB}_FUNNEL_TRANSFORM_LEVEL`,bX=20;class xX extends oN{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[dX])).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 SX extends zH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class AX extends SX{constructor(){super(...arguments),this.type=AX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}AX.type="polygon";const kX=()=>{hz.registerMark(AX.type,AX),fM(),cM(),kR.registerGraphic(RB.polygon,Zg),uO.useRegisters([UI,YI])};class MX extends yG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class TX extends bG{constructor(){super(...arguments),this.type=oB.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=MX,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;Dz(this._dataSet,"funnel",lX),Dz(this._dataSet,"funnelTransform",hX);const t=new ya(this._dataSet,{name:`${hB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new sG(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:vX,asTransformRatio:cX,asReachRatio:dX,asHeightRatio:uX,asValueRatio:pX,asNextValueRatio:mX,asLastValueRatio:gX,asLastValue:fX,asNextValue:_X,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:yX}})}initMark(){var t,e,i,s,n,r,a,o,l,h,c,d;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},TX.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,morph:fG(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({},TX.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(TX.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(TX.mark.outerLabelLine,{themeSpec:e,markSpec:t,depend:[this._funnelOuterLabelMark.label],noSeparateStyle:!0})}}initTooltip(){this._tooltipHelper=new xX(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*aB(dX).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(uG(null===(s=hz.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),pG("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(uG(hz.getAnimationInKey("fadeInOut")(),pG(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(uG(hz.getAnimationInKey("funnel")({},o),pG(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(uG(null===(a=hz.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),pG("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[gX])/2:this._getSecondaryAxisLength(t[pX])/2,n=this._getSecondaryAxisLength(t[pX])/2):(s=this._getSecondaryAxisLength(t[pX])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[mX])/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[yX])}_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[yD]===t[yD]));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?bX: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{kX(),aY(),IU(),hz.registerSeries(TX.type,TX),hz.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},KH))),hz.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Gc,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Gc,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),$H()};class CX extends SX{constructor(){super(...arguments),this.type=CX.type}}CX.type="pyramid3d";class EX extends MX{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class PX extends TX{constructor(){super(...arguments),this.type=oB.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=EX}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},PX.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({},PX.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(PX.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(PX.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())}}PX.type=oB.funnel3d,PX.mark=cF,PX.transformerConstructor=EX;const BX=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},RX=t=>{const e=t.mark.elements.filter((t=>t.diffState===BB.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}))},LX=(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]},OX=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=RX(i),a=LX(r,s,n);return BX(e.startAngle,a)*(n-s)+s},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=RX(i),a=LX(r,s,n);return BX(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}}}),IX=t=>{const e=$(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),i=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[e,i]},DX=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=RX(i),a=IX(r);return BX(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=RX(i),a=IX(r);return BX(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}}}),FX=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},jX=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):jX(t.children,e,i)))})),e};function zX(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=NX(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}},GX=(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=GX(t.children,e,t,n))})),s},WX=(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=WX(t.children,e,t,n)),n=e(t,s,i,n)})),n},UX={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:zX,slice:HX,sliceDice:function(t,e,i,s,n){(t.depth%2==1?HX:zX)(t,e,i,s,n)}};class YX{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({},YX.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?cb(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?VX(this.options.aspectRatio):null!==(e=UX[this.options.splitType])&&void 0!==e?e:UX.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=NX(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)}))}}YX.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const KX=(t,e)=>{const i=new YX(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 jX(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},XX={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class $X{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];zX(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),XX);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({},$X.defaultOpionts,t):Object.assign({},$X.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?cb(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+mb(this.options.center[0],t.width),s=t.y0+mb(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=>mb(t,n))):mb(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>mb(t,n))):mb(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=mb(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=NX(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)}}}$X.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const qX=4294967296;function ZX(t,e){let i,s;if(t$(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function t$(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 n$(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 r$(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 a$(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 o$(t){return{_:t,next:null,prev:null}}function l$(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];n$(n,s,r);let a,o,l,h,c,d,u,p=o$(s),g=o$(n),m=o$(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=NX(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)%qX)/qX}(),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:u$.defaultOpionts.nodeSort;GX([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)GX([o],h$(h)),WX([o],c$(this._getPadding,.5,a)),GX([o],d$(1,this._maxDepth));else{const t=Math.min(s.width,s.height);GX([o],h$(u$.defaultOpionts.setRadius)),WX([o],c$(ub,1,a)),c&&WX([o],c$(this._getPadding,o.radius/t,a)),GX([o],d$(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}u$.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const p$=(t,e={})=>{if(!t)return[];const i=[];return jX(t,i,e),i},g$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new $X(i).layout(t,{width:s,height:n})};class m$ extends oN{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var f$;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(f$||(f$={}));const v$=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===f$.DrillDown){return Y(sz(t,n,s,"children"))}if(i.type===f$.DrillUp){const e=nz(t,n,s,"children");if(e)return Y(e)}return t};class _${_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=_U(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;Dz(t,"drillFilter",v$),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:f$.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:f$.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:f$.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:f$.DrillUp},model:this}),r}}class y$ extends yY{constructor(){super(...arguments),this.type=oB.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:rG),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:yD},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),Dz(this._dataSet,"sunburstLayout",g$),Dz(this._dataSet,"flatten",p$),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:nG,operations:["max","min","values"]},{key:rG,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(Dz(t.dataSet,"addVChartProperty",JN),t.transform({type:"addVChartProperty",options:{beforeCall:hG.bind(this),call:cG}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t,e;if(!1===this._sunburst.visible)return;const i=this._createMark(y$.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()},Jz.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(y$.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},Jz.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new m$(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(uG(null===(e=hz.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),pG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(uG(null===(e=hz.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),pG(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]}}y$.type=oB.sunburst,y$.mark=_F,U(y$,_$);const b$=()=>{hz.registerSeries(y$.type,y$),PY(),aY(),$H(),hz.registerAnimation("sunburst",((t,e)=>({appear:FX(0,e),enter:OX(t),exit:DX(t),disappear:DX(t)})))},x$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new u$(i).layout(t,{width:s,height:n})};class S$ extends oN{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const A$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"};class k$ extends AG{constructor(){super(...arguments),this.type=oB.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:rG),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:yD},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),Dz(this._dataSet,"circlePackingLayout",x$),Dz(this._dataSet,"flatten",p$),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)||(Dz(t.dataSet,"addVChartProperty",JN),t.transform({type:"addVChartProperty",options:{beforeCall:hG.bind(this),call:cG}}))}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(k$.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},Jz.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(k$.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"},Jz.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:nG,operations:["max","min","values"]},{key:rG,operations:["values"]}])}initTooltip(){this._tooltipHelper=new S$(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(uG(null===(i=hz.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),pG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(uG(null===(e=hz.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),pG(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]}}k$.type=oB.circlePacking,k$.mark=xF,U(k$,_$);const M$=()=>{hz.registerSeries(k$.type,k$),PY(),aY(),XH(),hz.registerAnimation("circlePacking",((t,e)=>({appear:A$(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},T$=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=T$(t.children):t.value=0),e+=Math.abs(t.value)})),e};function w$(t){return t.depth}function C$(t,e){return e-1-t.endDepth}const E$=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),P$=(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},B$={left:w$,right:C$,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:w$,end:C$},R$=yt(0,1);class L${constructor(t){this._ascendingSourceBreadth=(t,e)=>E$(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>E$(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},L$.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?cb(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):B$[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)};bb(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))),bb(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=[];T$(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}`;if(n[r])return n[r].value+=wt(t.value),void n[r].datum.push(t);const a={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[t],value:t.value,parents:t.parents.map((t=>t.key))};i.push(a),s[t.source].sourceLinks.push(a),s[t.target].targetLinks.push(a),n[r]=a})),{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=[P$(s[t.source]),P$(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=Math.min(n>0?Math.max(this.options.nodeGap,n):this.options.nodeGap,this._viewBox.height/e);a=()=>i,this._gapY=i,this.options.equalNodeHeight?o=this._viewBox.height/e-i:r=t.reduce(((t,e)=>{const s=e.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-(e.length-1)*i)/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,n,0),p=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.max(e.value?i*R$(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&&(o/=i.length-1,n+o>0)){n+=o,this._gapY=Math.min(n);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(E$),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(E$),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 L$(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]:[]},I$=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&I$(t,e.children,i)}))},D$=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},F$=(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 L$(e),r=[];return r.push(n.layout(s,i)),r},j$=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:[]},z$=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 H$ extends oN{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 V$=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),N$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:V$(t),G$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class W$ extends zH{constructor(){super(...arguments),this.type=W$.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}}W$.type="linkPath";const U$=()=>{kR.registerGlyph("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(BO).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),kR.registerAnimationType("linkPathGrowIn",RO),kR.registerAnimationType("linkPathGrowOut",LO),kR.registerAnimationType("linkPathUpdate",OO),_O(),pO(),hz.registerMark(W$.type,W$)};class Y$ extends AG{constructor(){super(...arguments),this.type=oB.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=[Jz.STATE_SANKEY_EMPHASIS,Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:s})}else n.target===e.key?i.includes(n.source)||i.push(n.source):(t.removeState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState(Jz.STATE_SANKEY_EMPHASIS),e.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS)):(t.removeState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(Jz.STATE_SANKEY_EMPHASIS),void s.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(Jz.STATE_SANKEY_EMPHASIS),void s.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:h.value/r.value});s.removeState(Jz.STATE_SANKEY_EMPHASIS),s.addState(Jz.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=[Jz.STATE_SANKEY_EMPHASIS,Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS),void t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS),void t.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:o.value/i.value});t.removeState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.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){Dz(this._dataSet,"sankeyLayout",F$),Dz(this._dataSet,"sankeyFormat",D$),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:Xz.sankeyLayout});const{dataSet:a}=this._option;Dz(a,"sankeyNodes",j$),Dz(a,"flatten",p$);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:oG.bind(this),call:lG}},!1),this._nodesSeriesData=new sG(this._option,o),Dz(a,"sankeyLinks",z$);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:oG.bind(this),call:lG}},!1),this._linksSeriesData=new sG(this._option,l)}}initMark(){var t,e,i,s;const n=this._createMark(Y$.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(Y$.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(Y$.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},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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(uG(null===(i=hz.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(r,a),pG("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(uG(null===(s=hz.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(r,a),pG("link",this._spec,this._markAttributeContext))),this._labelMark&&this._labelMark.setAnimationConfig(uG(null===(n=hz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),pG("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([Jz.STATE_SANKEY_EMPHASIS_REVERSE,Jz.STATE_SANKEY_EMPHASIS]),e.includes(t.getDatum().key)||t.addState(Jz.STATE_SANKEY_EMPHASIS_REVERSE)}))}initTooltip(){this._tooltipHelper=new H$(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 HF;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 I$(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]}}Y$.type=oB.sankey,Y$.mark=mF;const K$=()=>{kR.registerTransform("sankey",{transform:O$,markPhase:"beforeJoin"},!0),EW(),U$(),aY(),hz.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:N$(t,e)},KH))),hz.registerAnimation("sankeyLinkPath",((t,e)=>({appear:G$(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),$H(),hz.registerSeries(Y$.type,Y$)},X$=(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=p$(n);return i=tG([{latestData:r}],e),i};class $$ extends oN{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}get defaultShapeType(){return"square"}}const q$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class Z$ extends yG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}class J$ extends AG{constructor(){super(...arguments),this.type=oB.treemap,this.transformerConstructor=Z$,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:rG),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:yD},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&&[rG,"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)&&(Dz(this._rawData.dataSet,"addVChartProperty",JN),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:hG.bind(this),call:cG}}))}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){Dz(this._dataSet,"hierarchyDimensionStatistics",X$),Dz(this._dataSet,"flatten",p$);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:nG,operations:["max","min","values"]},{key:rG,operations:["values"]}])}initMark(){var t,e,i,s;const n=this._createMark(J$.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(J$.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()},Jz.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()},Jz.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},Jz.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},Jz.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},Jz.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},Jz.STATE_NORMAL,t.AttributeLevel.Series))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(uG(null===(e=hz.getAnimationInKey("treemap"))||void 0===e?void 0:e(),pG(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 $$(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]}}J$.type=oB.treemap,J$.mark=gF,J$.transformerConstructor=Z$,U(J$,_$),U(J$,bU);const Q$=()=>{EW(),aY(),hz.registerAnimation("treemap",((t,e)=>({appear:q$(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),$H(),kR.registerTransform("treemap",{transform:KX,markPhase:"beforeJoin"},!0),hz.registerSeries(J$.type,J$)},tq={type:"fadeIn"};function eq(t,e){return"fadeIn"===e?tq:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class iq extends yG{constructor(){super(...arguments),this._supportStack=!1}}class sq extends mK{constructor(){super(...arguments),this.type=oB.gaugePointer,this.transformerConstructor=iq,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(sq.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},sq.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(sq.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(uG(null===(i=hz.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),pG("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}sq.type=oB.gaugePointer,sq.mark=vF,sq.transformerConstructor=iq;const nq=()=>{hz.registerSeries(sq.type,sq),gU(),EW(),hz.registerAnimation("gaugePointer",((t,e)=>{const i=eq(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),ZY(),$Y()};class rq extends yG{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class aq extends mK{constructor(){super(...arguments),this.type=oB.gauge,this.transformerConstructor=rq,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();Dz(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[OD]=t[this._angleField[0]],t[LD]=e>0?i[e-1][OD]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(aq.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(aq.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[LD])?this.angleAxisHelper.dataToPosition([t[LD]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[OD]])}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(uG(null===(i=hz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),pG("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}aq.type=oB.gauge,aq.mark=fF,aq.transformerConstructor=rq;class oq extends PG{constructor(){super(...arguments),this.type=oq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}oq.type="cell";const lq=()=>{hz.registerMark(oq.type,oq),fM(),_M(),kR.registerGraphic(RB.cell,bg),kR.registerMark(RB.cell,lD)};function hq(t){return!1===t?{}:{type:"fadeIn"}}class cq extends oN{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return p(i)&&"dimension"===t&&(i.visible=!1),i}}class dq extends yG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class uq extends AG{constructor(){super(...arguments),this.type=oB.heatmap,this.transformerConstructor=dq}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(uq.mark.cell,{morph:fG(this._spec,uq.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(uq.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=SG(this);this._cellMark.setAnimationConfig(uG(null===(i=hz.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),pG("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 cq(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]}}uq.type=oB.heatmap,uq.mark=SF,uq.transformerConstructor=dq;const pq=()=>{aY(),lq(),hz.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},KH),{appear:hq(e)}))),tW(),ZG(),hz.registerSeries(uq.type,uq)},gq=(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=mb(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=mb(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+mb(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+mb(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=cb(e.field),C=t.map(w),[E,P]=pb(C),B=E===P?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(P-E),R=u(e.radiusField)?w:cb(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?pb(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=mq(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),fq({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},fq=(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,[_D]:null==n?void 0:n[_D],[bD]:null==n?void 0:n[bD]}};class _q extends zH{constructor(){super(...arguments),this.type=_q.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}}_q.type="ripple";const yq=()=>{hz.registerMark(_q.type,_q),kR.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}}))),_O(),fO()},bq=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class xq extends yG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class Sq extends yY{constructor(){super(...arguments),this.type=oB.correlation,this.transformerConstructor=xq,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;Dz(this._dataSet,"correlation",gq);const s=new va;Fz(s,"dataview",ga),Dz(s,"correlationCenter",vq);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 sG(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(Sq.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:_D,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(Sq.mark.ripplePoint,{key:_D,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});a&&(this._ripplePointMark=a);const o=this._createMark(Sq.mark.centerPoint,{key:_D,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[gD],y:t=>t[mD],size:t=>t[fD],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},Jz.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},Jz.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},Jz.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)},Jz.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(uG(null===(e=hz.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),pG("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()}}Sq.type=oB.correlation,Sq.mark=AF,Sq.transformerConstructor=xq;const Aq=()=>{RG(),yq(),hz.registerSeries(Sq.type,Sq),hz.registerAnimation("correlation",((t,e)=>Object.assign({appear:bq(0,e)},YH)))};class kq extends zH{constructor(){super(...arguments),this.type=kq.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}}kq.type="liquid";const Mq=(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/2):t;class Tq extends oN{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 wq extends bG{constructor(){super(...arguments),this.type=oB.liquid,this.transformerConstructor=LG,this._liquidBackgroundMark=null,this._liquidOutlineMark=null}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){super.setAttrFromSpec(),this._marginSpec=$F(this._spec.outlineMargin),this._paddingSpec=$F(this._spec.outlinePadding),this.setValueField(this._spec.valueField)}rawDataUpdate(t){super.rawDataUpdate(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(wq.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(wq.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidMark=this._createMark(wq.mark.liquid,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_getPosAndSizeFormRegion(t=!1){const{top:e=0,bottom:i=0,left:s=0,right:n=0}=this._marginSpec,{top:r=0,bottom:a=0,left:o=0,right:l=0}=this._paddingSpec,{width:h,height:c}=this._region.getLayoutRect();return t?{x:h/2+(s-n)/2,y:c/2+(e-i)/2,size:Math.min(h-(s+n),c-(e+i))}:{x:h/2+(s+l-(n+l))/2,y:c/2+(e+r-(i+a))/2,size:Math.min(h-(s+n+o+l),c-(e+i+r+a))}}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),x:()=>this._getPosAndSizeFormRegion(!0).x,y:()=>this._getPosAndSizeFormRegion(!0).y,size:()=>this._getPosAndSizeFormRegion(!0).size,symbolType:()=>{var t;return Mq(null!==(t=this._spec.maskShape)&&void 0!==t?t:"circle",this._getPosAndSizeFormRegion(!0).size)}},"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:()=>{var t;const{x:e,y:i,size:s}=this._getPosAndSizeFormRegion();return[bg({x:e,y:i,size:s,symbolType:Mq(null!==(t=this._spec.maskShape)&&void 0!==t?t:"circle",s),fill:!0})]}},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setInteractive(!1)}_initLiquidMarkStyle(){const e=this._liquidMark;e&&this.setMarkStyle(e,{dx:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,y:()=>{const{y:t,size:e}=this._getPosAndSizeFormRegion();return t-e/2+e-e*this._heightRatio},height:()=>{const{size:t}=this._getPosAndSizeFormRegion();return t*this._heightRatio},fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new Tq(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}initInteraction(){this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i;const s={y:{from:()=>{const{y:t,size:e}=this._getPosAndSizeFormRegion();return t-e/2+e},to:()=>{const{y:t,size:e}=this._getPosAndSizeFormRegion();return t-e/2+e-e*this._heightRatio}},height:{from:0,to:()=>{const{size:t}=this._getPosAndSizeFormRegion();return t*this._heightRatio}}},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(uG(null===(i=hz.getAnimationInKey("liquid"))||void 0===i?void 0:i(s,n),pG("liquid",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=DM(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]}}wq.type=oB.liquid,wq.mark=MF,wq.transformerConstructor=LG;const Cq=t=>Y(t).join(",");class Eq extends oN{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>Cq(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>Cq(null==t?void 0:t[this.series.getDimensionField()[0]])}}class Pq extends yG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}class Bq extends bG{constructor(){super(...arguments),this.type=oB.venn,this.transformerConstructor=Pq,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:yD)}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(Bq.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(Bq.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()},Jz.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},Jz.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},Jz.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=>Cq(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)}},Jz.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=>Cq(t.sets)},Jz.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new Eq(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:Cq(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return Cq(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[Cq(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(Cq(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(uG(null===(e=hz.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),pG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(uG(null===(e=hz.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),pG(t.name,this._spec,this._markAttributeContext)))}))}}Bq.type=oB.venn,Bq.mark=TF,Bq.transformerConstructor=Pq;class Rq extends cW{_isValidSeries(t){return t===oB.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 Lq extends lW{constructor(){super(...arguments),this.transformerConstructor=Rq,this.type="map",this.seriesType=oB.map}}Lq.type="map",Lq.seriesType=oB.map,Lq.transformerConstructor=Rq;class Oq extends cW{_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 Iq extends Oq{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=PV(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,Tj({},s,l)),n&&Object.assign(o,Tj({},n,o))}}class Dq extends Oq{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 Fq extends Oq{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 jq extends lW{constructor(){super(...arguments),this.transformerConstructor=Fq}}jq.transformerConstructor=Fq;class zq extends jq{constructor(){super(...arguments),this.transformerConstructor=Fq,this.type="pie",this.seriesType=oB.pie}}zq.type="pie",zq.seriesType=oB.pie,zq.transformerConstructor=Fq;class Hq extends Fq{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class Vq extends jq{constructor(){super(...arguments),this.transformerConstructor=Hq,this.type="pie3d",this.seriesType=oB.pie3d}}Vq.type="pie3d",Vq.seriesType=oB.pie3d,Vq.transformerConstructor=Hq;class Nq extends Dq{_getDefaultSeriesSpec(t){var e,i,s;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:EB,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:EB,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=>Tj({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}class Gq extends lW{constructor(){super(...arguments),this.transformerConstructor=Nq,this.type="rose",this.seriesType=oB.rose,this._canStack=!0}}Gq.type="rose",Gq.seriesType=oB.rose,Gq.transformerConstructor=Nq;class Wq extends Dq{_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:Tj({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=>Tj({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class Uq extends lW{constructor(){super(...arguments),this.transformerConstructor=Wq,this.type="radar",this.seriesType=oB.radar,this._canStack=!0}}Uq.type="radar",Uq.seriesType=oB.radar,Uq.transformerConstructor=Wq;class Yq extends cW{_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")&&Tj(e,aH(this.type,t))})),this._transformAxisSpec(t)}}class Kq extends lW{constructor(){super(...arguments),this.transformerConstructor=Yq,this.type="common",this._canStack=!0}}Kq.type="common",Kq.transformerConstructor=Yq;class Xq extends dW{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 $q extends lW{constructor(){super(...arguments),this.transformerConstructor=Xq,this._canStack=!0}}$q.transformerConstructor=Xq;class qq extends Xq{transformSpec(t){super.transformSpec(t),sH(t)}}class Zq extends $q{constructor(){super(...arguments),this.transformerConstructor=qq,this.type="histogram",this.seriesType=oB.bar}}Zq.type="histogram",Zq.seriesType=oB.bar,Zq.transformerConstructor=qq;class Jq extends $q{constructor(){super(...arguments),this.transformerConstructor=qq,this.type="histogram3d",this.seriesType=oB.bar3d}}Jq.type="histogram3d",Jq.seriesType=oB.bar3d,Jq.transformerConstructor=qq;class Qq extends Iq{_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 tZ extends lW{constructor(){super(...arguments),this.transformerConstructor=Qq,this.type="circularProgress",this.seriesType=oB.circularProgress,this._canStack=!0}}tZ.type="circularProgress",tZ.seriesType=oB.circularProgress,tZ.transformerConstructor=Qq;class eZ extends Iq{_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:oB.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===oB.gauge||t.type===oB.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===oB.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 iZ extends lW{constructor(){super(...arguments),this.transformerConstructor=eZ,this.type="gauge",this.seriesType=oB.gaugePointer}}iZ.type="gauge",iZ.seriesType=oB.gaugePointer,iZ.transformerConstructor=eZ;class sZ extends cW{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class nZ extends lW{constructor(){super(...arguments),this.transformerConstructor=sZ,this.type="wordCloud",this.seriesType=oB.wordCloud}}nZ.transformerConstructor=sZ;class rZ extends sZ{_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 aZ extends nZ{constructor(){super(...arguments),this.transformerConstructor=rZ,this.type="wordCloud",this.seriesType=oB.wordCloud}}aZ.type="wordCloud",aZ.seriesType=oB.wordCloud,aZ.transformerConstructor=rZ;class oZ extends sZ{_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 lZ extends nZ{constructor(){super(...arguments),this.transformerConstructor=oZ,this.type="wordCloud3d",this.seriesType=oB.wordCloud3d}}lZ.type="wordCloud3d",lZ.seriesType=oB.wordCloud3d,lZ.transformerConstructor=oZ;class hZ extends cW{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 cZ extends lW{constructor(){super(...arguments),this.transformerConstructor=hZ,this.type="funnel",this.seriesType=oB.funnel}}cZ.type="funnel",cZ.seriesType=oB.funnel,cZ.transformerConstructor=hZ;class dZ extends lW{constructor(){super(...arguments),this.transformerConstructor=hZ,this.type="funnel3d",this.seriesType=oB.funnel3d}}dZ.type="funnel3d",dZ.seriesType=oB.funnel3d,dZ.transformerConstructor=hZ;class uZ extends dW{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=PV(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=PV(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class pZ extends lW{constructor(){super(...arguments),this.transformerConstructor=uZ,this.type="linearProgress",this.seriesType=oB.linearProgress,this._canStack=!0}}pZ.type="linearProgress",pZ.seriesType=oB.linearProgress,pZ.transformerConstructor=uZ;class gZ extends dW{_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),sH(t)}}class mZ extends lW{constructor(){super(...arguments),this.transformerConstructor=gZ,this.type="rangeColumn",this.seriesType=oB.rangeColumn}}mZ.type="rangeColumn",mZ.seriesType=oB.rangeColumn,mZ.transformerConstructor=gZ;class fZ extends dW{_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 vZ extends lW{constructor(){super(...arguments),this.transformerConstructor=fZ,this.type="rangeColumn3d",this.seriesType=oB.rangeColumn3d}}vZ.type="rangeColumn3d",vZ.seriesType=oB.rangeColumn3d,vZ.transformerConstructor=fZ;class _Z extends cW{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:CB,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=oB.sunburst;return s.type=n,s[n]=t[n],s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class yZ extends lW{constructor(){super(...arguments),this.transformerConstructor=_Z,this.type="sunburst",this.seriesType=oB.sunburst}}yZ.type="sunburst",yZ.seriesType=oB.sunburst,yZ.transformerConstructor=_Z;class bZ extends cW{_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=oB.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class xZ extends lW{constructor(){super(...arguments),this.transformerConstructor=bZ,this.type="circlePacking",this.seriesType=oB.circlePacking}}xZ.type="circlePacking",xZ.seriesType=oB.circlePacking,xZ.transformerConstructor=bZ;class SZ extends cW{_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 AZ extends lW{constructor(){super(...arguments),this.transformerConstructor=SZ,this.type="treemap",this.seriesType=oB.treemap}}AZ.type="treemap",AZ.seriesType=oB.treemap,AZ.transformerConstructor=SZ;class kZ extends IW{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),sH(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}class MZ extends DW{constructor(){super(...arguments),this.transformerConstructor=kZ,this.type="waterfall",this.seriesType=oB.waterfall}}MZ.type="waterfall",MZ.seriesType=oB.waterfall,MZ.transformerConstructor=kZ;class TZ extends dW{_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"}]),sH(t)}}class wZ extends lW{constructor(){super(...arguments),this.transformerConstructor=TZ,this.type="boxPlot",this.seriesType=oB.boxPlot}}wZ.type="boxPlot",wZ.seriesType=oB.boxPlot,wZ.transformerConstructor=TZ;class CZ extends cW{_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 EZ extends lW{constructor(){super(...arguments),this.transformerConstructor=CZ,this.type="sankey",this.seriesType=oB.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)}))}}EZ.type="sankey",EZ.seriesType=oB.sankey,EZ.transformerConstructor=CZ;class PZ extends dW{_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),sH(t)}}class BZ extends lW{constructor(){super(...arguments),this.transformerConstructor=PZ,this.type="rangeArea",this.seriesType=oB.rangeArea}}BZ.type="rangeArea",BZ.seriesType=oB.rangeArea,BZ.transformerConstructor=PZ;class RZ extends dW{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}class LZ extends lW{constructor(){super(...arguments),this.transformerConstructor=RZ,this.type="heatmap",this.seriesType=oB.heatmap}}LZ.type="heatmap",LZ.seriesType=oB.heatmap,LZ.transformerConstructor=RZ;class OZ extends cW{_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=oB.correlation;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class IZ extends lW{constructor(){super(...arguments),this.transformerConstructor=OZ,this.type="correlation",this.seriesType=oB.correlation}}IZ.type="correlation",IZ.seriesType=oB.correlation,IZ.transformerConstructor=OZ;function DZ(t){var e,i;const s=Object.assign({},t);return B(t.style)||(s.textStyle=lz(t.style)),B(t.textStyle)||Tj(s.textStyle,lz(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&lz(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&lz(s.background.style),s}const FZ=(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},jZ=(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:bD;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 zZ extends jG{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:()=>{sB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),sB(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=UF(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 DH(this._option,e),this._initSelectedData(),sB(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)||(sB(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(Tj({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(Tj({},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(Tj({},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}}zZ.specKey="legends";class HZ extends zZ{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),sB(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:Xz.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){Dz(this._option.dataSet,"discreteLegendFilter",jZ),Dz(this._option.dataSet,"discreteLegendDataMake",FZ);const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return sB(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(!rb(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=qj(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=DZ(s)),B(n.focusIconStyle)||lz(n.focusIconStyle),n.shape&&(n.shape=az(n.shape)),n.label&&(n.label=az(n.label)),n.value&&(n.value=az(n.value)),n.background&&(n.background=az(n.background)),YF(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),YF(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),YF(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)||lz(r.railStyle),B(r.sliderStyle)||lz(r.sliderStyle)):(B(r.textStyle)||lz(r.textStyle),r.handler&&az(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(Tj(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 uP}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(rP.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(rP.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(rP.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}=wV(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=wV(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}HZ.specKey="legends",HZ.type=r.discreteLegend;const VZ=(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[]},NZ=(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)?rz(t,+e,+i):t.filter((t=>t[o]>=e&&t[o]<=i))}return t};function GZ(t){return"color"===t||"size"===t}const WZ={color:vP,size:yP},UZ=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],YZ=[2,10];class KZ extends zZ{static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!y(e))return GZ(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)=>{GZ(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),sB(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData},level:Xz.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(){Dz(this._option.dataSet,"continuousLegendFilter",NZ),Dz(this._option.dataSet,"continuousLegendDataMake",VZ);const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>nB(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=qj(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!rb(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=qj(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?UZ:YZ);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=Tj({},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=DZ(s)),w.showHandler=!1!==n.visible,B(n.style)||(w.handlerStyle=lz(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),B(r.style)||(w.railStyle=lz(r.style)),B(a.style)||(w.trackStyle=lz(a.style)),w.startText=az(o),w.endText=az(l),w.handlerText=az(h),B(c)||(w.sizeBackground=lz(c)),d.visible&&!B(d.style)&&(Tj(w,d.style),p(d.padding)&&(w.padding=d.padding)),w}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return WZ[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))}}}KZ.specKey="legends",KZ.type=r.continuousLegend;class XZ{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=Tz(n,a,!0))&&void 0!==e?e:[],...null!==(i=gz(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(!jw(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=nN(s).includes(t):p(e.visible)||p(e.activeType)?d.visible=nN(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)&&(pN(s).every((t=>{var e;return!nN(null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec).includes("dimension")}))?d.visible=!1:p(e.visible)||p(e.activeType)?d.visible=nN(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=dN(t,i,s),m=uN(t,i,s),f=Tj({},I(e[t]),m),v=g.title,_=mN(void 0,f,u.shape,void 0,v);p(f.title)?f.title=hN(f.title,Object.assign(Object.assign({},v),_)):f.title=hN(v,_,!0);const y=Y(g.content);if(p(f.content)){const t=gN(y);f.content=cN(f.content,(e=>mN(e,f,u.shape,t)))}else f.content=cN(y,(t=>mN(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=SN(a,t,e),l=!!p(o)&&!1!==vN(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 $Z extends XZ{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 qZ extends XZ{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 ZZ extends XZ{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 JZ=t=>p(t)&&!y(t),QZ=t=>p(t)&&y(t);class tJ extends FG{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:s}=super._initTheme(t,e);return i.style=Tj({},this._theme,i.style),{spec:i,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h,c,d;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=nN(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:eb(this._option.mode)||!Qy(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=null===(d=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===d?void 0:d.getElementById(t.parentElement)):Qy(this._option.mode)&&(t.parentElement=null==Jy?void 0:Jy.body)}}class eJ extends jG{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=tJ,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._getMouseOutHandler=t=>e=>{var i,s,n;if(this._alwaysShow)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=Qy(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(!t&&this._clickLock)return;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&&JZ(this._cacheInfo)?a.mark=this._showTooltipByMouseEvent("mark",i,e,t,!0):r&&QZ(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),t&&this._clickLock&&(this._clickLock=!1))},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(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));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&sV.globalConfig.uniqueTooltip&&l&&sV.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._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?_N.canvas:_N.dom,n=hz.getComponentPluginInType(t);n||$y("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 qZ(this),dimension:new $Z(this),group:new ZZ(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)),(tb(i)||eb(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)))}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=iN(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(QZ(t)){if(JZ(this._cacheInfo))return!1;const e=this._cacheInfo;if(!(e.length===t.length&&t.every(((t,i)=>cz(t,e[i])))))return!1}else{if(QZ(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}}eJ.type=r.tooltip,eJ.transformerConstructor=tJ,eJ.specKey="tooltip";var iJ,sJ;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(iJ||(iJ={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(sJ||(sJ={}));const nJ={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class rJ extends jG{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=>{this._handleIn(t),this._clickLock=this._hasActive&&this._spec.lockAfterClick,this._clickLock&&S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._clickLock=!1,this._handleOutEvent()}),this.triggerOff))},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"}:tb(e)||eb(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=this.trigger||"hover",e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;if(y(t)){const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return[{click:"click"===t,in:i[t],out:e(t)}]}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)=>{nJ[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||t.yField)&&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){mz(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=>{jw(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[0],s=e.series.dataToPosition(e.datum[0]);(p(t.dimType)?"y"===t.dimType:fz(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=s.y:r=s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=e.x,a=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=rB(this._regions,"cartesian");if(!e)return;const{x:i,y:s,offsetWidth:n,offsetHeight:r,bandWidth:a,bandHeight:o}=zV(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=NV(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=GV(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 uT(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(n=new pT(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 QM(e)),null==s||s.add(t)),FV(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}aJ.specKey="crosshair",aJ.type=r.cartesianCrosshair;class oJ extends rJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return e.categoryField||e.valueField?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.polarCrosshair}]:void 0;const i=[];return e.forEach(((t,e)=>{(t.categoryField||t.valueField)&&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=>{jw(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=rB(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:"",Tj(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=EV(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=EV(s.getSpec())),c.angle=a.angle,c.axis=s,Tj(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}=wV(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}=wV(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 uT(Object.assign(Object.assign({},l),{lineStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===o&&(t=new mT(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 fT(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex+1})):new gT(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 QM(e),null==s||s.add(t),i(t)),FV(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair]}}oJ.specKey="crosshair",oJ.type=r.polarCrosshair;const lJ=(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)},hJ=(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 cJ extends jG{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 sB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),sB(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=_z(t),this._isHorizontal="horizontal"===yz(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=>!Dw(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(Dw(this._stateScale.type));this._stateScale.domain(e,!0),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={};sB(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=Dw(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 sB(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;Fz(s,"dataview",ga),Dz(s,"dataFilterComputeDomain",hJ);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 DH(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(Dw(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&&Dw(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,Dw(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=Dw(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 rC,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||(Dz(this._option.dataSet,"dataFilterWithNewDomain",lJ),sB(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:()=>Dw(this._stateScale.type)},level:Xz.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(Dw(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&&jw(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,jw(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(cJ,bU);class dJ extends FG{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=Tj({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 uJ extends cJ{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=dJ,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 TC;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(!Dw(t.type)||e[0]!==e[1])&&(!jw(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 rE(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:lz(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:lz(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:lz(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:lz(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:lz(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:lz(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:lz(g.style)},selectedBackgroundStyle:lz(this._spec.selectedBackground.style),dragMaskStyle:lz(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:Tj(lz(null===(l=m.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},lz(null===(h=m.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:Tj(lz(null===(c=f.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},lz(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}=wV(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()}}uJ.type=r.dataZoom,uJ.transformerConstructor=dJ,uJ.specKey="dataZoom";class pJ extends cJ{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 EM(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=$P(this._start,e)&&$P(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=lz(t.style)),B(null==e?void 0:e.style)||(s.sliderStyle=lz(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}pJ.type=r.scrollBar,pJ.specKey="scrollBar";const gJ=(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 mJ extends jG{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!==mJ.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(){Dz(this._option.dataSet,"indicatorFilter",gJ);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 DH(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=Tj({},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({},lz(e.style)),{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?ZF(this._spec.offsetX,this._computeLayoutRadius()):0,dy:this._spec.offsetY?ZF(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({},lz(this._spec.title.style)),{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 SP(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}}mJ.type=r.indicator,mJ.specKey="indicator";const fJ=["sum","average","min","max","variance","standardDeviation","median"];function vJ(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=X(s);return er}function _J(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&vJ(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=YF(t.x)?SJ(t.x,n)+r.x:l.getXAxisHelper().dataToPosition([t.x])+r.x,h}function yJ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&vJ(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=YF(t.y)?SJ(t.y,n)+r.y:l.getYAxisHelper().dataToPosition([t.y])+r.y,h}function bJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&vJ(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 xJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&vJ(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 SJ(t,e){return Number(t.substring(0,t.length-1))*e/100}function AJ(t){return fJ.includes(t)}function kJ(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=_J(t,m,n,d,h,a),i=yJ(t,f,n,d,c,a);u.push([{x:e,y:i}])}else if(e){const e=_J(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=yJ(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 MJ(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=bJ(t,l,n,r),i=xJ(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=bJ(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=xJ(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function TJ(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=YF(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=YF(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])&&vJ(_,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])&&vJ(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 wJ(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])&&vJ(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])&&vJ(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 CJ(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 YF(e)&&(e=SJ(e,r)),e+=s,YF(i)&&(i=SJ(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 YF(e)&&(e=SJ(e,s)),YF(i)&&(i=SJ(i,n)),{x:e,y:i}}))}function EJ(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 PJ(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},lz(r.style)):t.shape={visible:!1},!1!==s.visible?(t.panel=Object.assign({visible:!0},RJ(lz(s.style),i)),p(s.padding)&&(t.padding=ei(s.padding))):(t.panel={visible:!1},t.padding=0),n&&(t.textStyle=RJ(lz(n),i)),t}return{visible:!1}}function BJ(t,e){for(const i in t)d(t[i])&&(t[i]=t[i](e));return t}function RJ(t,e){return d(t)?t(e):t}function LJ(t,e){return d(t)?t(e):t}function OJ(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 IJ(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 DJ(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 FJ(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function jJ(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=>HJ(i,t,e))):s.x=HJ(i,t,e)}if(p(e.y)){const i=e.y;y(i)?s.y=i.map((i=>HJ(i,t,e))):s.y=HJ(i,t,e)}if(p(e.angle)){const i=e.angle;y(i)?s.angle=i.map((i=>HJ(i,t,e))):s.angle=HJ(i,t,e)}if(p(e.radius)){const i=e.radius;y(i)?s.radius=i.map((i=>HJ(i,t,e))):s.radius=HJ(i,t,e)}if(p(e.areaName)){const i=e.areaName;s.areaName=HJ(i,t,e)}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),i.push(s)})),i}const zJ={min:(t,e)=>qP(t[0].latestData,e.field),max:(t,e)=>ZP(t[0].latestData,e.field),sum:function(t,e){return JP(t[0].latestData,e.field)},average:function(t,e){return QP(t[0].latestData,e.field)},variance:function(t,e){return tB(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(tB(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 HJ(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 zJ[i](e,{field:s})}return t}class VJ extends jG{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)&&AJ(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])&&AJ(t[h])?i.x={field:h,aggrType:t[h]}:i.x=Y(h).map((e=>t[e])),_(t[c])&&AJ(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])&&AJ(t[o])?i.angle={field:o,aggrType:t[o]}:i.angle=Y(o).map((e=>t[e])),_(t[l])&&AJ(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=rB(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=KF(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=KF(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 NJ(t,e){return function(t,e,i){const{predict:s}=_b(t,(t=>t[e]),(t=>t[i])),n=qP(t,e),r=ZP(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 GJ(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 WJ extends VJ{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}=IJ(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:RJ(lz(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:PJ(y,this._markerData),state:{line:BJ(null!==(a=null===(r=this._spec.line)||void 0===r?void 0:r.state)&&void 0!==a?a:{},this._markerData),lineStartSymbol:BJ(null!==(l=null===(o=this._spec.startSymbol)||void 0===o?void 0:o.state)&&void 0!==l?l:{},this._markerData),lineEndSymbol:BJ(null!==(c=null===(h=this._spec.endSymbol)||void 0===h?void 0:h.state)&&void 0!==c?c:{},this._markerData),label:BJ(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:BJ(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:lz(b.style)}):S.startSymbol={visible:!1},x.visible?S.endSymbol=Object.assign(Object.assign({},x),{visible:!0,style:lz(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}=EJ([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}=IJ(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;Dz(this._option.dataSet,"markerAggregation",jJ),Dz(this._option.dataSet,"markerRegression",NJ),Dz(this._option.dataSet,"markerFilter",GJ);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}}WJ.specKey="markLine";class UJ extends WJ{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new UE(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:_}=IJ(e);let y=[];if(u||m||g||f||v||a&&l||a&&h){const t=kJ(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=TJ(i,r,d,e.coordinatesOffset):c&&(y=CJ(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(YF(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}=IJ(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}}}UJ.type=r.markLine,UJ.coordinateType="cartesian";class YJ extends WJ{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=IJ(this._spec);return e||i?new XE(t):new UE(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}=IJ(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=MJ(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=wJ(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}=IJ(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}}}YJ.type=r.polarMarkLine,YJ.coordinateType="polar";class KJ extends jG{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=UF(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 bP(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}}KJ.type=r.title,KJ.specKey=r.title;class XJ extends VJ{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=DJ(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:RJ(lz(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:PJ(u,this._markerData),state:{area:BJ(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData),label:BJ(null===(o=this._spec.label)||void 0===o?void 0:o.state,this._markerData),labelBackground:BJ(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}=EJ([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}=DJ(t);if(!(e||i||s||n||r||a||o))return null;const{options:l}=this._computeOptions(),h=this._getRelativeDataView();Dz(this._option.dataSet,"markerAggregation",jJ),Dz(this._option.dataSet,"markerFilter",GJ);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}}XJ.specKey="markArea";class $J extends XJ{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new KE(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}=DJ(e),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t;let u=[],g=[];if(l){g=kJ(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=kJ(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[...t,e[1],e[0]])}else h?u=TJ(i,r,d,e.coordinatesOffset):c&&(u=CJ(e.positions,r,e.regionRelative));return{points:u}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=DJ(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}}}$J.type=r.markArea,$J.coordinateType="cartesian";class qJ extends XJ{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=DJ(this._spec);return i||e||s?new $E(t):new KE(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}=DJ(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=MJ(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=wJ(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}=DJ(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}}}qJ.type=r.polarMarkArea,qJ.coordinateType="polar";const ZJ=t=>lz(Object.assign({},t)),JJ=t=>Object.assign(Object.assign({},t),{style:Object.assign({},lz(t.style))}),QJ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,m;const f=ZJ(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=ZJ(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:{},lz(Object.assign({},y)));var y;const b=JJ(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=JJ(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=JJ(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=JJ(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},tQ=t=>"left"===t||"right"===t,eQ=t=>"top"===t||"bottom"===t;class iQ extends jG{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({},QJ(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({},QJ(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 DP(t):this._playerComponent=new zP(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=tQ(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=tQ(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(PP.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(PP.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(PP.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(PP.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(PP.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(PP.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=tQ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=eQ(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)):tQ(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))):eQ(this._orient)?this._maxSize():t.height}_computeDx(t){return tQ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return eQ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}}iQ.specKey="player",iQ.type=r.player;class sQ extends jG{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)))}}sQ.type=r.label;class nQ extends rY{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}}nQ.type="text",nQ.constructorType="label";const rQ=()=>{hz.registerMark(nQ.constructorType,nQ),vO()};class aQ extends FG{_initTheme(t,e){return{spec:t,theme:this._theme}}}class oQ extends sQ{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=aQ,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),sB(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=Tj({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=HU[t])&&void 0!==i?i:HU.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}:VU(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}}oQ.type=r.label,oQ.specKey="label",oQ.transformerConstructor=aQ;class lQ extends sQ{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[PD]},"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 Tj({textStyle:{pickable:!0===this._spec.interactive},position:hQ(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[RD]))},a))}})).encode((e=>VU({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 hQ(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}lQ.type=r.totalLabel,lQ.specKey="totalLabel";class cQ extends VJ{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=FJ(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:LJ(E.offsetX,this._relativeSeries.getRegion()),offsetY:LJ(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:RJ(B.style,this._markerData)},state:{line:BJ(null!==(h=null===(l=this._spec.itemLine.line)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData),lineStartSymbol:BJ(null!==(d=null===(c=this._spec.itemLine.startSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData),lineEndSymbol:BJ(null!==(p=null===(u=this._spec.itemLine.endSymbol)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData),symbol:BJ(null!==(m=null===(g=this._spec.itemContent.symbol)||void 0===g?void 0:g.state)&&void 0!==m?m:{},this._markerData),image:BJ(null!==(v=null===(f=this._spec.itemContent.image)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData),text:BJ(null!==(y=null===(_=this._spec.itemContent.text)||void 0===_?void 0:_.state)&&void 0!==y?y:{},this._markerData),textBackground:BJ(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:BJ(null!==(A=null===(S=this._spec.itemContent.richText)||void 0===S?void 0:S.state)&&void 0!==A?A:{},this._markerData),customMark:BJ(null!==(M=null===(k=this._spec.itemContent.customMark)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData),targetItem:BJ(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=lz(RJ(L.style,this._markerData))),(null==O?void 0:O.style)&&(F.itemContent.imageStyle=RJ(O.style,this._markerData)),R&&(F.itemContent.textStyle=PJ(R,this._markerData)),(null==I?void 0:I.style)&&(F.itemContent.richTextStyle=RJ(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:lz(z.style)}):{visible:!1};return new ZE(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}=EJ([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:OJ(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:OJ(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}=FJ(t);if(!(p(t.coordinate)||e||i||s))return;Dz(this._option.dataSet,"markerAggregation",jJ),Dz(this._option.dataSet,"markerFilter",GJ);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}}cQ.specKey="markPoint";class dQ extends cQ{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=kJ(i,s,s,s,o)[0][0]:r?l=TJ(i,s,o,e.coordinatesOffset)[0]:a&&(l=CJ([e.position],s,e.regionRelative)[0]),{point:l}}_computeOptions(){const t=this._spec,{doXYProcess:e}=FJ(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}}}dQ.type=r.markPoint,dQ.coordinateType="cartesian";class uQ extends cQ{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=MJ(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}])]}}}uQ.type=r.polarMarkPoint,uQ.coordinateType="polar";class pQ extends cQ{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}])]}}}pQ.type=r.geoMarkPoint,pQ.coordinateType="geo";const gQ="inBrush",mQ="outOfBrush";class fQ extends jG{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),gQ,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),mQ,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 GP(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:lz(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(FP.drawStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(FP.moveStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(FP.drawing,(s=>{this._needInitOutState&&"single"===o&&this._initMarkBrushState(i,mQ),this._needInitOutState=!1,this._needDisablePickable=!0,this._handleBrushChange(t.ChartEvent.brushChange,e,s),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(FP.moving,(i=>{this._handleBrushChange(t.ChartEvent.brushChange,e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(FP.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(FP.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(FP.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({},lz(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(gQ),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(gQ),i.addState(mQ),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(gQ),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(gQ),i.addState(mQ),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(gQ),i.removeState(mQ),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}}}fQ.type=r.brush,fQ.specKey="brush";class vQ extends jG{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,`${hB}_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=uG({},pG(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}}}vQ.type=r.customMark,vQ.specKey="customMark";function _Q(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 yQ(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function bQ(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:yQ(t.rect),anchorCandidates:TQ(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=>_Q(t,r)));if(n.anchorCandidates)if(a&&(null===(e=n.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;t_Q(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 xQ(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=kQ(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(!kQ(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],SQ(AQ(t.point,l)))):t.point;n&&(s.x=n.x,s.y=n.y);const r=SQ(AQ(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=MQ(t.rect,a,0),t}));return bQ(h)}function SQ(t){return t>180?t-360:t}function AQ(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function kQ(t,e){for(let i=0;i{const{x:r,y:a}=MQ(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,s);n.push({x:r,y:a})})),n}class wQ extends jG{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:Xz.copyDataView},!1),this._data=new DH(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 ZE({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=$F(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=ku({});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=Tg(lz(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=bg(lz(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=mp(lz(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=mp(lz(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=MQ(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:lz(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]}))):bQ(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}}wQ.type=r.mapLabel,wQ.specKey="mapLabel";class CQ{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=>EQ(t))),a=n.filter((t=>!EQ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>EQ(t))),h=o.filter((t=>!EQ(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 EQ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}CQ.type="grid";sV.useRegisters([()=>{iI(),sI(),EG(),RG(),ZH(),XH(),tW(),ZG(),hz.registerSeries(nW.type,nW),hz.registerChart(pW.type,pW)},()=>{iI(),sI(),EG(),mW(),RG(),vW(),tW(),ZG(),hz.registerSeries(yW.type,yW),hz.registerChart(xW.type,xW)},()=>{OW(),hz.registerChart(DW.type,DW)},()=>{$W(),hz.registerChart(ZW.type,ZW)},()=>{OY(),hz.registerChart(zq.type,zq)},()=>{QY(),hz.registerChart(Gq.type,Gq)},()=>{oK(),hz.registerChart(Uq.type,Uq)},()=>{OW(),hz.registerChart(Zq.type,Zq)},()=>{TU(),hz.registerChart(Lq.type,Lq)},()=>{nq(),hz.registerSeries(aq.type,aq),PY(),_K(),$Y(),hz.registerChart(iZ.type,iZ)},()=>{oX(),hz.registerChart(aZ.type,aZ)},()=>{wX(),hz.registerChart(cZ.type,cZ)},()=>{ZU(),hz.registerChart(MZ.type,MZ)},()=>{sY(),RG(),XH(),tW(),ZG(),hz.registerSeries(nY.type,nY),hz.registerChart(wZ.type,wZ)},()=>{hz.registerSeries(bK.type,bK),PY(),_K(),$H(),ZY(),$Y(),hz.registerChart(tZ.type,tZ)},()=>{wK(),hz.registerChart(pZ.type,pZ)},()=>{mY(),hz.registerChart(mZ.type,mZ)},()=>{mW(),tW(),ZG(),hz.registerSeries(_Y.type,_Y),hz.registerChart(BZ.type,BZ)},()=>{b$(),hz.registerChart(yZ.type,yZ)},()=>{M$(),hz.registerChart(xZ.type,xZ)},()=>{Q$(),hz.registerChart(AZ.type,AZ)},()=>{K$(),hz.registerChart(EZ.type,EZ)},()=>{pq(),hz.registerChart(LZ.type,LZ)},()=>{Aq(),hz.registerChart(IZ.type,IZ)},()=>{hz.registerChart(Kq.type,Kq)},ZG,tW,()=>{GG(),hz.registerComponent(eW.type,eW)},()=>{GG(),hz.registerComponent(iW.type,iW)},()=>{GG(),hz.registerComponent(sW.type,sW)},ZY,$Y,()=>{hz.registerComponent(HZ.type,HZ)},()=>{hz.registerComponent(KZ.type,KZ)},()=>{hz.registerComponent(eJ.type,eJ)},()=>{hz.registerComponent(aJ.type,aJ)},()=>{hz.registerComponent(oJ.type,oJ)},()=>{hz.registerComponent(uJ.type,uJ)},()=>{hz.registerComponent(pJ.type,pJ)},()=>{hz.registerComponent(mJ.type,mJ)},AU,()=>{hz.registerComponent(UJ.type,UJ),WE()},()=>{hz.registerComponent($J.type,$J),YE()},()=>{hz.registerComponent(dQ.type,dQ),qE()},()=>{hz.registerComponent(YJ.type,YJ),XE._animate=TE,WE()},()=>{hz.registerComponent(qJ.type,qJ),$E._animate=CE,YE()},()=>{hz.registerComponent(uQ.type,uQ),qE()},()=>{hz.registerComponent(pQ.type,pQ),qE()},()=>{hz.registerComponent(KJ.type,KJ)},()=>{hz.registerComponent(iQ.type,iQ)},()=>{zO(),rQ(),HG(),hz.registerComponent(oQ.type,oQ,!0)},()=>{zO(),rQ(),HG(),hz.registerComponent(lQ.type,lQ,!0)},()=>{hz.registerComponent(fQ.type,fQ)},()=>{hz.registerComponent(vQ.type,vQ)},()=>{hz.registerComponent(wQ.type,wQ)},()=>{ql.load(cT)},()=>{hz.registerLayout(CQ.type,CQ)},ZN,pV,UR,WR]),sV.useRegisters([()=>{cA(ql)}]),t.ARC_END_ANGLE=xB,t.ARC_K=SB,t.ARC_MIDDLE_ANGLE=AB,t.ARC_QUADRANT=kB,t.ARC_RADIAN=MB,t.ARC_RATIO=yB,t.ARC_START_ANGLE=bB,t.ARC_TRANSFORM_VALUE=_B,t.AxisSyncPlugin=xV,t.BASE_EVENTS=hD,t.CORRELATION_SIZE=fD,t.CORRELATION_X=gD,t.CORRELATION_Y=mD,t.CanvasTooltipHandler=qN,t.DEFAULT_CHART_HEIGHT=dB,t.DEFAULT_CHART_WIDTH=cB,t.DEFAULT_CONICAL_GRADIENT_CONFIG=HD,t.DEFAULT_DATA_INDEX=_D,t.DEFAULT_DATA_KEY=yD,t.DEFAULT_DATA_SERIES_FIELD=bD,t.DEFAULT_GRADIENT_CONFIG=VD,t.DEFAULT_LABEL_ALIGN=pB,t.DEFAULT_LABEL_LIMIT=uB,t.DEFAULT_LABEL_TEXT=gB,t.DEFAULT_LABEL_VISIBLE=mB,t.DEFAULT_LABEL_X=fB,t.DEFAULT_LABEL_Y=vB,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_GRADIENT_CONFIG=jD,t.DEFAULT_MEASURE_CANVAS_ID=vD,t.DEFAULT_RADIAL_GRADIENT_CONFIG=zD,t.DEFAULT_SERIES_STYLE_NAME=xD,t.DomTooltipHandler=$N,t.Factory=hz,t.FormatterPlugin=uV,t.GradientType=FD,t.MediaQuery=lV,t.POLAR_DEFAULT_RADIUS=EB,t.POLAR_END_ANGLE=270,t.POLAR_END_RADIAN=wB,t.POLAR_START_ANGLE=CB,t.POLAR_START_RADIAN=TB,t.PREFIX=hB,t.SEGMENT_FIELD_END=OD,t.SEGMENT_FIELD_START=LD,t.STACK_FIELD_END=MD,t.STACK_FIELD_END_OffsetSilhouette=ED,t.STACK_FIELD_END_PERCENT=wD,t.STACK_FIELD_KEY=AD,t.STACK_FIELD_START=kD,t.STACK_FIELD_START_OffsetSilhouette=CD,t.STACK_FIELD_START_PERCENT=TD,t.STACK_FIELD_TOTAL=PD,t.STACK_FIELD_TOTAL_PERCENT=BD,t.STACK_FIELD_TOTAL_TOP=RD,t.ThemeManager=Wj,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=sV,t.WaterfallDefaultSeriesField=pD,t.builtinThemes=Lj,t.computeActualDataScheme=LF,t.darkTheme=yj,t.dataScheme=JF,t.default=sV,t.defaultThemeName=Oj,t.getActualColor=IF,t.getColorSchemeBySeries=zF,t.getDataScheme=RF,t.getMergedTheme=Nj,t.getTheme=zj,t.hasThemeMerged=Fj,t.isColorKey=DF,t.isProgressiveDataColorScheme=FF,t.isTokenKey=fj,t.lightTheme=_j,t.queryColorFromColorScheme=OF,t.queryToken=mj,t.registerCanvasTooltipHandler=ZN,t.registerChartPlugin=oV,t.registerDomTooltipHandler=()=>{XN($N)},t.registerFormatPlugin=pV,t.registerMediaQuery=()=>{oV(lV)},t.registerTheme=jj,t.removeTheme=Hj,t.themeExist=Vj,t.themes=Ij,t.token=vj,t.transformColorSchemeToStandardStruct=jF,t.version="1.11.4",t.vglobal=P_,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 V(t){return Object.prototype.toString.call(t)}function N(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(V(t)!==V(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=N(t),n=N(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 Vt(t){return t>1?0:t<-1?Et:Math.acos(t)}function Nt(t){return t>=1?Pt:t<=-1?-Pt:Math.asin(t)}function Gt(t,e,i,s,n){let r,a;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 Ve,Ne,Ge,We;function Ue(t){return Ve=1/0,Ne=1/0,Ge=-1/0,We=-1/0,t.forEach((t=>{Ve>t.x&&(Ve=t.x),Get.y&&(Ne=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},Vi=Math.sqrt,Ni=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=Vi(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=Ns},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=Vs,Rs=Os=t,Ls=Is=e}function Vs(t,e){Fs.add(Is*t-Os*e),Os=t,Is=e}function Ns(){Vs(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=Vi(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=Vi(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(Vi(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 Vn=16,Nn=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=Vi(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()):Vi(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 Ni((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)*Vi(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 Vr(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 Vr(s).parse(t)},Yr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Lr.DSV,Nr(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",Va="Function",Na="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 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 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 No(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 No("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){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"linearClosed":return ll(t,i)}}class cl 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 dl=["l",0,0,0,0,0,0,0];function ul(t,e,i){const s=dl[0]=t[0];if("a"===s||"A"===s)dl[1]=e*t[1],dl[2]=i*t[2],dl[3]=t[3],dl[4]=t[4],dl[5]=t[5],dl[6]=e*t[6],dl[7]=i*t[7];else if("h"===s||"H"===s)dl[1]=e*t[1];else if("v"===s||"V"===s)dl[1]=i*t[1];else for(let s=1,n=t.length;s{at.getInstance().warn("空函数")}}),Cl=Object.assign(Object.assign({},bl),{points:[],cornerRadius:0,closePath:!0}),El=Object.assign(Object.assign({},bl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},bl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const Pl=Object.assign(Object.assign({},bl),{symbolType:"circle",size:10,keepDirIn3d:!0}),Bl=Object.assign(Object.assign(Object.assign({},bl),vl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Rl=Object.assign(Object.assign(Object.assign({},bl),vl),{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}),Ll=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},bl),{fill:!0,cornerRadius:0}),Ol=Object.assign(Object.assign({},Ll),{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 Il=new class{},Dl={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"}},Fl=!0,jl=!1,zl=/\w|\(|\)|-/,Hl=/[.?!,;:/,。?!、;:]/,Vl=/\S/;function Nl(t,e,i,s,n){if(!e||e<=0)return 0;const r=Il.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=Gl(t,a)),a}function Gl(t,e){let i=e;for(;zl.test(t[i-1])&&zl.test(t[i])||Hl.test(t[i]);)if(i--,i<=0)return e;return i}function Wl(t,e){const i=Il.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 Ul=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Yl=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=Bl.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=Gl(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=Gl(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}};Yl=Ul([Oa()],Yl);var Kl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Xl=Symbol.for("TextMeasureContribution");let $l=class extends Yl{};$l=Kl([Oa()],$l);const ql=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 Va: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===Da&&(t.cache=e,t.activated=!0)}},Zl=Symbol.for("CanvasFactory"),Jl=Symbol.for("Context2dFactory");function Ql(t){return ql.getNamed(Zl,Il.global.env)(t)}const th=1e-4,eh=Math.sqrt(3),ih=1/3;function sh(t){return t>-vh&&tvh||t<-vh}const rh=[0,0],ah=[0,0],oh=[0,0];function lh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function hh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function ch(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 dh(t){return(t%=Rt)<0&&(t+=Rt),t}function uh(t,e,i,s,n,r){if(r>e&&r>s||rn?o:0}function ph(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 fh(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(sh(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 yh=[-1,-1,-1],bh=[-1,-1];function xh(){const t=bh[0];bh[0]=bh[1],bh[1]=t}function Sh(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(sh(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,ih):Math.pow(i,ih),s=s<0?-Math.pow(-s,ih):Math.pow(s,ih);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+eh*Math.sin(e)))/(3*a),h=(-o+i*(s-eh*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,yh);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&xh(),p=ch(e,s,r,o,bh[0]),u>1&&(g=ch(e,s,r,o,bh[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(sh(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,yh);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=hh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);yh[0]=-l,yh[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>=yh[0]+t&&a<=yh[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=yh[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 Mh(t){return Math.round(t/Et*1e8)/1e8%2*Et}function Th(t,e){let i=Mh(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-Mh(i-n)):e&&i1&&(i||(h+=uh(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;wh[0]=S,wh[1]=A,Th(wh,Boolean(a[6])),S=wh[0],A=wh[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(fh(c,d,f,v,e,s,n))return!0}else h+=uh(c,d,f,v,s,n)||0;c=f,d=v;break;case po.C:if(i){if(gh(c,d,f,v,_,y,b,x,e,s,n))return!0}else h+=Sh(c,d,f,v,_,y,b,x,s,n)||0;c=b,d=x;break;case po.Q:if(i){if(ph(c,d,f,v,_,y,e,s,n))return!0}else h+=Ah(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+=uh(c,d,o,l,s,n),i){if(mh(f,v,_,k,k+M,T,e,w,n))return!0}else h+=kh(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(fh(u,p,o,p,e,s,n)||fh(o,p,o,l,e,s,n)||fh(o,l,u,l,e,s,n)||fh(u,l,u,p,e,s,n))return!0}else h+=uh(o,p,o,l,s,n),h+=uh(u,l,u,p,s,n);break;case po.Z:if(i){if(fh(c,d,u,p,e,s,n))return!0}else h+=uh(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},Bh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Rh=Symbol.for("VWindow"),Lh=Symbol.for("WindowHandlerContribution");let Oh=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&&(ql.getNamed(Lh,t.env).configure(this,t),this.actived=!0)},this._uid=ba.GenAutoIncrementId(),this.global=Il.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)}};Oh=Ph([Oa(),Bh("design:paramtypes",[])],Oh);var Ih=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fh=function(t,e){return function(i,s){e(i,s,t)}};let jh=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=Il.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=Eh.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:vl.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:vl.fontFamily,fontSize:vl.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=ql.get(Rh),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 zh;jh=Ih([Oa(),Fh(0,Ra(qa)),Fh(0,Ia(Xl)),Dh("design:paramtypes",[Object])],jh),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(zh||(zh={}));const Hh=new oe;let Vh=class{constructor(){this.matrix=new oe}init(t){return this.mode=zh.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=zh.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Hh.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(Hh.a,Hh.b,Hh.c,Hh.d,Hh.e,Hh.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Hh.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(Hh.a,Hh.b,Hh.c,Hh.d,Hh.e,Hh.f),this}scale(t,e,i){return this.mode===zh.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===zh.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Hh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Hh.a,Hh.b,Hh.c,Hh.d,Hh.e,Hh.f),this}translate(t,e){return this.mode===zh.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===zh.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Vh=Ih([Oa(),Dh("design:paramtypes",[])],Vh);const Nh={arc:xl,area:Sl,circle:Al,line:Tl,path:wl,symbol:Pl,text:Bl,rect:El,polygon:Cl,richtext:Rl,richtextIcon:Ol,image:Ll,group:kl,glyph:Ml},Gh=Object.keys(Nh);function Wh(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Uh={arc:Object.assign({},Nh.arc),area:Object.assign({},Nh.area),circle:Object.assign({},Nh.circle),line:Object.assign({},Nh.line),path:Object.assign({},Nh.path),symbol:Object.assign({},Nh.symbol),text:Object.assign({},Nh.text),rect:Object.assign({},Nh.rect),polygon:Object.assign({},Nh.polygon),richtext:Object.assign({},Nh.richtext),richtextIcon:Object.assign({},Nh.richtextIcon),image:Object.assign({},Nh.image),group:Object.assign({},Nh.group),glyph:Object.assign({},Nh.glyph)};class Yh{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Gh.forEach((t=>{this._defaultTheme[t]=Object.create(Uh[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;Gh.forEach((s=>{const n=Object.create(Uh[s]);t&&t[s]&&Wh(n,t[s]),i[s]&&Wh(n,i[s]),e[s]&&Wh(n,e[s]),this.combinedTheme[s]=n})),e.common&&Gh.forEach((t=>{Wh(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 Kh=new Yh;function Xh(t,e){return t.glyphHost?Xh(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)):Kh.getTheme()}return null}(t)||t.attachedThemeGraphic&&Xh(t.attachedThemeGraphic)||Kh.getTheme()}var $h=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=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 $h(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 Qh))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(sc(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 Qh))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=sc(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 Qh))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=sc(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 Qh))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=sc(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 Qh))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=ic.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(sc(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(sc(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,sc(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 Qh))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"):sc(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 tc))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=ic.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 nc(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 Qh,this.rootWheelEvent=new tc,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 lc{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return lc.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 hc{static Avaliable(){return!0}avaliable(){return hc.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 cc{static Avaliable(){return!!Il.global.getRequestAnimationFrame()}avaliable(){return cc.Avaliable()}tick(t,e){Il.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var dc;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(dc||(dc={}));class uc{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-uc.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*uc.bounceIn(2*t):.5*uc.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}}}uc.quadIn=uc.getPowIn(2),uc.quadOut=uc.getPowOut(2),uc.quadInOut=uc.getPowInOut(2),uc.cubicIn=uc.getPowIn(3),uc.cubicOut=uc.getPowOut(3),uc.cubicInOut=uc.getPowInOut(3),uc.quartIn=uc.getPowIn(4),uc.quartOut=uc.getPowOut(4),uc.quartInOut=uc.getPowInOut(4),uc.quintIn=uc.getPowIn(5),uc.quintOut=uc.getPowOut(5),uc.quintInOut=uc.getPowInOut(5),uc.backIn=uc.getBackIn(1.7),uc.backOut=uc.getBackOut(1.7),uc.backInOut=uc.getBackInOut(1.7),uc.elasticIn=uc.getElasticIn(1,.3),uc.elasticOut=uc.getElasticOut(1,.3),uc.elasticInOut=uc.getElasticInOut(1,.3*1.5);class pc{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 gc=new pc;class mc{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(){}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 fc extends mc{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let vc=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]:gc;this.id=t,this.timeline=e,this.status=Ao.INITIAL,this.tailAnimate=new _c(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.duration===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 fc((()=>{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 _c(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()}};vc.mode=ko.NORMAL,vc.interpolateMap=new Map;class _c{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 yc(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?uc[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?uc[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 yc(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 yc{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 bc=200,xc="cubicOut",Sc=1e3,Ac="quadInOut";var kc;!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"}(kc||(kc={}));const Mc=[!1,!1,!1,!1],Tc=[0,0,0,0],wc=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Tc[0]=t[0],Tc[2]=t[0],Tc[1]=t[1],Tc[3]=t[1],Tc):t:t:0,Cc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Ec=[1,2,3,0,1,2,3,0];function Pc(t,e,i,s){for(;t>=Rt;)t-=Rt;for(;t<0;)t+=Rt;for(;t>e;)e+=Rt;Cc[0].x=i,Cc[1].y=i,Cc[2].x=-i,Cc[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]:Ic.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)}}Ic.TimeOut=1e3/60;const Dc=new Ic,Fc=(t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class jc extends mc{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 zc;!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"}(zc||(zc={}));class Hc extends mc{constructor(t,e,i,s,n){super(t,e,i,s,n),this.newPointAnimateType="appear"===(null==n?void 0:n.newPointAnimateType)?"appear":"grow"}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}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?[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=Bc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),i.points=this.points}}class Vc extends mc{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 Nc extends Vc{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=Il.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 Gc extends Vc{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=Il.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 Wc extends mc{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 Uc extends mc{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?uc[n]:n;e=r(e),s.onUpdate(t,e,i)})),this.updating=!1)}}function Yc(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 Kc(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 Qc(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 td(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 sd(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}))),ad=(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]},od=(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 ad(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return ad(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);od(n[0],s,i),od(n[1],e-s,i)}};var ld;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(ld||(ld={}));class hd{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ld.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===ld.Color1){const e=hd.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];hd.store1[t]=e,hd.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=hd.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&&(hd.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],hd.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===ld.Color1){if(hd.store1[t])return;hd.store1[t]=i,hd.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(hd.store255[t])return;hd.store255[t]=i,hd.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function cd(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 dd(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)=>ud(y(t)?t[r]:t,y(e)?e[r]:e,i,s))):ud(t,e,i,s,n)}function ud(t,e,i,s,n){if(!t||!e)return t&&cd(t)||e&&cd(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=hd.Get(t,ld.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=hd.Get(e,ld.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:cd(a)})))});return o?dd(r,l,i,s,n):dd(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:md(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:md(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:md(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),cd(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)}hd.store255={},hd.store1={};const pd=[0,0,0,0],gd=[0,0,0,0];function md(t,e,i){return hd.Get(t,ld.Color255,pd),hd.Get(e,ld.Color255,gd),`rgba(${Math.round(pd[0]+(gd[0]-pd[0])*i)},${Math.round(pd[1]+(gd[1]-pd[1])*i)},${Math.round(pd[2]+(gd[2]-pd[2])*i)},${pd[3]+(gd[3]-pd[3])*i})`}const fd=(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=dd(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},vd=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?Qc(t):[],n=Qc(e);i&&s&&(i.fromTransform&&td(s,i.fromTransform.clone().getInverse()),td(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})))},yd=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],bd=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!yd.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]?hd.Get(t[n],ld.Color255):t[n],to:"string"==typeof r?hd.Get(r,ld.Color255):r,key:n}):i.push({from:t[n],to:r,key:n}),s=!0)})),s?i:null};class xd extends mc{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;vd(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&fd(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Sd=(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=_d(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=bd(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 xd({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Sc,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Ac)),c};class Ad extends mc{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;vd(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&&fd(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const kd=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Lc.includes(t))(i)||(e[i]=t[i])})),e},Md=(t,e,i)=>{const s=kd(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=Il.graphicService.creator.rect({x:0,y:0,width:a,height:o});n.appendChild(i),e.push(i)}))}},Td=(t,e,i)=>{const s=[],n=i?null:kd(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:kd(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=id(t.attribute),n=sd(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(Il.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=sd(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(Il.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=sd(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(Il.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 nd(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 nd(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(Il.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:rd(i)}];const s=[];return od(i,e,s),s})(t,e).forEach((t=>{s.push(Il.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 od(r,e,h),h})(t,e).forEach((t=>{s.push(Il.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=Qc(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(Il.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(Il.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Md(t,s,e),s};class Cd{static GetImage(t,e){var i;const s=Cd.cache.get(t);s?"fail"===s.loadState?Il.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):Cd.loadImage(t,e)}static GetSvg(t,e){var i;let s=Cd.cache.get(t);s?"fail"===s.loadState?Il.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"},Cd.cache.set(t,s),s.dataPromise=Il.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=Cd.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"},Cd.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Il.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Il.global.loadBlob(t):"json"===e&&(i.dataPromise=Il.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Cd.isLoading&&Cd.toLoadAueue.length){Cd.isLoading=!0;const t=Cd.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Cd.cache.set(i,n),n.dataPromise=Il.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((()=>{Cd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Cd.loading()})).catch((t=>{console.error(t),Cd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Cd.loading()}))}}),0)}static loadImage(t,e){const i=Ed(t,Cd.toLoadAueue);if(-1!==i)return Cd.toLoadAueue[i].marks.push(e),void Cd.loading();Cd.toLoadAueue.push({url:t,marks:[e]}),Cd.loading()}static improveImageLoading(t){const e=Ed(t,Cd.toLoadAueue);if(-1!==e){const t=Cd.toLoadAueue.splice(e,1);Cd.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Ed(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;Dd.x=n+(null!==(i=t.scrollX)&&void 0!==i?i:0),Dd.y=r+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else Dd.x=n,Dd.y=r;return Dd}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Il.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Il.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]:Rd;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Rd;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(Il.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:bc,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:xc),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 Bd.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(Bd),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=pl.x,y:e=pl.y,scaleX:i=pl.scaleX,scaleY:s=pl.scaleY,angle:n=pl.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),Il.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(pl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Pd.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),Il.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=dd(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=dd(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=dd(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 Xh(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:Il.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 cl).fromString(t):this.pathProxy=new cl,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",Il.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new ec(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)}}}jd.mixin(rc);class zd{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 Hd(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Vd(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 Nd=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class Gd{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=Vd(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Hd(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Vd(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 zd(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 zd(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 Wd(t,e){return Ud(t)}function Ud(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 Zd=0;function Jd(){return Zd++}var Qd;function tu(t){const e=[];let i=0,s="";for(let n=0;neu.set(t,!0)));const iu=new Map;function su(t){if(eu.has(t))return!0;if(iu.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>iu.set(t,!0)));const nu=Jd(),ru=Jd(),au=Jd(),ou=Jd(),lu=Jd(),hu=Jd(),cu=Jd(),du=Jd(),uu=Jd(),pu=Jd();Jd();const gu=Jd();Jd();const mu=Jd(),fu=Jd(),vu=Jd(),_u=Symbol.for("GraphicService"),yu=Symbol.for("GraphicCreator"),bu={"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"},xu=Object.keys(bu);var Su;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Su||(Su={}));let Au=class t extends jd{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=hu,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 Yh),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Yh)}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;Il.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),Il.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=pl.x,y:e=pl.y,dx:i=pl.dx,dy:s=pl.dy,scaleX:n=pl.scaleX,scaleY:r=pl.scaleY,angle:a=pl.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=Xh(this).group;this._AABBBounds.clear();const i=Il.graphicService.updateGroupAABBBounds(t,e,this._AABBBounds,this),{boundsPadding:s=e.boundsPadding}=t,n=wc(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(),Il.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Il.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,Il.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{Il.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),Il.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=Il.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 ku(t){return new Au(t)}Au.NOWORK_ANIMATE_ATTR=Fd;class Mu extends Au{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 Yh,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=>{Il.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=>{Il.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 Tu=Symbol.for("TransformUtil"),wu=Symbol.for("GraphicUtil"),Cu=Symbol.for("LayerService"),Eu=Symbol.for("StaticLayerHandlerContribution"),Pu=Symbol.for("DynamicLayerHandlerContribution"),Bu=Symbol.for("VirtualLayerHandlerContribution");var Ru,Lu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)};let Iu=Ru=class{static GenerateLayerId(){return`${Ru.idprefix}_${Ru.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Il.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(Eu):"dynamic"===t?ql.get(Pu):ql.get(Bu),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 Mu(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Ru.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)}};Iu.idprefix="visactor_layer",Iu.prefix_count=0,Iu=Ru=Lu([Oa(),Ou("design:paramtypes",[])],Iu);var Du=new xa((t=>{t(io).to(ao).inSingletonScope(),t(Rh).to(Oh),t(wu).to(jh).inSingletonScope(),t(Tu).to(Vh).inSingletonScope(),t(Cu).to(Iu).inSingletonScope()}));function Fu(t,e){return!(!t&&!e)}function ju(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function zu(t,e,i){return i&&t*e>0}function Hu(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Vu(t,e){return t*e>0}function Nu(t,e,i,s){return t*e>0&&0!==i&&0!==s}function Gu(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 Uu(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(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:m,outerEndAngle:f,innerEndAngle:v,innerStartAngle:_}=t.getParsePadAngle(o,l),y=u,b=u,x=u,S=u,A=Math.max(b,y),k=Math.max(x,S);let M=A,T=k;const w=n*It(m),C=n*jt(m),E=r*It(v),P=r*jt(v);let B,R,L,O;if((k>Ct||A>Ct)&&(B=n*It(f),R=n*jt(f),L=r*It(_),O=r*jt(_),hCt){const t=Ft(y,M),r=Ft(b,M),o=Wu(L,O,w,C,n,t,Number(c)),l=Wu(B,R,E,P,n,r,Number(c));M0&&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+B,s+n*jt(f))}else!a||a[0]?(e.moveTo(i+w,s+C),e.arc(i,s,n,m,f,!c)):e.moveTo(i+n*It(f),s+n*jt(f));if(!(r>Ct)||g<.001)!a||a[1]?e.lineTo(i+E,s+P):e.moveTo(i+E,s+P),d=!0;else if(T>Ct){const t=Ft(S,T),n=Ft(x,T),o=Wu(E,P,B,R,r,-n,Number(c)),l=Wu(w,C,L,O,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),T0&&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+L,s+O)}else!a||a[1]?e.lineTo(i+E,s+P):e.moveTo(i+E,s+P),!a||a[2]?e.arc(i,s,r,v,_,c):e.moveTo(i+r*It(_),s+r*jt(_))}return a?a[3]&&e.lineTo(i+n*It(o),s+n*jt(o)):e.closePath(),d}class Yu{static GetCanvas(){try{return Yu.canvas||(Yu.canvas=Il.global.createCanvas({})),Yu.canvas}catch(t){return null}}static GetCtx(){if(!Yu.ctx){const t=Yu.GetCanvas();Yu.ctx=t.getContext("2d")}return Yu.ctx}}class Ku extends le{static getInstance(){return Ku._instance||(Ku._instance=new Ku),Ku._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=Yu.GetCanvas(),s=Yu.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 Ku(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Xu{static GetSize(t){for(let e=0;e=t)return Xu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Xu.GenKey(t,e,i,s,n),l=Xu.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=Xu.GenKey(t,e,i,s,n);Xu.cache[l]?Xu.cache[l].push({width:a,height:o,pattern:r}):Xu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}Xu.cache={},Xu.ImageSize=[20,40,80,160,320,640,1280,2560];const $u=Symbol.for("ArcRenderContribution"),qu=Symbol.for("AreaRenderContribution"),Zu=Symbol.for("CircleRenderContribution"),Ju=Symbol.for("GroupRenderContribution"),Qu=Symbol.for("ImageRenderContribution"),tp=Symbol.for("PathRenderContribution"),ep=Symbol.for("PolygonRenderContribution"),ip=Symbol.for("RectRenderContribution"),sp=Symbol.for("SymbolRenderContribution"),np=Symbol.for("TextRenderContribution"),rp=Symbol.for("InteractiveSubRenderContribution"),ap=["radius","startAngle","endAngle",...Rd];class op extends jd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=ou}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=Xh(this).circle;this._AABBBounds.clear();const i=this.attribute,s=Il.graphicService.updateCircleAABBBounds(i,Xh(this).circle,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=wc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xh(this).circle[t]}needUpdateTags(t){return super.needUpdateTags(t,ap)}needUpdateTag(t){return super.needUpdateTag(t,ap)}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 cl;return o.arc(0,0,n,r,a),o}clone(){return new op(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return op.NOWORK_ANIMATE_ATTR}}function lp(t){return new op(t)}function hp(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 cp(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function dp(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)}op.NOWORK_ANIMATE_ATTR=Fd;class up{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=vu,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=Xh(this).text;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=this.attribute,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}updateWrapAABBBounds(t){var e,i,s,n;const r=Xh(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=Fc(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=Il.graphicUtil.textMeasure,k=new up(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===Qd.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=cp(x,o),M=dp(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=Xh(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=Fc(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 _=Il.graphicUtil.textMeasure,y=new up(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=Xh(this).text,a=Il.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=Fc(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=cp(x,o),e=this.cache.verticalList.length*b,i=dp(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=>tu(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===Qd.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=cp(x,o),M=this.cache.verticalList.length*b,T=dp(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 Xh(this).text[t]}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pp;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pp;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function mp(t){return new gp(t)}gp.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Fd),gp.baselineMapAlign={top:"left",bottom:"right",middle:"center"},gp.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class fp{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 vp(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 _p=new class extends fp{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 vp(t,e/2,i,s,n)}drawOffset(t,e,i,s,n,r){return vp(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 yp=new class extends fp{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 bp(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 xp=new class extends fp{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 bp(t,e/2,i,s,n)}drawFitDir(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)}};function Sp(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Ap=new class extends fp{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Sp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Sp(t,e/2+n,i,s)}};class kp extends fp{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 Mp=new kp;var Tp=new class extends kp{constructor(){super(...arguments),this.type="triangle"}};const wp=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Cp=Math.sin(Bt/10)*wp,Ep=-Math.cos(Bt/10)*wp;function Pp(t,e,i,s){const n=Cp*e,r=Ep*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 Bp=new class extends fp{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 Pp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Pp(t,e/2+n,i,s)}};const Rp=zt(3);function Lp(t,e,i,s){const n=e,r=n/Rp,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 Op=new class extends fp{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 Lp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Lp(t,e/2+n,i,s)}};function Ip(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 Dp=new class extends fp{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Ip(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Ip(t,e/2+n,i,s)}};function Fp(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var jp=new class extends fp{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}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)}};const zp=-.5,Hp=zt(3)/2,Vp=1/zt(12);function Np(t,e,i,s){const n=e/2,r=e*Vp,a=n,o=e*Vp+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(zp*n-Hp*r+i,Hp*n+zp*r+s),t.lineTo(zp*a-Hp*o+i,Hp*a+zp*o+s),t.lineTo(zp*l-Hp*h+i,Hp*l+zp*h+s),t.lineTo(zp*n+Hp*r+i,zp*r-Hp*n+s),t.lineTo(zp*a+Hp*o+i,zp*o-Hp*a+s),t.lineTo(zp*l+Hp*h+i,zp*h-Hp*l+s),t.closePath(),!1}var Gp=new class extends fp{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 Np(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Np(t,e/2+n,i,s)}};var Wp=new class extends fp{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 Up=new class extends fp{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 Yp=new class extends fp{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 Kp=zt(3);function Xp(t,e,i,s){const n=e*Kp;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var $p=new class extends kp{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Xp(t,e/2/Kp,i,s)}drawOffset(t,e,i,s,n){return Xp(t,e/2/Kp+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 Zp=new class extends fp{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 Jp(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 Qp=new class extends fp{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 Jp(t,e/4,i,s)}drawOffset(t,e,i,s,n){return Jp(t,e/4+n,i,s)}};function tg(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 eg=new class extends fp{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 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-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var sg=new class extends fp{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 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,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var rg=new class extends fp{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return ng(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return ng(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 ag(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var og=new class extends fp{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return ag(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return ag(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 lg(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 hg=new class extends fp{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 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-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function cg(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function dg(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var ug=new class extends fp{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)?dg(t,e,i,s):cg(t,e,i,s)}drawOffset(t,e,i,s,n){return S(e)?dg(t,e+2*n,i,s):cg(t,[e[0]+2*n,e[1]+2*n],i,s)}};const pg=new Qt;class gg{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;pg.x1=s.bounds.x1*t,pg.y1=s.bounds.y1*t,pg.x2=s.bounds.x2*t,pg.y2=s.bounds.y2*t,e.union(pg)}))}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 mg={};[_p,yp,xp,Ap,$p,Tp,Bp,Op,Dp,jp,Gp,Wp,Up,Mp,Yp,Zp,Qp,eg,sg,ug,rg,og,hg].forEach((t=>{mg[t.type]=t}));const fg={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"},vg=new Qt,_g=["symbolType","size",...Rd];let yg=class t extends jd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=fu}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=Xh(this).symbol;let{symbolType:i=e.symbolType}=this.attribute,s=mg[i];if(s)return this._parsedPath=s,s;if(s=t.userSymbolMap[i],s)return this._parsedPath=s,s;if(i=fg[i]||i,!0===((n=i).startsWith("{const e=(new cl).fromString(t.d),i={};xu.forEach((e=>{t[e]&&(i[bu[e]]=t[e])})),r.push({path:e,attribute:i}),vg.union(e.bounds)}));const a=vg.width(),o=vg.height(),l=1/Dt(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new gg(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var n;const r=(new cl).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 gg(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=Xh(this).symbol;this._AABBBounds.clear();const i=this.attribute,s=Il.graphicService.updateSymbolAABBBounds(i,Xh(this).symbol,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=wc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xh(this).symbol[t]}needUpdateTags(t){return super.needUpdateTags(t,_g)}needUpdateTag(t){return super.needUpdateTag(t,_g)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new cl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new cl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function bg(t){return new yg(t)}yg.userSymbolMap={},yg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Fd);const xg=["segments","points","curveType",...Rd];let Sg=class t extends jd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=du}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=Rc(i,s,e))}doUpdateAABBBounds(){const t=Xh(this).line;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateLineAABBBounds(e,Xh(this).line,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xh(this).line[t]}needUpdateTags(t){return super.needUpdateTags(t,xg)}needUpdateTag(t){return super.needUpdateTag(t,xg)}toCustomPath(){const t=this.attribute,e=new cl,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 Ag(t){return new Sg(t)}Sg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Fd);const kg=["width","x1","y1","height","cornerRadius",...Rd];class Mg extends jd{constructor(t){super(t),this.type="rect",this.numberType=gu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}doUpdateAABBBounds(){const t=Xh(this).rect;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateRectAABBBounds(e,Xh(this).rect,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xh(this).rect[t]}needUpdateTags(t){return super.needUpdateTags(t,kg)}needUpdateTag(t){return super.needUpdateTag(t,kg)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:s,height:n}=id(t),r=new cl;return r.moveTo(e,i),r.rect(e,i,s,n),r}clone(){return new Mg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Mg.NOWORK_ANIMATE_ATTR}}function Tg(t){return new Mg(t)}Mg.NOWORK_ANIMATE_ATTR=Fd;class wg extends jd{constructor(t){super(t),this.type="glyph",this.numberType=lu,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=Il.graphicService.updateGlyphAABBBounds(this.attribute,Xh(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 wg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return wg.NOWORK_ANIMATE_ATTR}}function Cg(t){return new wg(t)}wg.NOWORK_ANIMATE_ATTR=Fd;class Eg{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=Dl[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 Pg{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const s=Fc(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}=Wl(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}=Wl(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=Nl(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}=Wl(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||jl;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||Fl;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=Nl(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Wl(this.text.slice(t),this.character);return i+this.ellipsisWidth-s}return i}}const Bg=["width","height","image",...Rd];class Rg extends jd{constructor(t){super(t),this.type="image",this.numberType=cu,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=Xh(this).image;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateImageAABBBounds(e,Xh(this).image,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Ll[t]}needUpdateTags(t){return super.needUpdateTags(t,Bg)}needUpdateTag(t){return super.needUpdateTag(t,Bg)}clone(){return new Rg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Rg.NOWORK_ANIMATE_ATTR}}function Lg(t){return new Rg(t)}Rg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Fd);class Og extends Rg{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=wc(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=wc(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=Ll.width,height:e=Ll.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 Ig{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 Og?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=Dl[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Pg){const e=Vl.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 Og)break;if("vertical"===this.direction&&"vertical"!==s.direction){s.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";s.ellipsisStr=r;const{width:a}=Wl(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 Og)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 Og)break;const{width:n}=Wl(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 Og?t.width:t.getWidthWithEllips(this.direction)})),i}}class Dg{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=Dl[this.direction]}store(t){if(t instanceof Og){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 Ig(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 Og?"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=Nl(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 Pg(i,t.newLine,t.character),new Pg(s,!0,t.character)]}(t,s);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const Fg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...Rd];class jg extends jd{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=mu}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Rl.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:Rl.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:Rl.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:Rl.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:Rl.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:Rl.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:Rl.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:Rl.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=Xh(this).richtext;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateRichTextAABBBounds(e,Xh(this).richtext,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Rl[t]}needUpdateTags(t){return super.needUpdateTags(t,Fg)}needUpdateTag(t){return super.needUpdateTag(t,Fg)}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(){var t;const{textConfig:e=[],maxWidth:i,maxHeight:s,width:n,height:r,ellipsis:a,wordBreak:o,verticalDirection:l,textAlign:h,textBaseline:c,layoutDirection:d,singleLine:u,disableAutoWrapLine:p}=this.attribute,g=[];for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,g.push(t)}}else{const i=this.combinedStyleToCharacter(e[t]);if(S(i.text)&&(i.text=`${i.text}`),i.text&&i.text.includes("\n")){const t=i.text.split("\n");for(let e=0;e0,f="number"==typeof s&&Number.isFinite(s)&&s>0,v="number"==typeof n&&Number.isFinite(n)&&n>0&&(!m||n<=i),_="number"==typeof r&&Number.isFinite(r)&&r>0&&(!f||r<=s),y=new Eg(0,0,(v?n:m?i:0)||0,(_?r:f?s:0)||0,a,o,l,h,c,d||"horizontal",!v&&m,!_&&f,u||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),b=new Dg(y);if(p){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 jg.NOWORK_ANIMATE_ATTR}}function zg(t){return new jg(t)}jg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Fd);const Hg=["path","customPath",...Rd];class Vg extends jd{constructor(t){super(t),this.type="path",this.numberType=uu}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=Xh(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof cl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof cl?this.cache:t.path)}doUpdateAABBBounds(){const t=Xh(this).path;this.doUpdatePathShape(),this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updatePathAABBBounds(e,Xh(this).path,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new cl).fromString(t.path):t.customPath&&(this.cache=new cl,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xh(this).path[t]}needUpdateTags(t){return super.needUpdateTags(t,Hg)}needUpdateTag(t){return super.needUpdateTag(t,Hg)}toCustomPath(){return(new cl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Vg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Vg.NOWORK_ANIMATE_ATTR}}function Ng(t){return new Vg(t)}Vg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Fd);const Gg=["segments","points","curveType",...Rd];class Wg extends jd{constructor(t){super(t),this.type="area",this.numberType=au}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=Xh(this).area;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateAreaAABBBounds(e,Xh(this).area,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Rc(i,s,e))}getDefaultAttribute(t){return Xh(this).area[t]}needUpdateTags(t){return super.needUpdateTags(t,Gg)}needUpdateTag(t){return super.needUpdateTag(t,Gg)}toCustomPath(){const t=new cl,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 Wg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Wg.NOWORK_ANIMATE_ATTR}}function Ug(t){return new Wg(t)}Wg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Fd);const Yg=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Rd];class Kg extends jd{constructor(t){super(t),this.type="arc",this.numberType=nu}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=Xh(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);return Math.min(S(e,!0)?e:a*parseFloat(e)/100,a/2)}getParsedAngle(){const t=Xh(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=Xh(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=Nt(Number(l)/o*jt(g)),n=Nt(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=Xh(this).arc;this._AABBBounds.clear();const i=this.attribute,s=Il.graphicService.updateArcAABBBounds(i,Xh(this).arc,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=wc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return super.needUpdateTags(t,Yg)}needUpdateTag(t){return super.needUpdateTag(t,Yg)}getDefaultAttribute(t){return Xh(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 Kg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Kg.NOWORK_ANIMATE_ATTR}}function Xg(t){return new Kg(t)}Kg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Fd);const $g=["points","cornerRadius",...Rd];class qg extends jd{constructor(t){super(t),this.type="polygon",this.numberType=pu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=Xh(this).polygon;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updatePolygonAABBBounds(e,Xh(this).polygon,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Rc(i,s,e))}getDefaultAttribute(t){return Xh(this).polygon[t]}needUpdateTags(t){return super.needUpdateTags(t,$g)}needUpdateTag(t){return super.needUpdateTag(t,$g)}toCustomPath(){const t=this.attribute.points,e=new cl;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 Zg(t){return new qg(t)}qg.NOWORK_ANIMATE_ATTR=Fd;class Jg extends Au{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 Qg(t){return new Jg(t)}class tm{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 em extends tm{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 im{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 im.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},am=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},om=function(t,e){return function(i,s){e(i,s,t)}};function lm(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 hm(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 cm(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 dm(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),lm(t,t,[n+o,r+l,a+h]),lm(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),lm(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=nm.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]}lm(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),lm(i,i,[-s[0],-s[1],0]),cm(t,t,i)}}let um=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 tm],this._symbolBoundsContribitions=[new em],this._imageBoundsContribitions=[new tm],this._circleBoundsContribitions=[new tm],this._arcBoundsContribitions=[new tm],this._pathBoundsContribitions=[new tm]}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,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}=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 h=this.tempAABBBounds1,c=this.tempAABBBounds2;return h.setValue(i.x1,i.y1,i.x2,i.y2),c.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=dp(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=cp(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),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}=t,r=i;return n.forEach((t=>{r.add(t.x,t.y)})),r}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{r.add(t.x,t.y)}))})),r}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):Pc(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):(Pc(h,l,n,i),Pc(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&&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)}};um=rm([Oa(),om(0,Ra(yu)),am("design:paramtypes",[Object])],um);const pm=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 gm,mm;function fm(t){return gm||(gm=pm.CreateGraphic("text",{})),gm.initAttributes(t),gm.AABBBounds}const vm={x:0,y:0,z:0,lastModelMatrix:null};class _m{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=zu(o,l,n),p=Vu(o,c),g=Fu(n,r),m=ju(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;vm.x=n,vm.y=r,vm.z=a,vm.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=nm.allocate(),n=nm.allocate();dm(n,t,e),cm(s,d||s,n),vm.x=0,vm.y=0,vm.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),nm.free(n)}if(g&&!d){const s=t.getOffsetXY(e);vm.x+=s.x,vm.y+=s.y,vm.z=a,i.setTransformForCurrent()}else if(p)vm.x=0,vm.y=0,vm.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);vm.x+=s.x,vm.y+=s.y,this.transformWithoutTranslate(i,vm.x,vm.y,vm.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),vm.x=0,vm.y=0,vm.z=0;return vm}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=Xh(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,_=zu(d,u,h),y=Vu(d,g),b=Fu(h),x=ju(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&&nm.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}const ym=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 bm{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(bm.IsGradientStr(t))try{const e=ym(t)[0];if(e){if("linear"===e.type)return bm.ParseLinear(e);if("radial"===e.type)return bm.ParseRadial(e);if("conic"===e.type)return bm.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 xm(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 Sm(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 Am=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},km=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mm=function(t,e){return function(i,s){e(i,s,t)}};class Tm{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=Xh(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=Eh.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),Eh.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 wm=new Tm;let Cm=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)}))}};Cm=Am([Oa(),Mm(0,Ra(qa)),Mm(0,Ia(rp)),km("design:paramtypes",[Object])],Cm);class Em{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=Eh.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])),Eh.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 Pm=new Em;const Bm=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=xm(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T+r,innerRadius:M-r,startAngle:_-a,endAngle:y+a}),e.beginPath(),Uu(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=xm(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T-r,innerRadius:M+r,startAngle:_+a,endAngle:y-a}),e.beginPath(),Uu(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})}},Rm=Pm,Lm=wm;const Om=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=xm(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=xm(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()}}}},Im=Pm,Dm=wm;const Fm=new class extends Tm{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()}},jm=Et/2;function zm(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],-jm,0,!1)}if(t.lineTo(_[0],_[1]),!q(v,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,jm,!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],jm,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+jm,!1)}return t.closePath(),t}var Hm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Vm{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=xm(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(),zm(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=xm(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(),zm(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 Nm=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)}};Nm=Hm([Oa()],Nm);let Gm=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()}}};Gm=Hm([Oa()],Gm);const Wm=new Vm,Um=Pm,Ym=wm;const Km=new class extends Vm{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)}},Xm=new class extends Tm{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=Xh(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=wc(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?zm(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 $m=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=xm(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=xm(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=Pm,Zm=wm;var Jm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},tf=function(t,e){return function(i,s){e(i,s,t)}};let ef=class extends _m{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=nu,this.builtinContributions=[Bm,Lm,Rm],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||T>Ct)&&(O=n*It(y),I=n*jt(y),D=r*It(x),F=r*jt(x),uCt){const t=Ft(S,C),r=Ft(A,C),a=Wu(D,F,P,B,n,t,Number(p)),o=Wu(O,I,R,L,n,r,Number(p));if(C0&&e.arc(i+o.cx,s+o.cy,r,Ot(o.y11,o.x11),Ot(o.y01,o.x01),!p)}}else e.moveTo(i+P,s+B);if(!(r>Ct)||v<.001)e.lineTo(i+R,s+L),g=!0;else if(E>Ct){const t=Ft(M,E),n=Ft(k,E),a=Wu(R,L,O,I,r,-n,Number(p)),o=Wu(P,B,D,F,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),E0&&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(x),s+r*jt(x));return g}drawShape(t,e,i,s,n,r,a,o){const l=Xh(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++)Mc[s]=t,i&&(i=!(null!==(e=Mc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Mc[e]=!!t[e],i&&(i=!!Mc[e]);else Mc[0]=!1,Mc[1]=!1,Mc[2]=!1,Mc[3]=!1;return{isFullStroke:i,stroke:Mc}})(d);if((v||C)&&(e.beginPath(),Uu(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(),Uu(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),dd(o.color,l.color,h,!1)}(0,0,h,n);a||zu&&(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=Xh(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}};ef=Jm([Oa(),tf(0,Ra(qa)),tf(0,Ia($u)),Qm("design:paramtypes",[Object])],ef);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 _m{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=ou,this.builtinContributions=[Om,Dm,Im],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Xh(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=Xh(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function of(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 lf(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),of(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 cf=class extends _m{constructor(){super(...arguments),this.numberType=du}draw(t,e,i,s){const n=Xh(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;lf(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(),lf(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"===f)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=hl(t.points,f,{startPoint:e});return s=n,n})).filter((t=>!!t)),"linearClosed"===f){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===v){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],v,_,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=v*r;let g=0,m=!1;t.cache.forEach(((r,f)=>{if(m)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(m=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[f],[l,t.attribute],Ft(y,1),_,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,v,_,i,s,t,a,o)}};function df(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 uf(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),of(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),of(t,l,1,s),o=!1):o=!0}t.closePath()}cf=hf([Oa()],cf);const pf=new class extends Em{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:Oc(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Oc(l,"textureColor")),textureSize:b=(null!==(m=t.attribute.textureSize)&&void 0!==m?m:Oc(l,"textureSize")),texturePadding:x=(null!==(f=t.attribute.texturePadding)&&void 0!==f?f:Oc(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},gf=wm;var mf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ff=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)}};function _f(t,e,i){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"linearClosed":return ll(t,i)}}let yf=class extends _m{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=au,this.builtinContributions=[pf,gf],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=Xh(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}=t.attribute,b=this.valid(t,g,a,o);if(!b)return;const{doFill:x,doStroke:S}=b,{clipRange:A=g.clipRange,closePath:k,points:M,segments:T}=t.attribute;let{curveType:w=g.curveType}=t.attribute;if(k&&"linear"===w&&(w="linearClosed"),1===A&&!T&&!M.some((t=>!1===t.defined))&&"linear"===w)return this.drawLinearAreaHighPerformance(t,e,!!m,S,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(T&&T.length){let e,i;const s=T.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=_f(t.points,w,{startPoint:e});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=T.length-1;t>=0;t--){const e=T[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=T[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=_f(i,"stepBefore"===w?"stepAfter":"stepAfter"===w?"stepBefore":w),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!M||!M.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=M,i=[];for(let t=M.length-1;t>=0;t--)i.push({x:null!==(u=M[t].x1)&&void 0!==u?u:M[t].x,y:null!==(p=M[t].y1)&&void 0!==p?p:M[t].y});const s=_f(e,w),n=_f(i,"stepBefore"===w?"stepAfter":"stepAfter"===w?"stepBefore":w);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===A){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,x,v,S,y,r[c],[g,t.attribute],A,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=A*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,x,v,S,y,r[u],[g,t.attribute],Ft(m,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,x,v,S,y,t.attribute,g,A,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Xh(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=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),df(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),df(t,e,i,s),e.length=0,i.length=0)}n=o})),df(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},Af=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kf=function(t,e){return function(i,s){e(i,s,t)}};let Mf=class extends _m{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=uu,this.builtinContributions=[xf,bf],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:Xh(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=Xh(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Mf=Sf([Oa(),kf(0,Ra(qa)),kf(0,Ia(tp)),Af("design:paramtypes",[Object])],Mf);var Tf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 _m{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=gu,this.builtinContributions=[Wm,Ym,Um],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Xh(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=Hu(g,m,k,M,c),w=Nu(g,v,k,M),C=Fu(c,d),E=ju(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(),zm(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=Xh(t,null==s?void 0:s.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Ef=Tf([Oa(),Cf(0,Ra(qa)),Cf(0,Ia(ip)),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 _m{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=fu,this.builtinContributions=[$m,Zm,qm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=Xh(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=Xh(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Lf=Pf([Oa(),Rf(0,Ra(qa)),Rf(0,Ia(sp)),Bf("design:paramtypes",[Object])],Lf);const Of=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 If=new class extends Tm{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=Of.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=fm(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?(zm(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&&Of.free(C),w()}};var Df=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ff=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jf=function(t,e){return function(i,s){e(i,s,t)}};let zf=class extends _m{constructor(t){super(),this.textRenderContribitions=t,this.numberType=vu,this.builtinContributions=[If],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Xh(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=Fc(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=sm.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),sm.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=Xh(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=cp(l,f),_=dp(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=dp("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 Hf(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},Yf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kf=function(t,e){return function(i,s){e(i,s,t)}};let Xf=class extends _m{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=pu,this.builtinContributions=[Wf,Gf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Xh(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))?Hf(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 Hf(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=Vf(d,u),b=Vf(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*f);const S=Nf(h,_,y,d,u),A=Nf(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Vf(k,M),w=Nf(h,Vf(_,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=Xh(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Xf=Uf([Oa(),Kf(0,Ra(qa)),Kf(0,Ia(ep)),Yf("design:paramtypes",[Object])],Xf);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},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)}};const Jf=["","repeat-x","repeat-y","repeat"];let Qf=class extends _m{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=cu,this.builtinContributions=[Km,Xm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Xh(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(),zm(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,Jf[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 Cd.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Xh(t).image;this._draw(t,a,!1,i)}};Qf=$f([Oa(),Zf(0,Ra(qa)),Zf(0,Ia(Qu)),qf("design:paramtypes",[Object])],Qf);const tv=Symbol.for("IncrementalDrawContribution"),ev=Symbol.for("ArcRender"),iv=Symbol.for("AreaRender"),sv=Symbol.for("CircleRender"),nv=Symbol.for("GraphicRender"),rv=Symbol.for("GroupRender"),av=Symbol.for("LineRender"),ov=Symbol.for("PathRender"),lv=Symbol.for("PolygonRender"),hv=Symbol.for("RectRender"),cv=Symbol.for("SymbolRender"),dv=Symbol.for("TextRender"),uv=Symbol.for("RichTextRender"),pv=Symbol.for("GlyphRender"),gv=Symbol.for("ImageRender"),mv=Symbol.for("DrawContribution");var fv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)};const _v=Symbol.for("DrawItemInterceptor"),yv=new Qt,bv=new Qt;class xv{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return t.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){yv.copy(s.dirtyBounds),bv.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(yv),s.backupDirtyBounds.copy(bv)),!0}}class Sv{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 Av=class{constructor(){this.order=1,this.interceptors=[new xv,new Mv,new kv,new Sv]}afterDrawItem(t,e,i,s,n){for(let r=0;r(e=t.numberType===ru,!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&&nm.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Tv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},Cv=function(t,e){return function(i,s){e(i,s,t)}};const Ev=Symbol.for("RenderService");let Pv=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}};Pv=Tv([Oa(),Cv(0,Ra(mv)),wv("design:paramtypes",[Object])],Pv);var Bv=new xa((t=>{t(Ev).to(Pv)}));const Rv=Symbol.for("PickerService"),Lv=Symbol.for("GlobalPickerService");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};const Iv=Symbol.for("PickItemInterceptor");let Dv=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){if(!t.shadowRoot)return null;const{parentMatrix:r}=n||{};if(!r)return null;const a=e.pickContext;a.highPerformanceSave();const o=t.shadowRoot,l=sm.allocateByObj(r),h=new $t(l.a*i.x+l.c*i.y+l.e,l.b*i.x+l.d*i.y+l.f),c=e.pickGroup(o,h,l,s);return a.highPerformanceRestore(),c}};Dv=Ov([Oa()],Dv);let Fv=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}};Fv=Ov([Oa()],Fv);let jv=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===ru,!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()}};jv=Ov([Oa()],jv);var zv=new xa(((t,e,i)=>{i(Rv)||(t(Lv).toSelf(),t(Rv).toService(Lv)),t(jv).toSelf().inSingletonScope(),t(Iv).toService(jv),t(Dv).toSelf().inSingletonScope(),t(Iv).toService(Dv),t(Fv).toSelf().inSingletonScope(),t(Iv).toService(Fv),Ja(t,Iv)})),Hv=new xa((t=>{t(_u).to(um).inSingletonScope(),t(yu).toConstantValue(pm)}));const Vv=Symbol.for("AutoEnablePlugins"),Nv=Symbol.for("PluginService");var Gv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},Uv=function(t,e){return function(i,s){e(i,s,t)}};let Yv=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(Vv)&&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=[]}};Yv=Gv([Oa(),Uv(0,Ra(qa)),Uv(0,Ia(Vv)),Wv("design:paramtypes",[Object])],Yv);var Kv=new xa((t=>{t(Nv).to(Yv),function(t,e){t(qa).toDynamicValue((t=>{let{container:i}=t;return new Za(e,i)})).whenTargetNamed(e)}(t,Vv)})),Xv=new xa((t=>{Ja(t,eo)})),$v=new xa((t=>{t(Xl).to($l).inSingletonScope(),Ja(t,Xl)})),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)};let Jv=class{constructor(){this.type="static",this.offscreen=!1,this.global=Il.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=Ql({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()}};Jv=qv([Oa(),Zv("design:paramtypes",[])],Jv);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},t_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let e_=class{constructor(){this.offscreen=!1,this.type="virtual",this.global=Il.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(){}};e_=Qv([Oa(),t_("design:paramtypes",[])],e_);var i_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},s_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let n_=class{constructor(){this.offscreen=!0,this.type="dynamic",this.global=Il.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;const s=Ql({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){}};n_=i_([Oa(),s_("design:paramtypes",[])],n_);var r_=new xa((t=>{t(Jv).toSelf(),t(n_).toSelf(),t(e_).toSelf(),t(Eu).toService(Jv),t(Pu).toService(n_),t(Bu).toService(e_)}));var a_=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 o_(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 a_(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,s)}))}function h_(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 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)},u_=function(t,e){return function(i,s){e(i,s,t)}};let p_=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=Il.global,this.layerService=Il.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:bl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:bl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,sm.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=h_(e,i,bl.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=Of.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=sm.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))})):o_(t,bl.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),Of.free(n),sm.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(tv);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},m_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},f_=function(t,e){return function(i,s){e(i,s,t)}};let v_=class{constructor(t){this.groupRenderContribitions=t,this.numberType=hu}drawShape(t,e,i,s,n,r,a,o){const l=Xh(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=Hu(u,f,p,g,h),k=Nu(u,v,p,g),M=Fu(h,c),T=ju(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(),zm(e,i,s,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Fm));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=Xh(t,null==s?void 0:s.theme).group,l=n.modelMatrix;if(n.camera){const e=nm.allocate(),i=nm.allocate();dm(i,t,o),cm(e,l||e,i),n.modelMatrix=e,nm.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&&nm.free(n.modelMatrix),n.modelMatrix=l,n.baseGlobalAlpha/=a,d&&d.then?d.then((()=>{r?n.restore():n.highPerformanceRestore()})):r?n.restore():n.highPerformanceRestore()}};v_=g_([Oa(),f_(0,Ra(qa)),f_(0,Ia(Ju)),m_("design:paramtypes",[Object])],v_);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};let y_=class extends cf{constructor(){super(...arguments),this.numberType=du}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=Xh(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=zu(u,p,c),_=Vu(u,g),y=Fu(c),b=ju(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())}};y_=__([Oa()],y_);var b_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 x_=class extends yf{constructor(){super(...arguments),this.numberType=au}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=Xh(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=zu(u,d,c),m=Fu(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())}};x_=b_([Oa()],x_);var S_,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},k_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},M_=function(t,e){return function(i,s){e(i,s,t)}},T_=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"}(S_||(S_={}));let w_=class extends p_{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=S_.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 T_(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:bl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:bl.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 T_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return T_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>T_(this,void 0,void 0,(function*(){if(2!==t.count)yield l_(t,bl.zIndex,((i,s)=>{if(this.status===S_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return T_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return T_(this,void 0,void 0,(function*(){this.rendering&&(this.status=S_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=S_.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 T_(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:()=>T_(this,void 0,void 0,(function*(){yield l_(t,bl.zIndex,(t=>T_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};w_=A_([Oa(),M_(0,La(nv)),M_(1,Ra(y_)),M_(2,Ra(x_)),M_(3,Ra(qa)),M_(3,Ia(_v)),k_("design:paramtypes",[Array,Object,Object,Object])],w_);var C_=new xa((t=>{t(Tm).toSelf().inSingletonScope(),t(Em).toSelf().inSingletonScope(),t(mv).to(p_),t(tv).to(w_),t(rv).to(v_).inSingletonScope(),t(nv).toService(rv),Ja(t,Ju),t(Cm).toSelf().inSingletonScope(),Ja(t,rp),Ja(t,nv),t(Av).toSelf().inSingletonScope(),t(_v).toService(Av),Ja(t,_v)}));function E_(){E_.__loaded||(E_.__loaded=!0,ql.load(Du),ql.load(Hv),ql.load(Bv),ql.load(zv),ql.load(Kv),function(t){t.load(Xv),t.load($v),t.load(r_)}(ql),function(t){t.load(C_)}(ql))}E_.__loaded=!1,E_();const P_=ql.get(io);Il.global=P_;const B_=ql.get(wu);Il.graphicUtil=B_;const R_=ql.get(Tu);Il.transformUtil=R_;const L_=ql.get(_u);Il.graphicService=L_;const O_=ql.get(Cu);Il.layerService=O_;class I_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Il.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),Il.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){Il.graphicService.hooks.onAttributeUpdate.taps=Il.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onSetStage.taps=Il.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class D_{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 F_{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,Il.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))})),Il.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){Il.graphicService.hooks.onAddIncremental.taps=Il.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onClearIncremental.taps=Il.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Il.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 j_{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)),Il.graphicService.hooks.onRemove.unTap(this.key),Il.graphicService.hooks.onRelease.unTap(this.key),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?Il.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:Il.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return function(t){const e={};return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[ni(i)]=t[i])})),["fontSize","lineHeight"].forEach((i=>{const s=ni(i);u(t[i])||(e[s]=/^[0-9]*$/.test(`${t[i]}`)?`${t[i]}px`:`${t[i]}`)})),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:Xh(t).text)}getTransformOfText(t){const e=Xh(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=Il.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),f=o+m.left-p.left,v=l+m.top-p.top;if(a.left=`${f}px`,a.top=`${v}px`,"text"===t.type&&"position"===c&&(a=Object.assign(Object.assign({},a),this.getTransformOfText(t))),d(n.style)){const e=n.style({top:v,left:f,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)));Il.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"===Il.global.env&&(t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:bl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:bl.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&&Il.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"===Il.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 z_=new Qt;class H_{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()})),Il.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&&(z_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(z_,t.parent&&t.parent.globalTransMatrix)))})),Il.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))})),Il.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){Il.graphicService.hooks.beforeUpdateAABBBounds.taps=Il.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.afterUpdateAABBBounds.taps=Il.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)),Il.graphicService.hooks.onRemove.taps=Il.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const V_=new Qt;class N_{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=Xh(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,Il.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),Il.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&V_.copy(s)})),Il.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(V_.equals(i)||this.tryLayout(t,!1))})),Il.graphicService.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1)}))}deactivate(t){Il.graphicService.hooks.onAttributeUpdate.taps=Il.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.beforeUpdateAABBBounds.taps=Il.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.afterUpdateAABBBounds.taps=Il.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onSetStage.taps=Il.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const G_=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===dc.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=dc.INITIAL,Il.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),Il.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:cc},{mode:"timeout",cons:hc},{mode:"manual",cons:lc}];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!==dc.INITIAL&&(this.status=dc.PAUSE,!0)}resume(){return this.status!==dc.INITIAL&&(this.status=dc.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===dc.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===dc.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=dc.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=dc.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};G_.addTimeline(gc),G_.setFPS(60);class W_{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=hd.Get(e,ld.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)?hd.Get(e,ld.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}function U_(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 Y_(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 K_{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=nm.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=nm.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()})),i&&Il.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))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])this.htmlMap[o].root.render(r);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t){const i=n.createRoot(t);i.render(r),this.htmlMap||(this.htmlMap={}),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}}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 Z_="white";class J_ extends Au{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:Z_}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 Yh,this.hooks={beforeRender:new to(["stage"]),afterRender:new to(["stage"])},this.global=Il.global,!this.global.env&&$_()&&this.global.setEnv("browser"),this.window=ql.get(Rh),this.renderService=ql.get(Ev),this.pluginService=ql.get(Nv),this.layerService=ql.get(Cu),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:Z_,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||G_,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new pc,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 oc(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 W_(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 K_(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 D_))}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 I_))}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 F_))}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 H_,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 N_))}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 j_))}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){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(){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){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(){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];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];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){this.pickerService||(this.pickerService=ql.get(Rv));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){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){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;const e=ql.get(Rh),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;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 Q_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ty=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ey=new oe(1,0,0,1,0,0),iy={x:0,y:0};let sy=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 cl,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 sm.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(sm.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(sm.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},iy),function(t,e,i){return Ch(t,0,!1,e,i)}(this.path.commandList,iy.x,iy.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},iy);const i=xm(this,this.lineWidth,this.dpr);return function(t,e,i,s){return Ch(t,e,!0,i,s)}(this.path.commandList,i,iy.x,iy.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(ey,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=>sm.free(t))),this.stack.length=0}};sy=Q_([Oa(),ty("design:paramtypes",[Object,Number])],sy);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},ry=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ay={WIDTH:500,HEIGHT:500,DPR:1};let oy=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=ay.WIDTH,height:n=ay.HEIGHT,dpr:r=ay.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)}};oy.env="browser",oy=ny([Oa(),ry("design:paramtypes",[Object])],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};let hy=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}}};hy=ly([Oa()],hy);var cy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let uy=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}};uy=cy([Oa(),dy("design:paramtypes",[])],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)},my=function(t,e){return function(i,s){e(i,s,t)}};let fy=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=Il.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=nm.allocate();if(hm(i,e),a){if(i){const t=nm.allocate();r.modelMatrix=cm(t,a,i),nm.free(i)}}else hm(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=Xh(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=Xh(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&&nm.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),sm.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function vy(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&&vy(t,e,a,s,n),n.push(t[a],t[a+1]),i-a>2&&vy(t,a,i,s,n))}function _y(t,e){const i=t.length-1,s=[t[0]];return vy(t,0,i,e,s),s.push(t[i]),s}fy=py([Oa(),my(0,Ra(qa)),my(0,Ia(Iv)),gy("design:paramtypes",[Object])],fy);let yy=!1;const by=new xa((t=>{yy||(yy=!0,t(ef).toSelf().inSingletonScope(),t(ev).to(ef).inSingletonScope(),t(nv).toService(ev),t($u).toService(Cm),Ja(t,$u))}));let xy=!1;const Sy=new xa((t=>{xy||(xy=!0,t(Ef).toSelf().inSingletonScope(),t(hv).to(Ef).inSingletonScope(),t(nv).toService(hv),t(Gm).toSelf(),t(Nm).toSelf(),t(ip).toService(Gm),t(ip).toService(Nm),t(ip).toService(Cm),Ja(t,ip))}));let Ay=!1;const ky=new xa((t=>{Ay||(Ay=!0,t(cf).toSelf().inSingletonScope(),t(y_).toSelf().inSingletonScope(),t(av).to(cf).inSingletonScope(),t(nv).toService(av))}));let My=!1;const Ty=new xa((t=>{My||(My=!0,t(yf).toSelf().inSingletonScope(),t(iv).to(yf).inSingletonScope(),t(nv).toService(iv),t(qu).toService(Cm),Ja(t,qu),t(x_).toSelf().inSingletonScope())}));let wy=!1;const Cy=new xa((t=>{wy||(wy=!0,t(Lf).toSelf().inSingletonScope(),t(cv).to(Lf).inSingletonScope(),t(nv).toService(cv),t(sp).toService(Cm),Ja(t,sp))}));let Ey=!1;const Py=new xa((t=>{Ey||(Ey=!0,t(af).toSelf().inSingletonScope(),t(sv).to(af).inSingletonScope(),t(nv).toService(sv),t(Zu).toService(Cm),Ja(t,Zu))}));let By=!1;const Ry=new xa((t=>{By||(By=!0,t(dv).to(zf).inSingletonScope(),t(nv).toService(dv),t(np).toService(Cm),Ja(t,np))}));let Ly=!1;const Oy=new xa((t=>{Ly||(Ly=!0,t(Mf).toSelf().inSingletonScope(),t(ov).to(Mf).inSingletonScope(),t(nv).toService(ov),t(tp).toService(Cm),Ja(t,tp))}));let Iy=!1;const Dy=new xa((t=>{Iy||(Iy=!0,t(lv).to(Xf).inSingletonScope(),t(nv).toService(lv),t(ep).toService(Cm),Ja(t,ep))}));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};let jy=class{constructor(){this.numberType=lu}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=Xh(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};jy=Fy([Oa()],jy);let zy=!1;const Hy=new xa((t=>{zy||(zy=!0,t(pv).to(jy).inSingletonScope(),t(nv).toService(pv))}));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},Ny=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Gy=class extends _m{constructor(){super(),this.numberType=mu,this.builtinContributions=[If],this.init()}drawShape(t,e,i,s,n){const r=Xh(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=zu(o,l,!0),d=zu(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=Xh(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(),zm(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=Xh(t).richtext;this._draw(t,s,!1,i)}};Gy=Vy([Oa(),Ny("design:paramtypes",[])],Gy);let Wy=!1;const Uy=new xa((t=>{Wy||(Wy=!0,t(uv).to(Gy).inSingletonScope(),t(nv).toService(uv))}));let Yy=!1;const Ky=new xa((t=>{Yy||(Yy=!0,t(gv).to(Qf).inSingletonScope(),t(nv).toService(gv),t(Qu).toService(Cm),Ja(t,Qu))}));const Xy=(t,e)=>(d(qy.warnHandler)&&qy.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),$y=(t,e,i)=>{if(!d(qy.errorHandler))throw new Error(t);qy.errorHandler.call(null,t,e)},qy={silent:!1,warnHandler:!1,errorHandler:!1},Zy=$_(),Jy=Zy&&globalThis?globalThis.document:void 0;function Qy(t){return("desktop-browser"===t||"mobile-browser"===t)&&Zy}function tb(t){return eb(t)||"mobile-browser"===t}function eb(t){return t.includes("miniApp")||"lynx"===t||"wx"===t}let ib=0;function sb(){return ib>=9999999&&(ib=0),ib++}function nb(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function rb(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const ab=(t,e,i)=>(t.fields=e||[],t.fname=i,t),ob=t=>e=>R(e,t),lb=t=>{at.getInstance().error(t)},hb=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||lb("Access path missing open bracket: "+t),o>0&&h(),o=0,s=n+1):n>s?h():s=n+1}return o&&lb("Access path missing closing bracket: "+t),a&&lb("Access path missing closing quote: "+t),n>s&&(n+=1,h()),e})(t),n=1===s.length?s[0]:t;return ab((i&&i.get||ob)(s),[n],e||n)},cb=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(y(t)){const s=t.map((t=>hb(t,e,i)));return t=>s.map((e=>e(t)))}return hb(t,e,i)};cb("id");const db=ab((function(t){return t}),[],"identity"),ub=ab((function(){return 0}),[],"zero");ab((function(){return 1}),[],"one"),ab((function(){return!0}),[],"true"),ab((function(){return!1}),[],"false"),ab((function(){return{}}),[],"emptyObject");const pb=(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=>gb(t,r,n)))))},mb=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t;function fb(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 vb(t,e,i,s,n){let r=0,a=0;return fb(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function _b(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;fb(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:vb(t,e,i,n,h)}}function yb(t){return"horizontal"===t}function bb(t){return"vertical"===t}const xb=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Sb extends Au{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,xb.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=>xb.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"},Zb=(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 Jb 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=ic.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=ic.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=Zb(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=ic.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=Zb(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=ic.now()-i>this.config.press.time&&Zb(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},tx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ex=[0,0,0];let ix=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({},gl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},fl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},vl),{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 sm.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&&(sm.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(sm.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&&Xu.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&&(Y_(ex,[t,e,i],this.modelMatrix),t=ex[0],e=ex[1],i=ex[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&&(Y_(ex,[t,e,i],this.modelMatrix),t=ex[0],e=ex[1],i=ex[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Y_(ex,[e,i,s],this.modelMatrix),e=ex[0],i=ex[1],s=ex[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]:Il.global.measureTextMethod;var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Il.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:vl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:vl.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&&(Y_(ex,[e,i,s],this.modelMatrix),e=ex[0],i=ex[1],s=ex[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=Sm(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=xm(this,l,this.dpr),r.strokeStyle=Sm(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=hp(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=hp(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=>sm.free(t))),this.stack.length=0}};ix.env="browser",ix=Qb([Oa(),tx("design:paramtypes",[Object,Number])],ix);var 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},nx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let rx=class extends oy{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Il.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new ix(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 ax(t,e){return new xa((i=>{i(Zl).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Jl).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}rx.env="browser",rx=sx([Oa(),nx("design:paramtypes",[Object])],rx);const ox=ax(rx,ix);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},hx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cx=function(t,e){return function(i,s){e(i,s,t)}};let dx=class extends fy{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=Eh.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 px=class{constructor(){this.type="group",this.numberType=hu}contains(t,e,i){return!1}};px=ux([Oa()],px);const gx=new xa(((t,e,i,s)=>{gx.__vloaded||(gx.__vloaded=!0,t(Kb).to(px).inSingletonScope(),t(Xb).toService(Kb),Ja(t,Xb))}));gx.__vloaded=!1;var mx=gx;const fx=new xa(((t,e,i,s)=>{i(dx)||t(dx).toSelf().inSingletonScope(),i(Rv)?s(Rv).toService(dx):t(Rv).toService(dx)}));var vx,_x=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let bx=vx=class extends uy{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${vx.idprefix}_${vx.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Il.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:vx.GenerateCanvasId(),canvasControled:!0};this.canvas=new rx(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 rx({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)}};bx.env="browser",bx.idprefix="visactor_window",bx.prefix_count=0,bx=vx=_x([Oa(),yx("design:paramtypes",[])],bx);const xx=new xa((t=>{t(bx).toSelf(),t(Lh).toDynamicValue((t=>t.container.get(bx))).whenTargetNamed(bx.env)}));var 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)};class kx{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 Mx(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 Tx=class extends hy{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 kx(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 Mx(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Mx(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}}};Tx=Sx([Oa(),Ax("design:paramtypes",[])],Tx);const wx=new xa((t=>{wx.isBrowserBound||(wx.isBrowserBound=!0,t(Tx).toSelf().inSingletonScope(),t(eo).toService(Tx))}));function Cx(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Cx.__loaded||(Cx.__loaded=!0,t.load(wx),t.load(ox),t.load(xx),e&&function(t){t.load(mx),t.load(fx)}(t))}wx.isBrowserBound=!1,Cx.__loaded=!1;var Ex=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Px=class extends ix{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}};Px.env="feishu",Px=Ex([Oa()],Px);var Bx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Rx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Lx=class extends oy{constructor(t){super(t)}init(){this._context=new Px(this,this._dpr)}release(){}};Lx.env="feishu",Lx=Bx([Oa(),Rx("design:paramtypes",[Object])],Lx);const Ox=ax(Lx,Px);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)},Fx=function(t,e){return function(i,s){e(i,s,t)}};class jx{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 zx=class extends uy{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new jx}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 Lx(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 Lx({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()}};zx.env="feishu",zx=Ix([Oa(),Fx(0,Ra(io)),Dx("design:paramtypes",[Object])],zx);const Hx=new xa((t=>{t(zx).toSelf(),t(Lh).toDynamicValue((t=>t.container.get(zx))).whenTargetNamed(zx.env)}));var Vx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Gx=function(t,e){return function(i,s){e(i,s,t)}};let Wx=class extends fy{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 sy(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}};Wx=Vx([Oa(),Gx(0,Ra(qa)),Gx(0,Ia(Ab)),Gx(1,Ra(qa)),Gx(1,Ia(Iv)),Nx("design:paramtypes",[Object,Object])],Wx);const Ux=new xa((t=>{Ux.__vloaded||(Ux.__vloaded=!0,Ja(t,Ab))}));Ux.__vloaded=!1;var Yx=Ux,Kx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$x=function(t,e){return function(i,s){e(i,s,t)}};let qx=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=nu}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=Xh(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}};qx=Kx([Oa(),$x(0,Ra(ev)),Xx("design:paramtypes",[Object])],qx);let Zx=!1;const Jx=new xa(((t,e,i,s)=>{Zx||(Zx=!0,t(kb).to(qx).inSingletonScope(),t(Ab).toService(kb))}));var Qx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},eS=function(t,e){return function(i,s){e(i,s,t)}};let iS=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=au}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=Xh(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}};iS=Qx([Oa(),eS(0,Ra(iv)),tS("design:paramtypes",[Object])],iS);let sS=!1;const nS=new xa(((t,e,i,s)=>{sS||(sS=!0,t(Mb).to(iS).inSingletonScope(),t(Ab).toService(Mb))}));var rS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oS=function(t,e){return function(i,s){e(i,s,t)}};let lS=class{constructor(t){this.canvasRenderer=t,this.type="circle",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=Xh(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}};lS=rS([Oa(),oS(0,Ra(sv)),aS("design:paramtypes",[Object])],lS);let hS=!1;const cS=new xa(((t,e,i,s)=>{hS||(hS=!0,t(Tb).to(lS).inSingletonScope(),t(Ab).toService(Tb))}));var dS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pS=function(t,e){return function(i,s){e(i,s,t)}};let gS=class{constructor(t){this.canvasRenderer=t,this.type="glyph",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=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}};gS=dS([Oa(),pS(0,Ra(pv)),uS("design:paramtypes",[Object])],gS);let mS=!1;const fS=new xa(((t,e,i,s)=>{mS||(mS=!0,t(Ob).to(gS).inSingletonScope(),t(gS).toService(Ob))}));var vS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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{constructor(){this.type="image",this.numberType=cu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};_S=vS([Oa()],_S);let yS=!1;const bS=new xa(((t,e,i,s)=>{yS||(yS=!0,t(wb).to(_S).inSingletonScope(),t(_S).toService(wb))}));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},SS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},AS=function(t,e){return function(i,s){e(i,s,t)}};let kS=class{constructor(t){this.canvasRenderer=t,this.type="line",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=Xh(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}};kS=xS([Oa(),AS(0,Ra(av)),SS("design:paramtypes",[Object])],kS);let MS=!1;const TS=new xa(((t,e,i,s)=>{MS||(MS=!0,t(Cb).to(kS).inSingletonScope(),t(Ab).toService(Cb))}));var wS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ES=function(t,e){return function(i,s){e(i,s,t)}};let PS=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=pu}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=Xh(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}};PS=wS([Oa(),ES(0,Ra(lv)),CS("design:paramtypes",[Object])],PS);let BS=!1;const RS=new xa(((t,e,i,s)=>{BS||(BS=!0,t(Lb).to(PS).inSingletonScope(),t(Ab).toService(Lb))}));var LS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},OS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IS=function(t,e){return function(i,s){e(i,s,t)}};let DS=class{constructor(t){this.canvasRenderer=t,this.type="path",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=Xh(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}};DS=LS([Oa(),IS(0,Ra(ov)),OS("design:paramtypes",[Object])],DS);let FS=!1;const jS=new xa(((t,e,i,s)=>{FS||(FS=!0,t(Eb).to(DS).inSingletonScope(),t(Ab).toService(Eb))}));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},HS=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)}};const NS=new Qt;let GS=class{constructor(t){this.canvasRenderer=t,this.type="rect",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=Xh(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;NS.setValue(i.x1,i.y1,i.x2,i.y2),NS.expand(-r/2),h=!NS.containsPoint(e)}}return s.highPerformanceRestore(),h}};GS=zS([Oa(),VS(0,Ra(hv)),HS("design:paramtypes",[Object])],GS);let WS=!1;const US=new xa(((t,e,i,s)=>{WS||(WS=!0,t(Pb).to(GS).inSingletonScope(),t(Ab).toService(Pb))}));let YS=!1;const KS=new xa(((t,e,i,s)=>{YS||(YS=!0,t(wb).to(_S).inSingletonScope(),t(_S).toService(wb))}));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},$S=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qS=function(t,e){return function(i,s){e(i,s,t)}};let ZS=class{constructor(t){this.canvasRenderer=t,this.type="symbol",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=Xh(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}};ZS=XS([Oa(),qS(0,Ra(cv)),$S("design:paramtypes",[Object])],ZS);let JS=!1;const QS=new xa(((t,e,i,s)=>{JS||(JS=!0,t(Bb).to(ZS).inSingletonScope(),t(Ab).toService(Bb))}));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};let eA=class{constructor(){this.type="text",this.numberType=vu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};eA=tA([Oa()],eA);let iA=!1;const sA=new xa(((t,e,i,s)=>{iA||(iA=!0,t(Rb).to(eA).inSingletonScope(),t(Ab).toService(Rb))})),nA=new xa(((t,e,i,s)=>{i(Wx)||t(Wx).toSelf().inSingletonScope(),i(Rv)?s(Rv).toService(Wx):t(Rv).toService(Wx)}));class rA{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 aA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let lA=class extends hy{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 rA(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 Dc.call(t)}}getCancelAnimationFrame(){return t=>{Dc.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}};lA=aA([Oa(),oA("design:paramtypes",[])],lA);const hA=new xa((t=>{hA.isFeishuBound||(hA.isFeishuBound=!0,t(lA).toSelf().inSingletonScope(),t(eo).toService(lA))}));function cA(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];cA.__loaded||(cA.__loaded=!0,t.load(hA),t.load(Ox),t.load(Hx),e&&function(t){t.load(Yx),t.load(nA),t.load(Jx),t.load(nS),t.load(cS),t.load(fS),t.load(bS),t.load(TS),t.load(RS),t.load(jS),t.load(US),t.load(KS),t.load(QS),t.load(sA)}(t))}hA.isFeishuBound=!1,cA.__loaded=!1;var dA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let pA=class extends ix{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(){}};pA.env="node",pA=dA([Oa(),uA("design:paramtypes",[Object,Number])],pA);var gA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let fA=class extends oy{constructor(t){super(t)}init(){this._context=new pA(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};fA.env="node",fA=gA([Oa(),mA("design:paramtypes",[Object])],fA);const vA=ax(fA,pA);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)},bA=function(t,e){return function(i,s){e(i,s,t)}};let xA=class extends uy{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 fA(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 fA({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){}};xA.env="node",xA=_A([Oa(),bA(0,Ra(io)),yA("design:paramtypes",[Object])],xA);const SA=new xa((t=>{t(xA).toSelf(),t(Lh).toDynamicValue((t=>t.container.get(xA))).whenTargetNamed(xA.env)}));var AA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 kA=class extends hy{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 Dc.call(t)}}getCancelAnimationFrame(){return t=>{Dc.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};kA=AA([Oa()],kA);const MA=new xa((t=>{MA.isNodeBound||(MA.isNodeBound=!0,t(kA).toSelf().inSingletonScope(),t(eo).toService(kA))}));function TA(t){TA.__loaded||(TA.__loaded=!0,t.load(MA),t.load(vA),t.load(SA))}MA.isNodeBound=!1,TA.__loaded=!1;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},CA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},EA=function(t,e){return function(i,s){e(i,s,t)}};let PA=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=nu}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=Xh(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=xm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};PA=wA([Oa(),EA(0,Ra(ev)),CA("design:paramtypes",[Object])],PA);let BA=!1;const RA=new xa(((t,e,i,s)=>{BA||(BA=!0,t(Ib).to(PA).inSingletonScope(),t(Xb).toService(Ib))}));var LA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},OA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IA=function(t,e){return function(i,s){e(i,s,t)}};const DA=new Qt;let FA=class{constructor(t){this.canvasRenderer=t,this.type="rect",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=Xh(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=xm(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;DA.setValue(i.x1,i.y1,i.x2,i.y2),DA.expand(-r/2),h=!DA.containsPoint(e)}}return s.highPerformanceRestore(),h}};FA=LA([Oa(),IA(0,Ra(hv)),OA("design:paramtypes",[Object])],FA);let jA=!1;const zA=new xa(((t,e,i,s)=>{jA||(jA=!0,t(Vb).to(FA).inSingletonScope(),t(Xb).toService(Vb))}));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 VA=class extends _m{};VA=HA([Oa()],VA);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},GA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},WA=function(t,e){return function(i,s){e(i,s,t)}};let UA=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="line",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;s.highPerformanceSave();const n=Xh(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=xm(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&nm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};UA=NA([Oa(),WA(0,Ra(av)),GA("design:paramtypes",[Object])],UA);let YA=!1;const KA=new xa(((t,e,i,s)=>{YA||(YA=!0,t(zb).to(UA).inSingletonScope(),t(Xb).toService(zb))}));var XA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},qA=function(t,e){return function(i,s){e(i,s,t)}};let ZA=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=au}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=Xh(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=xm(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h})),s.highPerformanceRestore(),h}};ZA=XA([Oa(),qA(0,Ra(iv)),$A("design:paramtypes",[Object])],ZA);let JA=!1;const QA=new xa(((t,e,i,s)=>{JA||(JA=!0,t(Db).to(ZA).inSingletonScope(),t(Xb).toService(Db))}));var tk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ik=function(t,e){return function(i,s){e(i,s,t)}};let sk=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=fu}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=Xh(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=xm(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&nm.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};sk=tk([Oa(),ik(0,Ra(cv)),ek("design:paramtypes",[Object])],sk);let nk=!1;const rk=new xa(((t,e,i,s)=>{nk||(nk=!0,t(Nb).to(sk).inSingletonScope(),t(Xb).toService(Nb))}));var ak=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ok=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lk=function(t,e){return function(i,s){e(i,s,t)}};let hk=class{constructor(t){this.canvasRenderer=t,this.type="circle",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=Xh(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=xm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};hk=ak([Oa(),lk(0,Ra(sv)),ok("design:paramtypes",[Object])],hk);let ck=!1;const dk=new xa(((t,e,i,s)=>{ck||(ck=!0,t(Fb).to(hk).inSingletonScope(),t(Xb).toService(Fb))}));var uk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gk=function(t,e){return function(i,s){e(i,s,t)}};let mk=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=vu}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=Xh(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=dp(a,u,n),v=cp(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&&nm.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};mk=uk([Oa(),gk(0,Ra(dv)),pk("design:paramtypes",[Object])],mk);let fk=!1;const vk=new xa(((t,e,i,s)=>{fk||(fk=!0,t(Gb).to(mk).inSingletonScope(),t(Xb).toService(Gb))}));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},yk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bk=function(t,e){return function(i,s){e(i,s,t)}};let xk=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="path",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=Xh(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=xm(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&nm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};xk=_k([Oa(),bk(0,Ra(ov)),yk("design:paramtypes",[Object])],xk);let Sk=!1;const Ak=new xa(((t,e,i,s)=>{Sk||(Sk=!0,t(Hb).to(xk).inSingletonScope(),t(Xb).toService(Hb))}));var kk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mk=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 wk=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=pu}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=Xh(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=xm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};wk=kk([Oa(),Tk(0,Ra(lv)),Mk("design:paramtypes",[Object])],wk);let Ck=!1;const Ek=new xa(((t,e,i,s)=>{Ck||(Ck=!0,t(Wb).to(wk).inSingletonScope(),t(Xb).toService(Wb))}));var Pk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rk=function(t,e){return function(i,s){e(i,s,t)}};let Lk=class{constructor(t){this.canvasRenderer=t,this.type="glyph",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=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}};Lk=Pk([Oa(),Rk(0,Ra(pv)),Bk("design:paramtypes",[Object])],Lk);let Ok=!1;const Ik=new xa(((t,e,i,s)=>{Ok||(Ok=!0,t(Yb).to(Lk).inSingletonScope(),t(Xb).toService(Yb))}));var Dk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Fk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jk=function(t,e){return function(i,s){e(i,s,t)}};let zk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=mu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};zk=Dk([Oa(),jk(0,Ra(uv)),Fk("design:paramtypes",[Object])],zk);let Hk=!1;const Vk=new xa(((t,e,i,s)=>{Hk||(Hk=!0,t(Ub).to(zk).inSingletonScope(),t(Xb).toService(Ub))}));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};let Gk=class{constructor(){this.type="image",this.numberType=cu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Gk=Nk([Oa()],Gk);let Wk=!1;const Uk=new xa(((t,e,i,s)=>{Wk||(Wk=!0,t(jb).to(Gk).inSingletonScope(),t(Xb).toService(jb))})),Yk=$_();function Kk(){Kk.__loaded||(Kk.__loaded=!0,pm.RegisterGraphicCreator("arc",Xg),ql.load(by),ql.load(Yk?RA:Jx))}Kk.__loaded=!1;const Xk=Kk;function $k(){$k.__loaded||($k.__loaded=!0,pm.RegisterGraphicCreator("area",Ug),ql.load(Ty),ql.load(Yk?QA:nS))}$k.__loaded=!1;const qk=$k;function Zk(){Zk.__loaded||(Zk.__loaded=!0,pm.RegisterGraphicCreator("circle",lp),ql.load(Py),ql.load(Yk?dk:cS))}Zk.__loaded=!1;const Jk=Zk;function Qk(){Qk.__loaded||(Qk.__loaded=!0,pm.RegisterGraphicCreator("glyph",Cg),ql.load(Hy),ql.load(Yk?Ik:fS))}Qk.__loaded=!1;const tM=Qk;function eM(){eM.__loaded||(eM.__loaded=!0,pm.RegisterGraphicCreator("group",ku))}eM.__loaded=!1;const iM=eM;function sM(){sM.__loaded||(sM.__loaded=!0,pm.RegisterGraphicCreator("image",Lg),ql.load(Ky),ql.load(Yk?Uk:bS))}sM.__loaded=!1;const nM=sM;function rM(){rM.__loaded||(rM.__loaded=!0,pm.RegisterGraphicCreator("line",Ag),ql.load(ky),ql.load(Yk?KA:TS))}rM.__loaded=!1;const aM=rM;function oM(){oM.__loaded||(oM.__loaded=!0,pm.RegisterGraphicCreator("path",Ng),ql.load(Oy),ql.load(Yk?Ak:jS))}oM.__loaded=!1;const lM=oM;function hM(){hM.__loaded||(hM.__loaded=!0,pm.RegisterGraphicCreator("polygon",Zg),ql.load(Dy),ql.load(Yk?Ek:RS))}hM.__loaded=!1;const cM=hM;function dM(){dM.__loaded||(dM.__loaded=!0,pm.RegisterGraphicCreator("rect",Tg),ql.load(Sy),ql.load(Yk?zA:US))}dM.__loaded=!1;const uM=dM;function pM(){pM.__loaded||(pM.__loaded=!0,pm.RegisterGraphicCreator("richtext",zg),ql.load(Uy),ql.load(Yk?Vk:KS))}pM.__loaded=!1;const gM=pM;function mM(){mM.__loaded||(mM.__loaded=!0,pm.RegisterGraphicCreator("shadowRoot",Qg))}mM.__loaded=!1;const fM=mM;function vM(){vM.__loaded||(vM.__loaded=!0,pm.RegisterGraphicCreator("symbol",bg),ql.load(Cy),ql.load(Yk?rk:QS))}vM.__loaded=!1;const _M=vM;function yM(){yM.__loaded||(yM.__loaded=!0,pm.RegisterGraphicCreator("text",mp),ql.load(Ry),ql.load(Yk?vk:sA))}yM.__loaded=!1;const bM=yM;function xM(){iM(),uM()}const SM=-.5*Math.PI,AM=1.5*Math.PI,kM="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 MM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(MM||(MM={}));const TM={[MM.selectedReverse]:{},[MM.selected]:{},[MM.hover]:{},[MM.hoverReverse]:{}},wM={container:"",width:30,height:30,style:{}},CM={debounce:xt,throttle:St};xM();let EM=class t extends Sb{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"===P_.env?(P_.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),P_.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:CM[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"===P_.env?(P_.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),P_.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",CM[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 PM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&PM(t,e)}))}EM.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 BM=t=>!u(t)&&!1!==t.visible;function RM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function LM(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 IM=["#ffffff","#000000"];function DM(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 FM(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(...IM);for(const n of a)if(t!==n&&FM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function FM(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?jM(t,e)>s:"largeText"===i?jM(t,e)>3:jM(t,e)>4.5}function jM(t,e){const i=zM(t),s=zM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function zM(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 HM(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 VM(t,e){return[t[0]*e,t[1]*e]}function NM(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 GM=(t,e,i,s)=>new Qe(Object.assign({defaultFontParams:Object.assign({fontFamily:kM,fontSize:14},s),getTextBounds:i?void 0:fm,specialCharSet:"-/: .,@%'\"~"+Qe.ALPHABET_CHAR_SET+Qe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function WM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const s=fm({text:t,fontFamily:e.fontFamily||i.fontFamily||kM,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 UM(t){return"rich"===YM(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type")}function YM(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 KM(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 XM(t){const e=YM(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?pm.richtext(KM(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)),pm.text(t))}function $M(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 ZM(){iM(),uM(),_M(),gM(),bM()}var JM=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);nh&&(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,V=JM(a,["visible"]);if(m&&c(H)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},V),{visible:H&&!!s,x:I,y:D,width:k,height:M}),"rect");B(null==f?void 0:f.panel)||(t.states=f.panel),this._bgRect=t}}this._textShape=P}}QM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const tT={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}},eT={poptip:z({},tT)};var iT=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]]}}}}nT.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 rT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 aT=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,nT.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new nT(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,eT.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}))}};aT=rT([Oa()],aT);var oT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 lT=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)}};lT=oT([Oa()],lT);let hT=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)}};hT=oT([Oa()],hT);const cT=new xa(((t,e,i,s)=>{i(aT)||(t(aT).toSelf().inSingletonScope(),t(rp).toService(aT)),i(lT)||(t(lT).toSelf(),t(Vv).toService(lT)),i(hT)||(t(hT).toSelf(),t(Vv).toService(hT))}));class dT extends Sb{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}iM(),aM();class uT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},uT.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})}}uT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},iM(),uM();class pT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},pT.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})}}pT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},iM(),Xk();class gT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},gT.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)}}gT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},iM(),Xk();class mT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},mT.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=SM,endAngle:s=AM}=this.attribute,n=s-i,r=ee(ne(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}mT.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},iM(),lM();class fT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fT.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)}}fT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const vT=new Uint32Array(33),_T=new Uint32Array(33);_T[0]=0,vT[0]=~_T[0];for(let t=1;t<=32;++t)_T[t]=_T[t-1]<<1|1,vT[t]=~_T[t];function yT(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]&vT[31&l]&_T[1+(31&h)])return!0}else{if(i[c]&vT[31&l])return!0;if(i[d]&_T[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,vT[31&n]&_T[1+(31&r)]);else for(s(a,vT[31&n]),s(o,_T[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,_T[31&i]|vT[1+(31&s)]);else for(n(r,_T[31&i]),n(a,vT[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 bT(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 xT(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=bT(t,r),!(s&&e.outOfBounds(r)||e.getRange(r))}function ST(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 ST(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 ST(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 ST(t,e,n,s,h,c)}return!1}const kT=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],MT=["top","inside-top","inside"];function TT(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 wT={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 CT(t,e){var i,s;return null!==(s=null===(i=wT[e])||void 0===i?void 0:i.call(wT,t))&&void 0!==s?s:{from:{},to:{}}}const ET=(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 PT(t,e,i,s){t.attribute.text!==e.attribute.text&&k(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new jc({text:t.attribute.text},{text:e.attribute.text},i,s))}const BT={mode:"same-time",duration:300,easing:"linear"};function RT(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 LT(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 OT(t){return 3===t||4===t}function IT(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 DT=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)}},FT=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 jT(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 zT(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)}}iM(),bM(),gM(),aM();class HT extends Sb{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},HT.defaultAttributes,t)),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(MM.hover,!0),PM(this,(t=>{t===e||B(t.states)||t.addState(MM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(PM(this,(t=>{B(t.states)||(t.removeState(MM.hoverReverse),t.removeState(MM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void PM(this,(t=>{B(t.states)||(t.removeState(MM.selectedReverse),t.removeState(MM.selected))}));B(e.states)||(e.addState(MM.selected,!0),PM(this,(t=>{t===e||B(t.states)||t.addState(MM.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:[];(this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)]).forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(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[zT(g,m,c,d,a,o),zT(-g,-m,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds);if(i){const t=pm.line({points:i});return e&&e.attribute.fill&&t.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&t.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(t),t}}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)),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 XM(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&&y.setRange(bT(v,t.AABBBounds,!0))}))),m.length>0&&m.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&&y.setRange(bT(v,t.AABBBounds,!0))})):t.AABBBounds&&y.setRange(bT(v,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 i=new Map,s=this._graphicToText||new Map,n=[],r=[],{visible:a}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{const o=this.getRelatedGraphic(t.attribute),l=t.attribute.id,h=this._isCollectionBase?l:o,c=(null==s?void 0:s.get(h))?"update":"enter";let d;if(a&&(d=this._createLabelLine(t,o)),"enter"===c){if(n.push(t),i.set(h,d?{text:t,labelLine:d}:{text:t}),o){const{from:i,to:s}=CT(t.attribute,"fadeIn");this.add(t),d&&(r.push(d),this.add(d)),this._syncStateWithRelatedGraphic(o),this._animationConfig.enter.duration>0&&o.once("animate-bind",(a=>{t.setAttributes(i),d&&d.setAttributes(i);const l=this._afterRelatedGraphicAttributeUpdate(t,n,d,r,e,o,s,this._animationConfig.enter);o.on("afterAttributeUpdate",l)}))}}else if("update"===c){const e=s.get(h);s.delete(h),i.set(h,e);const n=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&&PT(t,e,s,n))}i.forEach(((i,s)=>{const{duration:n,easing:r,increaseEffect:a=!0,channel:o}=i,{from:l,to:h}=ET(t,e,o,i.options);B(h)||t.animate().to(h,n,r),"text"in l&&"text"in h&&a&&PT(t,e,n,r)}))})(n,t,this._animationConfig.update),e.labelLine&&d&&e.labelLine.animate().to(d.attribute,r,a)}})),s.forEach((t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(CT(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=i}_renderWithOutAnimation(t){var e;const i=new Map,s=this._graphicToText||new Map,{visible:n}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach((t=>{const e=this.getRelatedGraphic(t.attribute),r=(null==s?void 0:s.get(e))?"update":"enter",a=this._isCollectionBase?t.attribute.id:e;let o;if(n&&(o=this._createLabelLine(t,e)),"enter"===r)i.set(a,o?{text:t,labelLine:o}:{text:t}),this.add(t),o&&this.add(o),this._syncStateWithRelatedGraphic(e);else if("update"===r){const e=s.get(a);s.delete(a),i.set(a,e),e.text.setAttributes(t.attribute),e.labelLine&&o&&e.labelLine.setAttributes(o.attribute)}})),s.forEach((t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)})),this._graphicToText=i}_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)}}VT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};class NT extends HT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},NT.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}}}NT.tag="rect-label",NT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};let GT=class t extends HT{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 jT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};GT.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class WT{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 UT extends HT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UT.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:"…"}),n=this._createLabelText(s),r=this.getGraphicBounds(n),a=r.x2-r.x1,o=e.map((t=>t.attribute)),l=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),o,i,a);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=LT(l.endAngle-d/2),p=RT(h.x,h.y,l.outerRadius,o),g=RT(h.x,h.y,a+e.line.line1MinLength,o),m=new WT(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);m.pointA=RT(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):OT(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=RT(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=OT(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=OT(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=OT(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?OT(t.quadrant)?"left":"right":OT(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*(OT(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;e1&&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 jT(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 extends HT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},KT.defaultAttributes,t)),this.name="line-data-label"}labeling(t,e){return DT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}KT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const XT={rect:NT,symbol:VT,arc:UT,line:GT,area:YT,"line-data":KT};class $T extends Sb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},$T.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=yT(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(){iM(),aM(),cM(),_M()}function ZT(){iM(),aM(),Xk(),_M()}$T.defaultAttributes={pickable:!1},qT();class JT extends Sb{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({},JT.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=pm.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=pm.line;Y(i)[0].cornerRadius&&(t=pm.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=pm.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}}JT.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}}},ZT();class QT extends JT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JT.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=pm.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 tw,ew;!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"}(tw||(tw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(ew||(ew={}));const iw={[ew.selectedReverse]:{},[ew.selected]:{},[ew.hover]:{},[ew.hoverReverse]:{}},sw={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}}},nw=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 rw(t,e,i){return!mt(t,e,0,1e-6)&&!gt(t,i,0,1e-6)}function aw(t,e,i,s){const n=fm(Object.assign({text:i},s)),r=n.width(),a=n.height(),o=nw(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=rw(o,-l,-h)?((o+l)/c-.5)*r:rw(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=rw(o,-l,-h)?.5*-a:rw(o,h,l)?.5*a:Math.cos(o)>=0?(.5-(h-o)/c)*a:(.5-nw(o-l)/c)*a,{x:p,y:g-m}}function ow(t){const e={};return PM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function lw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function hw(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 VM(r,(s?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}const cw=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!B(s.states)?(s.addState(MM.hover,!0),PM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(MM.hoverReverse,!0)})),s):i},dw=(t,e,i)=>i?(PM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(MM.hoverReverse),t.removeState(MM.hover))})),null):i,uw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(MM.selected)?(PM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(MM.selectedReverse),t.removeState(MM.selected))})),null):s.name&&!B(s.states)?(s.addState(MM.selected,!0),PM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(MM.selectedReverse,!0)})),s):i};class pw extends Sb{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=cw(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=dw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=uw(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=pm.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&&ow(this._innerView),this.removeAllChild(!0),this._innerView=pm.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=pm.group({x:0,y:0,zIndex:1});if(a.name=tw.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=pm.group({x:0,y:0,pickable:!1});t.name=tw.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=pm.group({x:0,y:0,pickable:!1});i.name=tw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=pm.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=tw.tick,r.id=this._getNodeId(t.id),B(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=TM;else{const t=this.data[s],e=z({},TM,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=pm.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=tw.subTick,r.id=this._getNodeId(`${n}`),B(s.state))r.states=TM;else{const i=z({},TM,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=pm.group({x:0,y:0,pickable:!1});return r.name=`${tw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=XM(this._getLabelAttribute(t,e,n,i));if(a.name=tw.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=TM;else{const s=z({},TM,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 QM(Object.assign({},e));i.name=tw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return lw(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({},sw.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 gw(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 mw(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 fw={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&&vw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function vw(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 _w(t,e){for(let i,s=1,n=t.length,r=t[0];s1&&e.height()>1}function bw(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Aw(t,e.attribute.angle)),{angle:Sw(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({},kw(t,e.attribute.angle)),{angle:Sw(e.attribute.angle)}))}))}(t,e),gw(e)}function Sw(){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 Aw(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=Sw(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 kw(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=Sw(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 Mw{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 VM([s[1],-1*s[0]],t*(e?1:-1)*i)}}function Tw(){iM(),aM(),gM(),bM()}var ww=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=NM(_,[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({},iw,c.text),shape:z({},iw,c.shape),panel:z({},iw,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 Aw(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return kw(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)})),xw(i,t),!bw(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(yw);if(B(i))return;let s;s=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i),gw(s);const{method:n="parity",separation:r=0}=e,a=d(n)?n:fw[n]||fw.parity;if(s.length>=3&&_w(s,r)){do{s=a(s,r)}while(s.length>=3&&_w(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&&vw(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=pm.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=tw.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=WM(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}}Cw.defaultAttributes=sw,U(Cw,Mw);class Ew{isInValidValue(t){const{startAngle:e=SM,endAngle:i=AM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=SM,endAngle:i=AM,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 hw(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 Pw,Bw=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=pm.circle(c);d.name=tw.line,d.id=this._getNodeId("line"),B(a.state)||(d.states=z({},iw,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=Bw(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({},iw,d.text),shape:z({},iw,d.shape),panel:z({},iw,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 aw(t,e,i,s)}}Rw.defaultAttributes=sw,U(Rw,Ew);class Lw extends mc{constructor(){super(...arguments),this.mode=ko.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},PM(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{Iw[t]=!0}));const Hw=t=>-Math.log(-t),Vw=t=>-Math.exp(-t),Nw=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,Gw=t=>10===t?Nw:t===Math.E?Math.exp:e=>Math.pow(t,e),Ww=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Uw=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),Yw=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function Kw(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 Xw(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function $w(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),$w(t,i,s)*(e/(1-i))}function Zw(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function Jw(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 eC{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=Zw(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 iC=Symbol("implicit");class sC extends eC{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=Pw.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=iC}clone(){const t=(new sC).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!==iC)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 rC extends sC{constructor(t){super(),this.type=Pw.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:nC(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 nC(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 rC(!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:aC}=xe;function oC(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=aC(_e.parseColorString(t),s);return t=>e(t).formatRgb()}return At(Number(t),Number(e))}return e instanceof ye?aC(t,e):e instanceof _e?aC(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 lC extends eC{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:zw,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zw;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=zw,this._piecewise=Xw,this._interpolate=oC}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?Jw:Xw,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:zw),this.rescale(i)):this._clamp!==zw}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 hC=Math.sqrt(50),cC=Math.sqrt(10),dC=Math.sqrt(2),uC=[1,2,5,10],pC=(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=vC(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?mC(0,-(e-1)/s,s):mC((e-1)/s,0,s)},gC=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 pC(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return pC(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=mC(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=mC(t,e,l);return n&&r.reverse(),r})),vC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=uC[0];return i>=hC?s=uC[3]:i>=cC?s=uC[2]:i>=dC&&(s=uC[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function _C(t,e,i){const s=(e-t)/Math.max(0,i);return vC(s)}function yC(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=_C(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 xC(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 SC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),AC=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})),kC=ft(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=fC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?SC(t,e,n):SC(t,e,tC(n)),h=SC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),MC=ft(((t,e,i,s,n)=>yC(s(t),s(e),i).map((t=>tC(n(t))))));class TC extends lC{constructor(){super(...arguments),this.type=Pw.Linear}clone(){return(new TC).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 gC(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=fC(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 yC(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=xC(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=bC(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=bC(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=bC(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function wC(t){return e=>-t(-e)}function CC(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class EC extends lC{constructor(){super(Ww(10),Gw(10)),this.type=Pw.Log,this._limit=CC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new EC).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=Ww(this._base),s=Gw(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=wC(i),this._pows=wC(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=Hw,this.untransformer=Vw):(this._logs=i,this._pows=s,this._limit=CC(),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 zw}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 AC(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 kC(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 MC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return MC(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=xC(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=Qw(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 PC extends TC{constructor(){super(Uw(1),Yw(1)),this.type=Pw.Symlog,this._const=1}clone(){return(new PC).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=Uw(t),this.untransformer=Yw(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 AC(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 kC(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 MC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return MC(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=xC(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=Qw(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 BC{constructor(){this.type=Pw.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 BC).domain(this._domain).range(this._range).unknown(this._unknown)}}const RC=t=>t.map(((t,e)=>({index:e,value:t}))),LC=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 OC(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function IC(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=GM(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=DC(S,y,m[0],m[m.length-1]):a&&c&&s===e.length-1?T=DC(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=DC(A,b,m[0],m[m.length-1]):a&&d&&s===e.length-1?w=DC(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},jC=(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=GM(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=lw(o,hw(s,o,e,n));return aw(l,hw(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},zC={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&OC(i.AABBBounds,t.AABBBounds,e)||(i=t,0))))}},HC=(t,e,i,s)=>FC(t,e,i).map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),VC=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},NC=(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&&!VC(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?NC(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&&LC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},UC=(t,e)=>{if(Dw(t.type))return((t,e)=>{if(!Dw(t.type))return RC(t.domain());const i=t.range(),s=Math.abs(i[i.length-1]-i[0]);if(s<2)return RC([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=FC(t,h,e).map(((t,e)=>({AABBBounds:t,value:h[e]})));for(;n.length>=3&&IC(n,i);)n=zC.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 RC(h)})(t,e);if(jw(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?RC([s[s.length-1]]):RC([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=HC(t,s,e,c),l=Math.min(...n.map((t=>t[2]))),h=GC(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=HC(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 RC(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=jC(t,i,e),r=$(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=WC(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 RC(c)})(t,e)}return RC(t.domain())};function YC(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 KC(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 XC(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=YC(t,!!n),o=YC(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=KC(e,t,!1,!!n),o=KC(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=YC(t,!!n),o=YC(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class $C extends Sb{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&ow(this._innerView),this.removeAllChild(!0),this._innerView=pm.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 lw(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?`${tw.grid}-sub`:`${tw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=YC(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=KC(t,o,!1,!!a)}const u=pm.path(Object.assign({path:c,z:l},d(r)?z({},this.skipDefault?null:$C.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=YC(o,!!a),f=Lt(o[0].x-o[1].x),v=Lt(o[0].y-o[1].y),_=pm.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:$C.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,Mw);var ZC=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(JC,Ew);const QC="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",tE={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:QC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:QC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},eE={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 iE;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(iE||(iE={}));var sE=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=iE.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=iE.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=iE.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=iE.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=iE.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t),"browser"===P_.env&&(P_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),P_.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===iE.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===iE.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=iE.endHandler):h+=l:this._activeTag===iE.endHandler&&(c+l{t.preventDefault();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===iE.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"===P_.env&&(P_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),P_.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===iE.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===iE.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=sE(i,["formatMethod"]),{formatMethod:a}=s,o=sE(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:V={},brushSelect:N,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=V.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:N?"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),N&&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:N?"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:N?"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"},eE.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=V.symbolType)&&void 0!==y?y:"square"},eE.horizontal),V),{pickable:!G&&(null===(b=V.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},eE.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},eE.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"},eE.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=V.symbolType)&&void 0!==R?R:"square"},eE.vertical),V),{pickable:!G&&(null===(L=V.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},eE.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},eE.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 _y(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 QM(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 aE,oE,lE,hE;function cE(){iM(),ZM()}function dE(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 uE(t,e){const{dx:i,dy:s}=dE(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}rE.defaultAttributes=tE,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"}(aE||(aE={})),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"}(oE||(oE={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(lE||(lE={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(hE||(hE={}));class pE extends Sb{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=cw(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=dw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=uw(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=pm.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=pm.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=pm.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 gE(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 mE(t,e,i,s){t&&(gE(t.startSymbol,e,i,s),t.lines.forEach((t=>gE(t,e,i,s))),gE(t.line,e,i,s),gE(t.endSymbol,e,i,s))}function fE(t,e,i,s){t&&(gE(t.getTextShape(),e,i,s),gE(t.getBgRect(),e,i,s))}function vE(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 _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,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;gE(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)})),gE(t.endSymbol,s+r+a,o,n),gE(e.getTextShape(),s+r+a+o,l,n),gE(e.getBgRect(),s+r+a+o,l,n)}function xE(t,e,i,s,n){mE(t,s,i,n),fE(e,s,i,n)}function SE(t,e,i,s,n){gE(t,s,i,n),fE(e,s,i,n)}function AE(t,e,i,s,n){gE(t,s,i,n),fE(e,s,i,n)}function kE(t,e,i,s,n,r){var a;mE(t,n,s,r),gE(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?fE(i,n,s,r):gE(i,n,s,r)}function ME(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;gE(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)})),gE(e,n+o+l,h,r),gE(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(gE(i.getTextShape(),n+o+l+h+c,d,r),gE(i.getBgRect(),n+o+l+c,d,r)):gE(i,n+o+l+c,d,r)}function TE(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?bE(t,e,s,r,a):"fadeIn"===i&&xE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?bE(t,e,s,n,a):"fadeIn"===i&&xE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){_E(t,s,i,n),yE(e,s,i,n)}(t,e,i,s,n)}}function wE(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&&SE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&SE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){vE(t,s,i,n),yE(e,s,i,n)}(t,e,i,s,n)}}function CE(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&&AE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&AE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){vE(t,s,i,n),yE(e,s,i,n)}(t,e,i,s,n)}}function EE(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?kE(n,r,e,i,s,o):"callIn"===t&&ME(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?kE(n,r,e,i,s,a):"callIn"===t&&ME(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;_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)}(n,r,e,t,i,s)}}const PE={type:"clipIn",duration:500,easing:"linear",delay:0},BE={type:"fadeIn",duration:500,easing:"linear",delay:0},RE={type:"callIn",duration:500,easing:"linear",delay:0},LE={type:"fadeOut",duration:500,easing:"linear",delay:0};class OE extends pE{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=PE,this.defaultExitAnimation=LE}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;uE(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 QM(Object.assign(Object.assign({},e),{state:{panel:z({},TM,null==i?void 0:i.labelBackground),text:z({},TM,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({},TM,null==e?void 0:e.labelBackground),text:z({},TM,null==e?void 0:e.label)}})),this.setLabelPos())}}const IE=.001,DE={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:aE.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]}},FE={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"}}},jE={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:lE.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]}},zE={interactive:!0,label:{position:oE.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}},HE={interactive:!0,label:{position:lE.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}},VE={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"}},NE={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"}},GE={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 WE(){UE._animate=TE}cE(),qT();class UE extends OE{markerAnimate(t){UE._animate&&this._animationConfig&&UE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UE.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(RM(t)?t:t-Math.PI)+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}getTextStyle(t,e,i){return LM(Math.abs(e),Math.PI/2,IE)||LM(Math.abs(e),3*Math.PI/2,IE)?OM(i,e,t):RM(e)?FE.postiveXAxis[t]:FE.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new JT({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},TM,null==a?void 0:a.line),startSymbol:z({},TM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},TM,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({},TM,null==a?void 0:a.line),startSymbol:z({},TM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},TM,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 YE(){KE._animate=wE}UE.defaultAttributes=DE,cE(),cM();class KE extends pE{markerAnimate(t){KE._animate&&this._animationConfig&&KE._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({},KE.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=BE,this.defaultExitAnimation=LE}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({},NE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;uE(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=pm.polygon(Object.assign({points:e},s));r.states=z({},TM,null==n?void 0:n.area),r.name="mark-area-polygon",this._area=r,t.add(r);const a=new QM(Object.assign(Object.assign({},i),{state:{panel:z({},TM,null==n?void 0:n.labelBackground),text:z({},TM,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({},TM,null==s?void 0:s.area)),this._label&&this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},e),{state:{panel:z({},TM,null==s?void 0:s.labelBackground),text:z({},TM,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}}KE.defaultAttributes=zE,cE(),ZT();class XE extends OE{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,{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 lE.arcInnerStart:l=s;case lE.arcOuterStart:l=s;break;case lE.arcInnerEnd:l=n;case lE.arcOuterEnd:l=n;break;case lE.center:case lE.arcInnerMiddle:case lE.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 VE[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 QT({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},TM,null==o?void 0:o.line),startSymbol:z({},TM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},TM,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({},TM,null==o?void 0:o.line),startSymbol:z({},TM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},TM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}}XE.defaultAttributes=jE,cE(),Xk();class $E extends pE{markerAnimate(t){$E._animate&&this._animationConfig&&$E._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({},$E.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcArea",this.defaultUpdateAnimation=BE,this.defaultExitAnimation=LE}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 lE.center:h=(i+s)/2,c=(n+r)/2;break;case lE.arcInnerStart:h=i,c=n;break;case lE.arcOuterStart:h=s,c=n;break;case lE.arcInnerEnd:h=i,c=r;break;case lE.arcOuterEnd:h=s,c=r;break;case lE.arcInnerMiddle:h=i,c=(n+r)/2;break;case lE.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({},VE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;uE(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=pm.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));h.states=z({},TM,null==l?void 0:l.area),h.name="polar-mark-area-area",this._area=h,t.add(h);const c=new QM(Object.assign(Object.assign({},o),{state:{panel:z({},TM,null==l?void 0:l.labelBackground),text:z({},TM,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({},TM,null==o?void 0:o.area)),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},a),{state:{panel:z({},TM,null==o?void 0:o.labelBackground),text:z({},TM,null==o?void 0:o.label)}})),this.setLabelPos())}isValidPoints(){return!0}}function qE(){ZE._animate=EE}$E.defaultAttributes=HE,cE(),qT(),ZT(),_M(),nM(),aM();class ZE extends pE{markerAnimate(t){ZE._animate&&this._animationConfig&&ZE._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ZE.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=RE,this.defaultExitAnimation=LE,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return LM(Math.abs(s),Math.PI/2,IE)||LM(Math.abs(s),3*Math.PI/2,IE)?OM(t,s,n):RM(s)?GE.postiveXAxis[n]:GE.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=hE.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({},TM,null==m?void 0:m.textBackground),text:z({},TM,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({},TM,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({},TM,null==m?void 0:m.image));const y=RM(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=pm.symbol(Object.assign(Object.assign({},i),r)),h.states=z({},TM,null==s?void 0:s.symbol)):"text"===n?h=new QM(Object.assign(Object.assign({},i),{state:{panel:z({},TM,null==s?void 0:s.textBackground),text:z({},TM,null==s?void 0:s.text)}})):"richText"===n?(h=pm.richtext(Object.assign(Object.assign({},i),a)),h.states=z({},TM,null==s?void 0:s.richText)):"image"===n?(h=pm.image(Object.assign(Object.assign({},i),o)),h.states=z({},TM,null==s?void 0:s.image)):"custom"===n&&l&&(h=l(),h.states=z({},TM,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=LM(c,0,IE)||LM(d,0,IE),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(aP.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(aP.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===aP.focus||"focus"===o){const s=a.hasState(nP.focus);a.toggleState(nP.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[nP.unSelected,nP.unSelectedHover,nP.focus],t),this._setLegendItemState(e,nP.selected,t)})):(this._setLegendItemState(a,nP.selected,t),this._removeLegendItemState(a,[nP.unSelected,nP.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[nP.selected,nP.selectedHover,nP.focus],t),this._setLegendItemState(e,nP.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(nP.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(nP.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(rP.legendItemClick,a,t);i?(this._removeLegendItemState(a,[nP.selected,nP.selectedHover],t),this._setLegendItemState(a,nP.unSelected,t)):(this._setLegendItemState(a,nP.selected,t),this._removeLegendItemState(a,[nP.unSelected,nP.unSelectedHover],t))}else this._setLegendItemState(a,nP.selected,t),this._removeLegendItemState(a,[nP.unSelected,nP.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[nP.selected,nP.selectedHover],t),this._setLegendItemState(e,nP.unSelected,t))}))}this._dispatchLegendEvent(rP.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,nP.selected),this._removeLegendItemState(e,[nP.unSelected,nP.unSelectedHover])):(this._removeLegendItemState(e,[nP.selected,nP.selectedHover]),this._setLegendItemState(e,nP.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=eP,spaceRow:h=iP}=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;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):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=pm.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,aP.item,t,w)):(w=pm.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,aP.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?nP.selected:nP.unSelected);const C=pm.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=pm.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,aP.itemShape,t,w,S.state),s.addState(e?nP.selected:nP.unSelected),C.add(s)}let O=0;if(d){const e=R(g,"size",10);E=pm.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},g),{visible:!0,pickMode:"imprecise",boundsPadding:T})),this._appendDataToShape(E,aP.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=XM(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,aP.itemLabel,t,w,A.state),D.addState(e?nP.selected:nP.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=XM(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,aP.itemValue,t,w,k.state),r.addState(e?nP.selected:nP.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(),V=p(this.attribute.item.width)?this.attribute.item.width:z+T[1]+T[3],N=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=V,w.attribute.height=N,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 tP(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 tP(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 EM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:12},t),{width:e})):new EM(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=pm.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=eP,spaceRow:a=iP}=s,o=this._itemsContainer,{space:l=sP,defaultCurrent:h=1}=n,c=cP(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 _=pm.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(nP.selected)?this._setLegendItemState(t,nP.selectedHover,e):this._setLegendItemState(t,nP.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===aP.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(rP.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(nP.unSelectedHover)||t.hasState(nP.selectedHover))&&(i=!0),t.removeState(nP.unSelectedHover),t.removeState(nP.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(nP.unSelectedHover)&&!t.hasState(nP.selectedHover)||(i=!0),t.removeState(nP.unSelectedHover),t.removeState(nP.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===aP.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(rP.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(rP.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!==aP.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(rP.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!==aP.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(rP.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(nP.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({},dP,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(nP.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 pP;function gP(t){return y(t)?t:[t,t]}function mP(t){return t?"ew-resize":"ns-resize"}uP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:eP,spaceRow:iP,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:sP,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"}(pP||(pP={})),lP();class fP extends Sb{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({},fP.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"===P_.env?(P_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),P_.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"===P_.env?(P_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),P_.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"===P_.env?(P_.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),P_.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"===P_.env?(P_.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),P_.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:gP(d)[0],endValue:gP(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const m=pm.group({x:0,y:0});m.name=pP.innerView,this.add(m),this._innerView=m;let f,v=0;if(r&&r.visible){f=pm.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=pP.startText,m.add(f);const e=p(r.space)?r.space:0;v+=(g?f.AABBBounds.width():f.AABBBounds.height())+e}const _=pm.group({x:g?v:0,y:g?0:v});m.add(_);const y=pm.group({x:0,y:0});let b;if(y.name=pP.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=pm.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=pP.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=pm.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=pP.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]=gP(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":mP(p)},r));if(v.name=pP.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=f,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=pP.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":mP(p)},r));if(i.name=pP.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(m,"end");e.name=pP.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=pm.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=pP.trackContainer;const f=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===f?"pointer":mP(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=pm.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=pP.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return pm.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":mP(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),pm.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=pm.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=pm.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===pP.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===pP.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===pP.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===pP.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}}}fP.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}}},hP(),lP();class vP extends oP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},vP.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 _P(){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`}vP.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"}}},hP(),lP(),lM();class yP extends oP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},yP.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=pm.group({x:0,y:0});this._innerView.add(x);const S=new fP({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:_P(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=pm.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))}}yP.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)"}},iM(),bM(),gM();let bP=class t extends Sb{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,V,N,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},wM),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},wM),$),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!==(V=K.width)&&void 0!==V?V: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!==(N=$.width)&&void 0!==N?N: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"))}}}};bP.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 xP={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"}}};iM(),bM(),gM();let SP=class extends Sb{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==e)return void(o&&o.hideAll());if(p(i))if(!1!==i.visible){const t=z({},R(xP,"title.style"),i.style);UM(t)?this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},KM(t)),{visible:i.visible,x:0,y:0}),"richtext"):this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},t),{lineHeight:p(t.lineHeight)?t.lineHeight:t.fontSize,visible:i.visible,x:0,y:0}),"text"),i.autoFit&&k(a)&&this._setLocalAutoFit(a,this._title,i),i.autoLimit&&k(r)&&this._title.setAttribute("maxLineWidth",a)}else{const t=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}if(p(s)){const t=Y(s),e=[];t.forEach(((t,s)=>{if(!1!==t.visible){const n=z({},R(xP,"content.style"),t.style);let l;l=UM(n)?o.createOrUpdateChild("indicator-content-"+s,Object.assign(Object.assign({},KM(n)),{visible:i.visible,x:0,y:0}),"richtext"):o.createOrUpdateChild("indicator-content-"+s,Object.assign(Object.assign({},n),{lineHeight:p(n.lineHeight)?n.lineHeight:n.fontSize,visible:t.visible,x:0,y:0}),"text"),t.autoFit&&k(a)&&this._setLocalAutoFit(a,l,t),t.autoLimit&&k(r)&&l.setAttribute("maxLineWidth",a),e.push(l)}else{const t=o.find((t=>t.name==="indicator-content-"+s),!1);t&&o.removeChild(t)}})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.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=WM(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 AP extends yg{constructor(t){super(t)}}var kP,MP;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(kP||(kP={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(MP||(MP={}));class TP extends Sb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},TP.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"},TP.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"},TP.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},TP.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},TP.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 AP(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new AP(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new AP(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(kP.OnPlay)},this.pause=()=>{this._dispatchEvent(kP.OnPause)},this.forward=()=>{this._dispatchEvent(kP.OnForward)},this.backward=()=>{this._dispatchEvent(kP.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()}}TP.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},TP.defaultAttributes={[MP.Start]:{},[MP.Pause]:{},[MP.Backward]:{},[MP.Forward]:{}};const wP={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},CP=[200,10];var EP,PP;!function(t){t.Default="default",t.Reverse="reverse"}(EP||(EP={})),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"}(PP||(PP={}));const BP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===EP.Default&&s===i})({direction:e,maxIndex:i,dataIndex:n})||(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===EP.Reverse&&s===i})({direction:e,minIndex:s,dataIndex:n})},RP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===EP.Default&&s===i})({direction:e,minIndex:s,dataIndex:n})||(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===EP.Reverse&&s===i})({direction:e,maxIndex:i,dataIndex:n})},LP=t=>"top"===t||"bottom"===t;class OP extends Sb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},OP.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(LP(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:CP[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:CP[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 fP(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 LP(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 TP(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=LP(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:CP[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?(LP(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:LP(this._orient)?t+s:(this._size.width-r)/2,y:LP(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:LP(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:LP(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:LP(this._orient)?t+s:(this._size.width-r)/2,y:LP(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 IP(){lP(),iM(),_M()}OP.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({},wP),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},wP),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},wP),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},wP),{key:"backward",position:"start"})}},IP();class DP extends OP{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:EP.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(kP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(kP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(kP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(kP.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(PP.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(BP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||RP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===EP.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(PP.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=P_.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(PP.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(PP.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=P_.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(),P_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(PP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,P_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(PP.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(PP.change),this.dispatchCustomEvent(PP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var FP,jP=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())}))};IP();class zP extends OP{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(kP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(kP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(kP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(kP.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(PP.change))},this.play=()=>jP(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(PP.play),this._rafId=P_.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=P_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,P_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(PP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,P_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(PP.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(PP.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(PP.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"}(FP||(FP={}));const HP={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}},VP=5;const NP={debounce:xt,throttle:St};iM(),cM();let GP=class t extends Sb{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:NP[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(FP.brushClear,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._container.incrementalClearChild(),this._brushMaskAABBBoundsDict={}):(this._activeDrawState&&this._dispatchEvent(FP.drawEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._activeMoveState&&this._dispatchEvent(FP.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=HP.trigger,updateTrigger:e=HP.updateTrigger,endTrigger:i=HP.endTrigger,resetTrigger:s=HP.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(FP.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(FP.moveStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_drawing(t){var e,i;const s=this.eventPosToStagePos(t),{sizeThreshold:n=VP,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(FP.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(FP.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=pm.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)})},UP=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}},YP={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:kM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:kM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:kM,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},KP=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];iM(),uM(),_M(),bM(),gM();let XP=class t extends Sb{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:BM(u)&&BM(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:BM(u)&&BM(u.value)},UP(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:BM(u)&&BM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:BM(u)&&BM(u.value)},UP(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},wM),u.value),visible:BM(u)&&BM(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=BM(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 _=BM(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(!BM(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)+(BM(n.key)?r+n.key.spacing:0)+(BM(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&&($M(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:BM(n.key)||"right"===c||(t="left"),m.setAttribute("textAlign",t),$M(c,m,t,u,a),m.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(BM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Fc(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(BM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},UP(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},UP(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},wM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(BM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},UP(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},UP(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=>KP.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)&&BM(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=BM(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=GM(u),y=GM(p);let b=0;if(BM(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(BM(p)){const{width:t,height:e}=y.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}f&&mg[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 WP({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return WP({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};XP.defaultAttributes=YP;const $P=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 ZP(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function JP(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function QP(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 tB(t,e){const i=QP(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 eB(t,e){const i=iB(t),s=iB(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 iB(t,e={x:0,y:0}){return qt.distancePP(t,e)}function sB(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 nB(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const rB=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var oB,lB;!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"}(oB||(oB={})),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.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(lB||(lB={}));const hB="__VCHART",cB=500,dB=500,uB=`${hB}_LABEL_LIMIT`,pB=`${hB}_LABEL_ALIGN`,gB=`${hB}_LABEL_TEXT`,mB=`${hB}_LABEL_VISIBLE`,fB=`${hB}_LABEL_X`,vB=`${hB}_LABEL_Y`,_B=`${hB}_ARC_TRANSFORM_VALUE`,yB=`${hB}_ARC_RATIO`,bB=`${hB}_ARC_START_ANGLE`,xB=`${hB}_ARC_END_ANGLE`,SB=`${hB}_ARC_K`,AB=`${hB}_ARC_MIDDLE_ANGLE`,kB=`${hB}_ARC_QUADRANT`,MB=`${hB}_ARC_RADIAN`,TB=-Math.PI/2,wB=3*Math.PI/2,CB=-90,EB=.6;var PB,BB,RB,LB,OB,IB,DB,FB,jB,zB,HB,VB,NB,GB,WB;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(PB||(PB={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(BB||(BB={})),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"}(RB||(RB={})),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"}(LB||(LB={})),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"}(OB||(OB={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(IB||(IB={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(DB||(DB={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(FB||(FB={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(jB||(jB={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(zB||(zB={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(HB||(HB={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(VB||(VB={})),t.VGRAMMAR_HOOK_EVENT=void 0,(NB=t.VGRAMMAR_HOOK_EVENT||(t.VGRAMMAR_HOOK_EVENT={})).BEFORE_EVALUATE_DATA="beforeEvaluateData",NB.AFTER_EVALUATE_DATA="afterEvaluateData",NB.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",NB.AFTER_EVALUATE_SCALE="afterEvaluateScale",NB.BEFORE_PARSE_VIEW="beforeParseView",NB.AFTER_PARSE_VIEW="afterParseView",NB.BEFORE_TRANSFORM="beforeTransform",NB.AFTER_TRANSFORM="afterTransform",NB.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",NB.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",NB.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",NB.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",NB.BEFORE_STAGE_RESIZE="beforeStageResize",NB.AFTER_STAGE_RESIZE="afterStageResize",NB.BEFORE_VRENDER_DRAW="beforeVRenderDraw",NB.AFTER_VRENDER_DRAW="afterVRenderDraw",NB.BEFORE_MARK_JOIN="beforeMarkJoin",NB.AFTER_MARK_JOIN="afterMarkJoin",NB.BEFORE_MARK_UPDATE="beforeMarkUpdate",NB.AFTER_MARK_UPDATE="afterMarkUpdate",NB.BEFORE_MARK_STATE="beforeMarkState",NB.AFTER_MARK_STATE="afterMarkState",NB.BEFORE_MARK_ENCODE="beforeMarkEncode",NB.AFTER_MARK_ENCODE="afterMarkEncode",NB.BEFORE_DO_LAYOUT="beforeDoLayout",NB.AFTER_DO_LAYOUT="afterDoLayout",NB.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",NB.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",NB.BEFORE_DO_RENDER="beforeDoRender",NB.AFTER_DO_RENDER="afterDoRender",NB.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",NB.AFTER_MARK_RENDER_END="afterMarkRenderEnd",NB.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",NB.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",NB.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",NB.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",NB.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",NB.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",NB.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",NB.BEFORE_ELEMENT_STATE="beforeElementState",NB.AFTER_ELEMENT_STATE="afterElementState",NB.BEFORE_ELEMENT_ENCODE="beforeElementEncode",NB.AFTER_ELEMENT_ENCODE="afterElementEncode",NB.ANIMATION_START="animationStart",NB.ANIMATION_END="animationEnd",NB.ELEMENT_ANIMATION_START="elementAnimationStart",NB.ELEMENT_ANIMATION_END="elementAnimationEnd",NB.ALL_ANIMATION_START="allAnimationStart",NB.ALL_ANIMATION_END="allAnimationEnd",function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(GB||(GB={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(WB||(WB={}));const UB="__vgrammar_scene_item__",YB=[RB.line,RB.area],KB=[RB.arc3d,RB.rect3d,RB.pyramid3d],XB="key",$B=[{}],qB=["key"],ZB=!0,JB=!0,QB=!1,tR=!0,eR="VGRAMMAR_IMMEDIATE_ANIMATION",iR=0,sR=1e3,nR=0,rR=0,aR=!1,oR=!1,lR="quintInOut",hR={stopWhenStateChange:!1,immediatelyApply:!0};function cR(t,e){return Y(t).reduce(((t,i)=>{const s=_(i)?e.getGrammarById(i):i;return s&&t.push(s),t}),[])}function dR(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 cR(t.dependency,e);var i;return[]}function uR(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function pR(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 gR(t,e){return mR(t)?t.output():e[t]}const mR=t=>t&&!u(t.grammarType),fR=t=>d(t)?t:e=>e[t];function vR(t){return!!(null==t?void 0:t.scale)}function _R(t){return!!(null==t?void 0:t.field)}function yR(t,e){if(!t)return[];let i=[];return t.scale&&(i=mR(t.scale)?[t.scale]:Y(e.getScaleById(t.scale))),i.concat(dR(t,e))}function bR(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 xR(t,e,i,s,n){i&&(uR(i)?e.forEach((e=>{const n=pR(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 RB.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case RB.group:case RB.rect:case RB.image:return["width","height","y1"].includes(e);case RB.path:case RB.shape:return["path","customPath"].includes(e);case RB.line:return"defined"===e;case RB.area:return["x1","y1","defined"].includes(e);case RB.rule:return["x1","y1"].includes(e);case RB.symbol:return"size"===e;case RB.polygon:return"points"===e;case RB.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(vR(l)){const t=gR(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?cb(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(_R(l)){const t=cb(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=pR(l,s,e.datum,t)}))})))}function SR(t,e,i,s){if(!t)return null;if(uR(t))return pR(t,s,e,i);const n={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(vR(h)){const t=gR(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?cb(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(_R(h)){const t=cb(h.field);n[r]=t(e)}else n[r]=pR(h,s,e,i)})),n}class AR{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 kR=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]}};kR._plotMarks={},kR._marks={},kR._components={},kR._graphicComponents={},kR._transforms={},kR._grammars={},kR._glyphs={},kR._animations={},kR._interactions={},kR._graphics={},kR.registerGlyph=(t,e,i,s,n)=>(kR._glyphs[t]=new AR(e,i,s,n),kR._glyphs[t]),kR.registerAnimationType=(t,e)=>{kR._animations[t]=e},kR.getAnimationType=t=>kR._animations[t],kR.registerInteraction=(t,e)=>{kR._interactions[t]=e},kR.registerGraphic=(t,e)=>{kR._graphics[t]=e},kR.getGraphicType=t=>kR._graphics[t],kR.createGraphic=(t,e)=>{const i=kR._graphics[t];return i?i(e):null};const MR=t=>!!RB[t];function TR(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var s;const n=kR.getGraphicType(e)?kR.createGraphic(e,i):kR.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 wR=t=>{t&&(t[UB]=null,t.release(),t.parent&&t.parent.removeChild(t))},CR=["fillOpacity"],ER=(t,e,i)=>{var s;return"fillOpacity"===e?(t.fillOpacity=null!==(s=i.fillOpacity)&&void 0!==s?s:1,["fillOpacity"]):[]};const PR={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"}],[RB.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"}],[RB.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"}],[RB.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 BR=(t,e,i,s)=>{const n={},r=e?Object.keys(e):[],a=_(t)?PR[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||(CR.includes(r)?ER(n,r,e):n[r]=e[r])}))}else r.forEach((t=>{CR.includes(t)?ER(n,t,e):n[t]=e[t]}));return n},RR=(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),LR=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],OR=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(LR);function IR(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)?OR:LR,r=[];let a=null;return t.forEach(((t,e)=>{a&&n.every((e=>RR(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=DR(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function DR(t){const e={};return t?(Object.keys(t).forEach((i=>{"x"!==i&&"y"!==i&&"x1"!==i&&"y1"!==i&&"defined"!==i&&"size"!==i&&"width"!==i&&"height"!==i&&"context"!==i&&(e[i]=t[i])})),e):e}let FR=class{constructor(t){this.data=null,this.states=[],this.diffState=BB.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:{}})));xR(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?BR(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[UB]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?BR(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t)))}updateGraphicItem(){if(!this.graphicItem)return;this.diffState===BB.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&&(wR(this.graphicItem),this.graphicItem[UB]=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=fR(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(pR(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===BB.unChange&&(this.diffState=BB.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&(this.mark.isCollectionMark()&&delete t.defined,Object.assign(e,t)),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==BB.enter&&this.diffState!==BB.update||!this.states.length||this.useStates(this.states),this.mark.markType===RB.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 cl))}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[PB.update],a=e[PB.enter],o=e[PB.exit],l=this.mark.isLargeMode()||n&&!this.mark.getSpec().enableSegments;this.diffState===BB.enter?(a&&xR(this,t,a,s,l),r&&xR(this,t,r,s,l)):this.diffState===BB.update?((n&&a||i)&&xR(this,t,a,s,l),r&&xR(this,t,r,s,l)):this.diffState===BB.exit&&o&&(i&&xR(this,t,a,s,l),xR(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)gb(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[RB.line,RB.area,RB.largeRects,RB.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(s=l.nextAttrs)||void 0===s?void 0:s.points)&&(!0===i||bR(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[PB.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=DR(h),e===RB.line||e===RB.area){const i=function(t,e,i,s){return t&&t.length&&(1!==t.length||e)?t.some((t=>bR(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===RB.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=IR(e.items,e.points,i);if(s)return void s.forEach((e=>{t.push(e)}))}const n=DR(e.items[0]);n.points=e.points,t.push(n)})),t}return s?IR(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=SR(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=IR(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t)}else h.points=i,h.segments=null}else e===RB.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===RB.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}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&&(wR(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 jR{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 zR=(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 HR extends jR{constructor(t,e){super(t,e),this.type=HR.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({},HR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=zR(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()}}HR.type="element-select",HR.defaultOptions={state:WB.selected,trigger:"click"};class VR extends jR{constructor(t,e){super(t,e),this.type=VR.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},VR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=zR(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 NR(t){if(t)return t.type===Pw.Band?t.bandwidth():t.type===Pw.Point?t.step():void 0}VR.type="element-highlight",VR.defaultOptions={highlightState:WB.highlight,blurState:WB.blur,trigger:"pointerover",triggerOff:"pointerout"};class GR{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 WR=()=>{U(HR,GR),kR.registerInteraction(HR.type,HR)},UR=()=>{U(VR,GR),kR.registerInteraction(VR.type,VR)},YR=(t,e)=>mR(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,KR=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,s)=>{const n=t[s];return i[s]=YR(n,e),i}),{}):t.map((t=>YR(t,e))):t;let XR=-1;class $R extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++XR}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(dR(this.spec[e],this.view)),this.spec[e]=t,this.attach(dR(t,this.view)),this.commit(),this}}const qR=(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=dR(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}},ZR=(t,e)=>{const i=kR.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(cR(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(y(e)){const s=e.map((e=>qR(t,e,i)));return{references:s.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:s.map((t=>t.value))}}return qR(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}},JR=(t,e)=>{if(null==t?void 0:t.length){const i=[];let s=[];return t.forEach((t=>{var n;const r=ZR(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},QR={csv:Yr,dsv:Ur,tsv:Kr,json:function(t){if(!_(t))return Y(t);try{return Y(JSON.parse(t))}catch(t){return[]}}};class tL extends $R{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||!QR[e.type])return Y(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return QR[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?dR(t.format,this.view)[0]:null;if(s&&e.push(s),t.values){const s=dR(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=dR(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=mR(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=JR(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=JR(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 eL="window",iL="view",sL={trap:!1},nL="width",rL="height",aL="viewWidth",oL="viewHeight",lL="padding",hL="viewBox",cL="autoFit";function dL(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 uL(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,dL(t,e,n,s)}class pL{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 dL(this.nodes,e,0,this.compare),uL(this.nodes,e,null,this.compare)}return this.nodes.push(t),dL(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)),dL(this.nodes,e,0,this.compare),uL(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,uL(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class gL{constructor(t){this.list=[],this.ids={},this.idFunc=t||db}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 mL{constructor(){this.grammars=[],this.logger=at.getInstance(),this._curRank=0,this._committed=new gL((t=>t.uid)),this._heap=new pL(((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 gL((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 fL=(t,e,i,s,n)=>{const r=t=>{if(n||!t||s&&!s(t)||i.call(null,t),t.markType===RB.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}n&&(!t||s&&!s(t)||i.call(null,t))};r(t)};class vL{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 $d(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Il.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 J_(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 $b(o)),null===(r=this._eventConfig)||void 0===r?void 0:r.gesture){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new Jb(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 _L(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 yL(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 bL(t,e,i,s,n){if(n===eL){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{yL(t,_L(t),!1)}))}));const e=_L(t);yL(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e}class xL extends $R{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?pR(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}},ML=(t,e)=>e&&e.debounce?xt(t,e.debounce):e&&e.throttle?St(t,e.throttle):t;class TL extends FR{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 xR(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[UB]=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?BR(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);this.graphicItem||this.initGraphicItem(),this.diffState===BB.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==BB.enter&&this.diffState!==BB.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.diffState===BB.enter&&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=BR(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=PR[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===RB.shape&&(o.datum=d[0].datum)})),s}}_generateGlyphItems(t,e,i){const s=e.map((t=>Object.assign({},t,{nextAttrs:i})));return YB.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)gb(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[UB]=null})),this.glyphGraphicItems=null),super.release()}}const wL=t=>t.markType===RB.glyph?new TL(t):new FR(t);function CL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(XB,i?t.slice().sort(i):t.slice()),{keys:qB,data:s};const n=fR(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 EL{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?CL(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 PL=(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=bR(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=bR(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 BL=(t,e,i,s,n)=>d(i)?i(t.getDatum(),t,n):i;class RL extends mc{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 LL extends mc{getEndProps(){return this.to}onBind(){var t;const e=null!==(t=this.target.constructor.NOWORK_ANIMATE_ATTR)&&void 0!==t?t:Fd,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)}}vc.mode|=ko.SET_ATTR_IMMEDIATELY;let OL=0;const IL=t=>!u(t)&&(t.prototype instanceof mc||"onBind"in t.prototype&&"onStart"in t.prototype&&"onEnd"in t.prototype&&"onUpdate"in t.prototype);class DL{constructor(t,e,i){this.id=OL++,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||!kR.getAnimationType(e.type))return null;const r=kR.getAnimationType(e.type)(t,n,i);return PL(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?BL(t,0,n[i].from,0,s):void 0,e.to[i]=l?BL(t,0,n[i].to,0,s):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),PL(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=IL(o);return u(o)||IL(o)?h?new o(r.from,r.to,a,t.easing,l):r.to?new LL(r.from,r.to,a,t.easing):void 0:new RL(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 Uc(a,e))}r>0&&t.wait(r)}}function FL(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(jL(i,t[i]))})),e}function jL(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:iR,totalTime:h.totalTime,oneByOne:null!==(i=h.oneByOne)&&void 0!==i?i:oR,loop:null!==(s=h.loop)&&void 0!==s?s:aR,controlOptions:z({},hR,null!==(n=h.controlOptions)&&void 0!==n?n:{}),timeSlices:[{duration:null!==(r=h.duration)&&void 0!==r?r:sR,delay:null!==(a=h.delay)&&void 0!==a?a:nR,delayAfter:null!==(o=h.delayAfter)&&void 0!==o?o:rR,effects:[{type:h.type,channel:h.channel,custom:h.custom,easing:null!==(l=h.easing)&&void 0!==l?l:lR,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:iR,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:oR,loop:null!==(d=t.loop)&&void 0!==d?d:aR,controlOptions:z({},hR,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:nR,delayAfter:null!==(i=t.delayAfter)&&void 0!==i?i:rR,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:lR,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 zL(t,e,i){return d(t)?t.call(null,e.getDatum(),e,i):t}class HL{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 VL{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=FL(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=FL(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!==BB.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 HL(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=jL(eR,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 HL(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===BB.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 DL(s,i,e);if(l.animate(n,r),!l.isAnimating)return;s.diffState===BB.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=pR(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,s,n){const r=[],a=zL(t.startTime,e,n),o=zL(t.totalTime,e,n),l=zL(t.oneByOne,e,n),h=zL(t.loop,e,n);let c=0;t.timeSlices.forEach((t=>{var i;const a=zL(t.delay,e,n),l=zL(t.delayAfter,e,n),h=null!==(i=zL(t.duration,e,n))&&void 0!==i?i:o/s,d=Y(t.effects).map((t=>Object.assign({},t,{customParameters:zL(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===BB.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===BB.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===eR,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===BB.exit&&0===o[BB.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 NL extends $R{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new VL(this,{}),this.differ=new EL([]),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===BB.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(e,i){var s;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===VB.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:$B,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===RB.group)return;const e=CL(null!=t?t:$B,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(BB.update,t,e,i)}encodeState(t,e,i,s){if(t===BB.enter&&(this._isReentered=!0),this.spec.encode[t]){const n=this.spec.encode[t];if(uR(n))this.detach(yR(n,this.view));else{const r=_(e);r&&s||!r&&i?(Object.keys(n).forEach((t=>{this.detach(yR(n[t],this.view))})),this.spec.encode[t]={}):r?this.detach(yR(n[e],this.view)):Object.keys(e).forEach((t=>{this.detach(yR(n[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),_(e)?(this.spec.encode[t][e]=i,this.attach(yR(i,this.view))):uR(e)?(this.spec.encode[t]=e,this.attach(yR(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(yR(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=JR(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=JR(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 YB.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!==BB.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===GB.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&&!uR(n)&&Object.keys(n).forEach((t=>{vR(n[t])&&(e[t]=gR(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];uR(s)||Object.keys(s).forEach((t=>{_R(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[UB];if((null==s?void 0:s.mark)===this){const i=bL(this.view,t,s,0,iL);this.emitGrammarEvent(e,i,s)}},this.initEvent()),this.animate||(this.animate=new VL(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=gR(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!==RB.group){if(!this.graphicItem){const t=TR(this,RB.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||KB.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||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==RB.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=fR(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:()=>XB),a=fR(null!==(n=this.spec.groupBy)&&void 0!==n?n:()=>XB),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===BB.enter))),c=[];this.differ.setCallback(((t,e,i)=>{const s=t;let n;if(u(e))n=this.elementMap.get(s),n&&(n.diffState=BB.exit);else if(u(i)){n=this.elementMap.has(s)?this.elementMap.get(s):wL(this),n.diffState===BB.exit&&(n.diffState=BB.enter,this.animate.getElementAnimators(n,BB.exit).forEach((t=>t.stop("start")))),n.diffState=BB.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=BB.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:$B;l||this.differ.setCurrentData(CL(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]=SR(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[PB.group],s);e.forEach((t=>{this.markType===RB.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._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:TR(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!==RB.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=fR(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:()=>XB),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=wL(this);e.diffState=BB.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=wL(this);i.diffState=BB.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!==RB.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=TR(this,RB.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!==BB.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:PR[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=BB.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&&wR(this.graphicItem),this.detachAll(),super.release()}}let GL=class extends NL{constructor(t,e){super(t,RB.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===RB.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 PR.rect}evaluateJoin(t){if(!this.elements.length){const t=wL(this);t.updateData(XB,$B,(()=>""),this.view),this.elements=[t],this.elementMap.set(XB,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 xR(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[PB.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:TR(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 WL(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 UL(t,e){return Math.min(t<0?t+e:t-1,e)}function YL(t,e,i){let s=UL(t,i),n=UL(e,i);if(k(t)||k(e)?k(t)?k(e)||(s=UL(Math.max(0,n-1),i)):n=UL(s+1,i):(s=1,n=2),s>n){const t=n;n=s,s=t}return{start:s,end:n}}const KL=(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=>WL(t,i))),u=l.map((t=>WL(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}=YL(e,i,r),{start:h,end:c}=YL(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()}))},XL={[LB.axis]:0,[LB.legend]:1,[LB.slider]:2,[LB.player]:3,[LB.datazoom]:4},$L=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=XL[t.componentType])&&void 0!==s?s:1/0},qL=(t,e,i,s)=>{const n=i.clone(),r=t.getSpec().layout,a=mb(r.maxChildWidth,n.width()),o=mb(r.maxChildHeight,n.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=kL(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&&d$L(t)-$L(e)));for(let t=0,e=f.length;t{null==t||t.forEach((t=>{var s;if(t.markType!==RB.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=qL(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(aL,o),i.updateSignal(oL,l),i.updateSignal(lL,h)}else qL(t,n,a,e);else"grid"===r.display&&KL(t,n,a);ZL(n,e,i)}}))};class JL extends NL{constructor(t,e,i){super(t,RB.glyph,i),this.glyphType=e,this.glyphMeta=kR.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(!kR.getGraphicType(RB.glyph))return;const s=kR.createGraphic(RB.glyph,i),n=e.getMarks(),r=Object.keys(n).map((t=>{if(kR.getGraphicType(n[t])){const e=kR.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 QL=Symbol.for("key");class tO{diffGrammar(t,e){return function(t,e,i){const s={enter:[],exit:[],update:[]},n=new EL(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(CL(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!==RB.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==RB.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=CL(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=CL(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=fR(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 EL(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(CL(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:QL})),r=CL(e,(t=>{var e;return null!==(e=s(t))&&void 0!==e?e:QL}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==QL){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=pR(i.animation.delay,n,o,l),d=pR(i.animation.duration,n,o,l),u=pR(i.animation.oneByOne,n,o,l),p=pR(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)?Td:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:wd)(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);Sd(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)?Td:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:wd)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>_d(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>bd(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 xd({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Sc,null!==(l=i.easing)&&void 0!==l?l:Ac))}))}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 Ad({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Sc,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Ac))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Sd(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 eO{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 iO extends eO{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===RB.group&&s.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===RB.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=>{const s=t.mark;s.markType===RB.group&&s.includesChild(e,!1)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===RB.group&&e.includesChild(s,!1)&&(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 sO{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 nO extends NL{addGraphicItem(t,e){const i=t&&t.limitAttrs,s=TR(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?RB.richtext:RB.text,t);return super.addGraphicItem(t,e,s)}release(){super.release()}}nO.markType=RB.text;const rO={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)"}}},aO={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},oO=Object.assign({},rO);oO.axis=Object.assign({},oO.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),oO.circleAxis=Object.assign({},oO.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),oO.grid=Object.assign({},oO.grid,{style:{stroke:"#404349"}}),oO.circleGrid=Object.assign({},oO.circleGrid,{style:{stroke:"#404349"}}),oO.rectLabel=Object.assign({},oO.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),oO.lineLabel=Object.assign({},oO.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),oO.symbolLabel=Object.assign({},oO.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),oO.title=Object.assign({},oO.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const lO={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:aO,components:oO},hO={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:aO,components:rO};let cO=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")}};cO._themes=new Map,cO.registerTheme("default",hO),cO.registerTheme("dark",lO);class dO extends NL{constructor(t,e,i,s){super(t,RB.component,i),this._componentDatum={[XB]: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:kR.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,XB)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[XB]+=1}evaluateJoin(t){return this.spec.key=XB,t?(t[XB]=this._componentDatum[XB],this._componentDatum=t):this._componentDatum={[XB]:this._componentDatum[XB]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}class uO 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[UB],n=bL(0,t,s,0,iL);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(mR(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)):MR(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 xL(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 tL(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=kR.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=kR.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 RB.group:n=new GL(this,s);break;case RB.glyph:n=new JL(this,null==i?void 0:i.glyphType,s);break;case RB.component:n=kR.hasComponent(null==i?void 0:i.componentType)?kR.createComponent(null==i?void 0:i.componentType,this,s,null==i?void 0:i.mode):new dO(this,null==i?void 0:i.componentType,s,null==i?void 0:i.mode);break;case RB.text:n=new nO(this,t,s);break;default:n=kR.hasMark(t)?kR.createMark(t,this,s):new NL(this,t,s)}return this.grammars.record(n),this._dataflow.add(n),n}group(t){return this.mark(RB.group,t)}glyph(t,e){return this.mark(RB.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(RB.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(RB.component,t,{componentType:LB.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(RB.component,t,{componentType:LB.grid,mode:e})}legend(t){return this.mark(RB.component,t,{componentType:LB.legend})}slider(t){return this.mark(RB.component,t,{componentType:LB.slider})}label(t){return this.mark(RB.component,t,{componentType:LB.label})}datazoom(t){return this.mark(RB.component,t,{componentType:LB.datazoom})}player(t){return this.mark(RB.component,t,{componentType:LB.player})}title(t){return this.mark(RB.component,t,{componentType:LB.title})}scrollbar(t){return this.mark(RB.component,t,{componentType:LB.scrollbar})}customized(t,e){const i=kR.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&&AL.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&(wR(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_"+ ++SL;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(cO.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(nL,t.width),this.updateSignal(rL,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=kR.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=VB.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var s,n,r,a,o;return[{id:nL,value:null!==(s=t[nL])&&void 0!==s?s:0},{id:rL,value:null!==(n=t[rL])&&void 0!==n?n:0},{id:lL,value:kL(null!==(a=null!==(r=t[lL])&&void 0!==r?r:e[lL])&&void 0!==a?a:null==i?void 0:i.padding)},{id:aL,update:{callback:(t,e)=>{const i=kL(e[lL]);return e[nL]-i.left-i.right},dependency:[nL,lL]}},{id:oL,update:{callback:(t,e)=>{const i=kL(e[lL]);return e[rL]-i.top-i.bottom},dependency:[rL,lL]}},{id:hL,update:{callback:(t,e)=>{const i=kL(e[lL]);return(t||new Jt).setValue(i.left,i.top,i.left+e[aL],i.top+e[oL])},dependency:[aL,oL,lL]}},{id:cL,value:null!==(o=t[cL])&&void 0!==o?o:e[cL]}]})(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===RB.glyph?{glyphType:t.glyphType}:t.type===RB.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=cO.getTheme(t))&&void 0!==e?e:cO.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(nL);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(rL);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(aL);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(oL);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(lL);if(arguments.length){const i=kL(t);return this.updateSignal(e,i),i}return kL(e.output())}autoFit(t){const e=this.getSignalById(cL);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(hL);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=VB.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===RB.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var e;const i=this._options.doLayout||ZL;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=>{fL(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),fL(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=ZB,morph:o=JB,morphAll:l=QB,animation:h={},enableExitAnimation:c=tR}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:lR,delay:null!==(i=h.delay)&&void 0!==i?i:nR,duration:null!==(s=h.duration)&&void 0!==s?s:sR,oneByOne:null!==(n=h.oneByOne)&&void 0!==n?n:oR,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=VB.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=VB.reevaluate,this._dataflow.evaluate()),this._layoutState=VB.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=>!AL.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 fL(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(nL,t)),e!==this.height()&&(s=!0,this.updateSignal(rL,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]:iL;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):MR(t)?(i.markType=t,i.source=e):i.source=t===eL?eL: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=cR(l,this),v=ML(((t,e)=>{const s=c===iL&&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===eL&&(t=bL(0,t,e,0,eL));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===iL){if(function(t,e,i){const s=null==t?void 0:t[e];return!(!1===s||g(s)&&!s[i])}(this._eventConfig,iL,d))return this.addEventListener(d,v,sL),()=>{this.removeEventListener(d,v)}}else if(c===eL)return P_.addEventListener(d,v),this._eventListeners.push({type:d,source:P_,handler:v}),()=>{P_.removeEventListener(d,v);const t=this._eventListeners.findIndex((t=>t.type===d&&t.source===P_&&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=kR.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 vL(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e;this.grammars=new eO((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new iO((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 mL,this.animate=new sO(this),this._morph=new tO,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,[iL,eL]),e}(this._options.eventConfig),this._theme=this._options.disableTheme?null:cO.getDefaultTheme(),this.parseBuiltIn(),(e=this._options).mode&&P_.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=VB.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!==RB.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=P_.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&P_.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(),kR.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 pO=()=>{fM(),lM(),kR.registerGraphic(RB.path,Ng)},gO=()=>{fM(),uM(),kR.registerGraphic(RB.rect,Tg)},mO=()=>{fM(),aM(),kR.registerGraphic(RB.rule,Ag)},fO=()=>{fM(),_M(),kR.registerGraphic(RB.symbol,bg)},vO=()=>{fM(),bM(),gM(),kR.registerGraphic(RB.text,mp)},_O=()=>{fM(),tM(),kR.registerGraphic(RB.glyph,Cg)},yO=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},bO=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},xO=(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(yb(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},SO=(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&&yb(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},AO=yO(xO),kO=bO(xO);const MO=(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(yb(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},TO=(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&&yb(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},wO=yO(MO),CO=bO(MO);const EO=(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`},PO=(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`},BO=(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)?PO:EO,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)}}:{}},RO=(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}},LO=(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})}},OO=(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 IO extends dO{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 DO=(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 FO extends IO{constructor(t,e,i){super(t,LB.axis,e),this.spec.componentType=LB.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=kR.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=SR(n,e,i,s);const h=pR(this.spec.inside,s,e,i),c=pR(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(DO(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=pR(this.spec.tickCount,s,e,i);switch(this._getAxisComponentType()){case IB.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 IB.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?IB.circleAxis:IB.lineAxis,this._axisComponentType}}FO.componentType=LB.axis;let jO=class extends dO{constructor(t,e){super(t,LB.label,e),this.spec.componentType=LB.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=pR(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=pR(s,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case RB.line:case RB.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case RB.rect:case RB.rect3d:case RB.interval:g=p.rectLabel;break;case RB.symbol:case RB.circle:case RB.cell:g=p.symbolLabel;break;case RB.arc:case RB.arc3d:g=p.arcLabel;break;case RB.polygon:case RB.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=SR(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=SR(i,t,e,d);m.push(z({},f,s))}));else{const t=SR(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}};jO.componentType=LB.label;const zO=()=>{kR.registerGraphicComponent(LB.label,(t=>new $T(t))),kR.registerComponent(LB.label,jO)};class HO extends IO{constructor(t,e,i){super(t,LB.grid,e),this.spec.componentType=LB.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=kR.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=SR(s,t,e,i);const d=pR(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 DB.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 DB.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=pR(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(DO(h,n,s,d,this.spec.layout,!0),c))}this._getGridComponentType()===DB.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=pR(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case DB.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 DB.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=DB.circleAxisGrid:this._gridComponentType=DB.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case IB.circleAxis:this._gridComponentType=DB.circleAxisGrid;break;case IB.lineAxis:default:this._gridComponentType=DB.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()?DB.lineAxisGrid:DB.circleAxisGrid:DB.lineAxisGrid}else this._gridComponentType=DB.lineAxisGrid;return this._gridComponentType}}HO.componentType=LB.grid;const VO=(t,e,i)=>e.filter((e=>t.callback(e,i))),NO=(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 GO(t){return t.reduce(((t,e)=>t+e),0)}const WO={min:$,max:X,average:function(t){return 0===t.length?0:GO(t)/t.length},sum:GO};function UO(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 YO(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 KO(t,e,i,s){return YO(t,e,i,"min",s)}function XO(t,e,i,s){return YO(t,e,i,"max",s)}function $O(t,e,i,s){return YO(t,e,i,"average",s)}function qO(t,e,i,s){return YO(t,e,i,"sum",s)}const ZO=(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=UO;if("min"===n?l=KO:"max"===n?l=XO:"average"===n?l=$O:"sum"===n&&(l=qO),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[]},JO="_mo_hide_";const QO=(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(JO)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(JO,!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(JO,!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},tI=()=>{kR.registerTransform("filter",{transform:VO,markPhase:"beforeJoin"},!0)},eI=()=>{kR.registerTransform("map",{transform:NO,markPhase:"beforeJoin"},!0)},iI=()=>{kR.registerTransform("sampling",{transform:ZO,markPhase:"afterEncode"},!0)},sI=()=>{kR.registerTransform("markoverlap",{transform:QO,markPhase:"afterEncode"},!0)},nI=(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}}},rI=(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}}},aI=(t,e,i)=>{var s,n,r,a;const o=null!==(s=t.getFinalGraphicAttributes())&&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}}},oI=(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}}},lI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("y",!1),i=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1),n=t.getGraphicAttribute("y",!1),r=t.getGraphicAttribute("y1",!1),a=t.getGraphicAttribute("height",!1),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}}}}},hI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("y",!1),i=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("x1",!1),n=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicAttribute("height",!1),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 cI=(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.getGraphicAttribute("x",!1),r=t.getGraphicAttribute("x1",!1),a=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);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 dI=(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.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);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 uI=(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.getGraphicAttribute("y",!1),r=t.getGraphicAttribute("y1",!1),a=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("y",!1),n=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);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 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.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("y",!1),n=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);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)},gI=(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.getFinalGraphicAttributes();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.getFinalGraphicAttributes();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)},mI=(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.getFinalGraphicAttributes();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)},fI=(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.getFinalGraphicAttributes(),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.getFinalGraphicAttributes();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)},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=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.getFinalGraphicAttributes();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)},_I=(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((()=>Object.assign(n)))},yI=(t,e,i)=>({from:{points:_I(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),bI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:_I(t,e)}}),xI=(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),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}})),SI=(t,e,i)=>({from:{points:xI(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),AI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:xI(t,e,i)}}),kI=(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),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,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)=>{var s,n;const{offset:r=0,orient:a,direction:o,point:l}=null!=e?e:{};let h=0,c=0;"negative"===a&&(i.group?(h=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),c=null!==(n=i.groupHeight)&&void 0!==n?n:i.group.getBounds().height(),i.groupWidth=h,i.groupHeight=c):(h=i.width,c=i.height)),h+=r,c+=r;const u=d(l)?l.call(null,t.getDatum(),t,i):l,p=u&&k(u.x)?u.x:h,g=u&&k(u.y)?u.y:c,m=t.getFinalGraphicAttributes();switch(o){case"x":return{from:{x:p},to:{x:null==m?void 0:m.x}};case"y":return{from:{y:g},to:{y:null==m?void 0:m.y}};default:return{from:{x:p,y:g},to:{x:null==m?void 0:m.x,y:null==m?void 0:m.y}}}},CI=(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}}}},EI=(t,e,i)=>{var s,n,r,a;const o=t.getFinalGraphicAttributes();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}}}},PI=(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}}}},BI={symbol:["_mo_hide_","visible"]},RI=(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=BI[t.mark.markType])&&r.forEach((t=>{delete s[t],delete n[t]})),Object.keys(n).forEach((t=>{gb(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}},LI=(t,e,i)=>{var s,n;const r=null!==(n=null===(s=t.getFinalGraphicAttributes())||void 0===s?void 0:s.angle)&&void 0!==n?n:0;let a=0;return a=pt(r/(2*Math.PI),0)?Math.round(r/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(r/(2*Math.PI))*Math.PI*2:Math.floor(r/(2*Math.PI))*Math.PI*2,{from:{angle:a},to:{angle:r}}},OI=(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}}},II=()=>{kR.registerAnimationType("clipIn",nI)},DI=()=>{kR.registerAnimationType("clipOut",rI)},FI=()=>{kR.registerAnimationType("fadeIn",aI)},jI=()=>{kR.registerAnimationType("fadeOut",oI)},zI=()=>{kR.registerAnimationType("growCenterIn",lI)},HI=()=>{kR.registerAnimationType("growCenterOut",hI)},VI=()=>{kR.registerAnimationType("growHeightIn",uI)},NI=()=>{kR.registerAnimationType("growHeightOut",pI)},GI=()=>{kR.registerAnimationType("growWidthIn",cI)},WI=()=>{kR.registerAnimationType("growWidthOut",dI)},UI=()=>{kR.registerAnimationType("growPointsIn",yI)},YI=()=>{kR.registerAnimationType("growPointsOut",bI)},KI=()=>{kR.registerAnimationType("growPointsXIn",SI)},XI=()=>{kR.registerAnimationType("growPointsXOut",AI)},$I=()=>{kR.registerAnimationType("growPointsYIn",MI)},qI=()=>{kR.registerAnimationType("growPointsYOut",TI)},ZI=()=>{kR.registerAnimationType("growAngleIn",gI)},JI=()=>{kR.registerAnimationType("growAngleOut",mI)},QI=()=>{kR.registerAnimationType("growRadiusIn",fI)},tD=()=>{kR.registerAnimationType("growRadiusOut",vI)},eD=()=>{kR.registerAnimationType("moveIn",wI)},iD=()=>{kR.registerAnimationType("moveOut",CI)},sD=()=>{kR.registerAnimationType("scaleIn",EI)},nD=()=>{kR.registerAnimationType("scaleOut",PI)},rD=()=>{kR.registerAnimationType("rotateIn",LI)},aD=()=>{kR.registerAnimationType("rotateOut",OI)},oD=()=>{kR.registerAnimationType("update",RI)};class lD extends NL{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=uR(e)?null:Object.keys(e).reduce(((t,s)=>(vR(e[s])&&(t[s]=gR(e[s].scale,i)),t)),{});this._encoders[t]={callback:(t,i,n)=>{const r=SR(e,t,i,n);if(u(r.size)){const t=s.x?NR(s.x):void 0,e=s.y?NR(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(PR.symbol)}release(){super.release(),this._encoders=null}}lD.markType=RB.cell;const hD=["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 cD,dD,uD;t.ChartEvent=void 0,(cD=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",cD.rendered="rendered",cD.renderFinished="renderFinished",cD.animationFinished="animationFinished",cD.regionSeriesDataFilterOver="regionSeriesDataFilterOver",cD.afterInitData="afterInitData",cD.afterInitEvent="afterInitEvent",cD.afterInitMark="afterInitMark",cD.rawDataUpdate="rawDataUpdate",cD.viewDataFilterOver="viewDataFilterOver",cD.viewDataUpdate="viewDataUpdate",cD.viewDataStatisticsUpdate="viewDataStatisticsUpdate",cD.markDeltaYUpdate="markDeltaYUpdate",cD.viewDataLabelUpdate="viewDataLabelUpdate",cD.scaleDomainUpdate="scaleDomainUpdate",cD.scaleUpdate="scaleUpdate",cD.dataZoomChange="dataZoomChange",cD.drill="drill",cD.layoutStart="layoutStart",cD.layoutEnd="layoutEnd",cD.layoutRectUpdate="layoutRectUpdate",cD.playerPlay="playerPlay",cD.playerPause="playerPause",cD.playerEnd="playerEnd",cD.playerChange="playerChange",cD.playerForward="playerForward",cD.playerBackward="playerBackward",cD.scrollBarChange="scrollBarChange",cD.brushStart="brushStart",cD.brushChange="brushChange",cD.brushEnd="brushEnd",cD.brushClear="brushClear",cD.legendSelectedDataChange="legendSelectedDataChange",cD.legendFilter="legendFilter",cD.legendItemClick="legendItemClick",cD.legendItemHover="legendItemHover",cD.legendItemUnHover="legendItemUnHover",cD.tooltipShow="tooltipShow",cD.tooltipHide="tooltipHide",cD.tooltipRelease="tooltipRelease",cD.afterResize="afterResize",cD.afterRender="afterRender",cD.afterLayout="afterLayout",t.Event_Source_Type=void 0,(dD=t.Event_Source_Type||(t.Event_Source_Type={})).chart="chart",dD.window="window",dD.canvas="canvas",t.Event_Bubble_Level=void 0,(uD=t.Event_Bubble_Level||(t.Event_Bubble_Level={})).vchart="vchart",uD.chart="chart",uD.model="model",uD.mark="mark";const pD=`${hB}_waterfall_default_seriesField`,gD=`${hB}_CORRELATION_X`,mD=`${hB}_CORRELATION_Y`,fD=`${hB}_CORRELATION_SIZE`,vD=`${hB}_MEASURE_CANVAS_ID`,_D=`${hB}_DEFAULT_DATA_INDEX`,yD=`${hB}_DEFAULT_DATA_KEY`,bD=`${hB}_DEFAULT_DATA_SERIES_FIELD`,xD=`${hB}_DEFAULT_SERIES_STYLE_NAME`;var SD;t.AttributeLevel=void 0,(SD=t.AttributeLevel||(t.AttributeLevel={}))[SD.Default=0]="Default",SD[SD.Theme=1]="Theme",SD[SD.Chart=2]="Chart",SD[SD.Base_Series=3]="Base_Series",SD[SD.Series=4]="Series",SD[SD.Mark=5]="Mark",SD[SD.User_Chart=6]="User_Chart",SD[SD.User_Series=7]="User_Series",SD[SD.User_Mark=8]="User_Mark",SD[SD.Built_In=99]="Built_In";const AD=`${hB}_STACK_KEY`,kD=`${hB}_STACK_START`,MD=`${hB}_STACK_END`,TD=`${hB}_STACK_START_PERCENT`,wD=`${hB}_STACK_END_PERCENT`,CD=`${hB}_STACK_START_OffsetSilhouette`,ED=`${hB}_STACK_END_OffsetSilhouette`,PD=`${hB}_STACK_TOTAL`,BD=`${hB}_STACK_TOTAL_PERCENT`,RD=`${hB}_STACK_TOTAL_TOP`,LD=`${hB}_SEGMENT_START`,OD=`${hB}_SEGMENT_END`;var ID,DD;t.LayoutZIndex=void 0,(ID=t.LayoutZIndex||(t.LayoutZIndex={}))[ID.Axis_Grid=50]="Axis_Grid",ID[ID.CrossHair_Grid=100]="CrossHair_Grid",ID[ID.Region=450]="Region",ID[ID.Mark=300]="Mark",ID[ID.Node=400]="Node",ID[ID.Axis=100]="Axis",ID[ID.MarkLine=500]="MarkLine",ID[ID.MarkArea=100]="MarkArea",ID[ID.MarkPoint=500]="MarkPoint",ID[ID.DataZoom=500]="DataZoom",ID[ID.ScrollBar=500]="ScrollBar",ID[ID.Player=500]="Player",ID[ID.Legend=500]="Legend",ID[ID.CrossHair=500]="CrossHair",ID[ID.Indicator=500]="Indicator",ID[ID.Title=500]="Title",ID[ID.Label=500]="Label",ID[ID.Brush=500]="Brush",ID[ID.CustomMark=500]="CustomMark",ID[ID.Interaction=700]="Interaction",t.LayoutLevel=void 0,(DD=t.LayoutLevel||(t.LayoutLevel={}))[DD.Indicator=10]="Indicator",DD[DD.Region=20]="Region",DD[DD.Axis=30]="Axis",DD[DD.DataZoom=40]="DataZoom",DD[DD.Player=40]="Player",DD[DD.ScrollBar=40]="ScrollBar",DD[DD.Legend=50]="Legend",DD[DD.Title=70]="Title",DD[DD.CustomMark=70]="CustomMark";const FD=["linear","radial","conical"],jD={x0:0,y0:0,x1:1,y1:1},zD={x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},HD={x:.5,y:.5,startAngle:0,endAngle:2*Math.PI},VD={linear:jD,radial:zD,conical:HD},ND={label:{name:"label",type:"text"}},GD=`${hB}_rect_x`,WD=`${hB}_rect_x1`,UD=`${hB}_rect_y`,YD=`${hB}_rect_y1`,KD=Object.assign(Object.assign({},ND),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),XD=Object.assign(Object.assign({},ND),{bar3d:{name:"bar3d",type:"rect3d"}}),$D={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},qD=Object.assign(Object.assign({},ND),$D),ZD=Object.assign(Object.assign({},ND),{point:{name:"point",type:"symbol"}}),JD=Object.assign(Object.assign(Object.assign({},ND),$D),{area:{name:"area",type:"area"}}),QD=Object.assign(Object.assign(Object.assign({},ND),$D),{area:{name:"area",type:"area"}}),tF=Object.assign(Object.assign({},ND),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),eF=Object.assign(Object.assign({},ND),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}}),iF=Object.assign(Object.assign({},ND),{rose:{name:"rose",type:"arc"}}),sF=Object.assign(Object.assign({},ND),{area:{name:"area",type:"path"}}),nF=Object.assign(Object.assign({},ND),{group:{name:"group",type:"group"}}),rF=Object.assign(Object.assign({},nF),{track:{name:"track",type:"arc"},progress:{name:"progress",type:"arc"}}),aF=Object.assign(Object.assign({},ND),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),oF=Object.assign(Object.assign({},ND),{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"}}),lF=Object.assign(Object.assign({},ND),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"}}),hF=Object.assign(Object.assign({},ND),{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"}}),cF=Object.assign(Object.assign({},ND),{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"}}),dF=Object.assign(Object.assign({},ND),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),uF=Object.assign(Object.assign({},KD),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),pF=Object.assign(Object.assign({},ND),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),gF=Object.assign(Object.assign({},ND),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),mF=Object.assign(Object.assign({},ND),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}}),fF=Object.assign(Object.assign({},nF),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),vF=Object.assign(Object.assign({},ND),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),_F=Object.assign(Object.assign({},ND),{sunburst:{name:"sunburst",type:"arc"}}),yF=Object.assign(Object.assign({},KD),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),bF=Object.assign(Object.assign({},XD),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),xF=Object.assign(Object.assign({},ND),{circlePacking:{name:"circlePacking",type:"arc"}}),SF=Object.assign(Object.assign({},ND),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}}),AF=Object.assign(Object.assign({},ND),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),kF=Object.assign({},JD),MF=Object.assign(Object.assign({},ND),{liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"symbol"}}),TF=Object.assign(Object.assign({},ND),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});var wF;!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"}(wF||(wF={}));const CF={[oB.bar]:KD,[oB.bar3d]:XD,[oB.line]:qD,[oB.scatter]:ZD,[oB.area]:JD,[oB.radar]:QD,[oB.pie]:tF,[oB.pie3d]:eF,[oB.rose]:iF,[oB.geo]:ND,[oB.map]:sF,[oB.circularProgress]:rF,[oB.link]:aF,[oB.dot]:oF,[oB.wordCloud]:lF,[oB.wordCloud3d]:lF,[oB.funnel]:hF,[oB.funnel3d]:cF,[oB.linearProgress]:dF,[oB.waterfall]:uF,[oB.boxPlot]:pF,[oB.treemap]:gF,[oB.sankey]:mF,[oB.gauge]:fF,[oB.gaugePointer]:vF,[oB.sunburst]:_F,[oB.rangeColumn]:yF,[oB.rangeColumn3d]:bF,[oB.circlePacking]:xF,[oB.heatmap]:SF,[oB.correlation]:AF,[oB.rangeArea]:kF,[oB.liquid]:MF,[oB.venn]:TF};function EF(t){var e,i;const{type:s}=t;return s===oB.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}const PF={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},BF={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function RF(t,e){var i;if(!t)return[];const s=zF(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?FF(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>DF(i)?OF(t,i,e):i)).filter(p)}))):i.map((i=>DF(i)?OF(t,i,e):i)).filter(p):[]}return[]}function LF(t,e){var i,s;return FF(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 OF(t,e,i){var s;const n=zF(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=PF[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=BF[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 IF=(t,e,i)=>{if(e&&DF(t)){const s=OF(e,t,i);if(s)return s}return t};function DF(t){return t&&"palette"===t.type&&!!t.key}function FF(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function jF(t){return y(t)?{dataScheme:t}:t}function zF(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=EF(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 HF extends sC{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(!FF(this._range))return void super.range(this._range);const t=LF(this._range,this._domain);super.range(t)}}const VF={linear:TC,band:rC,point:class extends rC{constructor(t){super(!1),this.type=Pw.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:sC,threshold:BC,colorOrdinal:HF};function NF(t){const e=VF[t];return e?new e:null}function GF(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 WF(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function UF(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function YF(t){return!!_(t)&&(!!t.endsWith("%")&&nb(t.substring(0,t.length-1)))}function KF(t,e,i,s=0){var n,r;return S(t)?t:YF(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 XF(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]=KF(t[s],e.size,i)}))})),o}function $F(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)||YF(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 qF(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const ZF=(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},JF=[{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"]}],QF={default:{dataScheme:JF,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)"}}},tj="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",ej={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:tj,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:tj,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:CB,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"}}}}},ij={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}}},sj=Object.assign(Object.assign({},ij),{label:{space:0}}),nj={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}}}}},rj="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;",aj={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:rj,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:rj,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}}}},oj={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}},lj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}},hj={horizontal:Object.assign(Object.assign({},oj),{rail:{width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:lj}),vertical:Object.assign(Object.assign({},oj),{rail:{width:8,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:lj})},cj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}},dj={horizontal:Object.assign(Object.assign({},oj),{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:cj}),vertical:Object.assign(Object.assign({},oj),{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:cj})},uj={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"}}}}},pj={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"}}}}},gj={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 mj(t,e){return t&&e.key in t?t[e.key]:e.default}function fj(t){return t&&"token"===t.type&&!!t.key}const vj={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%"},_j={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:QF,token:vj,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:ej,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:hj,sizeLegend:dj,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:ij,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:sj,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:pj,markArea:uj,markPoint:gj,polarMarkLine:pj,polarMarkArea:uj,polarMarkPoint:gj,geoMarkPoint:gj,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:aj,crosshair:nj,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},yj={name:"dark",colorScheme:{default:{dataScheme:JF,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}}}}}},bj=(t,e)=>t===e||!d(t)&&!d(e)&&(y(t)&&y(e)?e.every((e=>t.some((t=>bj(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>bj(t[i],e[i])))),xj=(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]={}),xj(t[s],e.slice(1),i))};function Sj(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]=Sj(n,e)}return s}function Aj(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])?kj(t,e,r,i):Mj(t,r,s[r])}}}}function kj(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?Tj({},t[n][e.index],i):i):t[n]=s?Tj({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?Tj({},t[n][r],i):i)}else t.id===e&&(t[n]=s?Tj({},t[n],i):i)}))}function Cj(t,...e){return Tj(Ej(t),...e.map(Ej))}function Ej(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]=jF(s),e}),{}));return t}(t.colorScheme),{series:s}=t,{mark:n,markByName:r}=t;let a;return(n||r)&&(a=Object.keys(CF).reduce(((t,e)=>{var i;const a=null!==(i=null==s?void 0:s[e])&&void 0!==i?i:{};return t[e]=Pj(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 Pj(t,e,i,s){if(!CF[e])return t;const n={};return Object.values(CF[e]).forEach((({type:e,name:r})=>{n[r]=Tj({},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 Bj=["animationThreshold","colorScheme","name","padding"];function Rj(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];Bj.includes(r)?n[r]=a:f(a)?DF(a)?n[r]=IF(a,e,s):fj(a)?n[r]=mj(i,a):n[r]=Rj(a,e,i,s):n[r]=a})),n}const Lj={[_j.name]:_j},Oj=_j.name,Ij=new Map(Object.keys(Lj).map((t=>[t,Lj[t]]))),Dj=new Map(Object.keys(Lj).map((t=>[t,Rj(Lj[t])]))),Fj=new Map(Object.keys(Lj).map((t=>[t,t===Oj]))),jj=(t,e)=>{if(!t)return;const i=Nj(e);Ij.set(t,i),Dj.set(t,Rj(i)),Fj.set(t,!0)},zj=(t=Oj,e=!1)=>(Fj.has(t)&&!Fj.get(t)&&jj(t,Ij.get(t)),e?Dj.get(t):Ij.get(t)),Hj=t=>Ij.delete(t)&&Dj.delete(t)&&Fj.delete(t),Vj=t=>!!_(t)&&Ij.has(t),Nj=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:Oj;return Cj({},zj(i),t)};class Gj{static registerInstance(t){Gj.instances.set(t.id,t)}static unregisterInstance(t){Gj.instances.delete(t.id)}static getInstance(t){return Gj.instances.get(t)}static instanceExist(t){return Gj.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return Gj.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}Gj.instances=new Map;class Wj{static registerTheme(t,e){jj(t,e)}static getTheme(t,e=!1){return zj(t,e)}static removeTheme(t){return Hj(t)}static themeExist(t){return Vj(t)}static getDefaultTheme(){return Wj.themes.get(Oj)}static setCurrentTheme(t){Wj.themeExist(t)&&(Wj._currentThemeName=t,Gj.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return Wj.getTheme(Wj._currentThemeName,t)}static getCurrentThemeName(){return Wj._currentThemeName}}function Uj(t,e){return _(t)?Wj.themeExist(t)?Wj.getTheme(t,e):{}:g(t)?t:{}}function Yj(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]=Yj(t[s],e)}return i}return y(t)?t.map((t=>Yj(t,e))):t}function Kj(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]=Kj(t[s],e)}return i}return y(t)?t.map((t=>Kj(t,e))):t}Wj.themes=Ij,Wj._currentThemeName=Oj;function Xj(t,e){for(let i=0;it.key===e))}function qj(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 Zj(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:{}},iz(t,a,n[o],l,e,r))})),s?Jj(n):n}function Jj(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))):Jj(t[e].nodes);return t}function Qj(t,e){if("values"in t&&t.values.length){const i=JP(t.values,e),s=ZP(t.values,wD);t.values.forEach((t=>{t[PD]=i,t[BD]=s,delete t[RD]}));const n=t.values.reduce(((t,e)=>e[MD]>t[MD]?e:t));n[RD]=!0}else for(const i in t.nodes)Qj(t.nodes[i],e)}function tz(t){if(!t.values.length)return;const e=t.values[t.values.length-1][MD]/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[kD]=s,s+=r[MD],r[MD]=s):(r[kD]=n,n+=r[MD],r[MD]=n),r[AD]=t.key}if(i)for(let i=0;i=0?s:n;r=a>=0?1:-1,l[TD]=0===h?0:Math.min(1,l[kD]/h)*r,l[wD]=0===h?0:Math.min(1,l[MD]/h)*r}}for(const s in t.nodes)ez(t.nodes[s],e,i)}function iz(t,e,i,s,n,r,a){if("values"in e)if(n&&e.values.forEach((t=>t[MD]=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}),iz(t,e.nodes[o],i.nodes[o],s,n,r,l)}}const sz=(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]=rz(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function az(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>lz(t.style(e,i,s,n)):B(t.style)||(e.style=lz(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>lz(t.state[e](i,s,n,r)):B(t.state[e])||(i[e]=lz(t.state[e]))})),e.state=i}return e}function oz(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>lz(t[i](e,s,n,r)):B(t[i])||(e[i]=lz(t[i]))})),e}function lz(t){return(null==t?void 0:t.angle)&&(t.angle=te(t.angle)),t}class hz{static registerChart(t,e){hz._charts[t]=e}static registerSeries(t,e){hz._series[t]=e}static registerComponent(t,e,i){hz._components[t]={cmp:e,alwaysCheck:i}}static registerMark(t,e){hz._marks[t]=e}static registerRegion(t,e){hz._regions[t]=e}static registerTransform(t,e){hz.transforms[t]=e}static registerLayout(t,e){hz._layout[t]=e}static registerAnimation(t,e){hz._animations[t]=e}static registerImplement(t,e){hz._implements[t]=e}static registerChartPlugin(t,e){hz._chartPlugin[t]=e}static registerComponentPlugin(t,e){hz._componentPlugin[t]=e}static createChart(t,e,i){if(!hz._charts[t])return null;return new(0,hz._charts[t])(e,i)}static createChartSpecTransformer(t,e){if(!hz._charts[t])return null;const i=hz._charts[t];return new(0,i.transformerConstructor)(Object.assign({seriesType:i.seriesType},e))}static createRegion(t,e,i){if(!hz._regions[t])return null;return new(0,hz._regions[t])(e,i)}static createRegionSpecTransformer(t,e){if(!hz._regions[t])return null;return new(0,hz._regions[t].transformerConstructor)(e)}static createSeries(t,e,i){if(!hz._series[t])return null;return new(0,hz._series[t])(e,i)}static createSeriesSpecTransformer(t,e){if(!hz._series[t])return null;return new(0,hz._series[t].transformerConstructor)(e)}static createMark(t,e,i){if(!hz._marks[t])return null;const s=new(0,hz._marks[t])(e,i);return"group"===s.type&&s.setInteractive(!1),s}static getComponents(){return Object.values(hz._components)}static getComponentInKey(t){return hz._components[t].cmp}static getLayout(){return Object.values(hz._layout)}static getLayoutInKey(t){return hz._layout[t]}static getSeries(){return Object.values(hz._series)}static getSeriesInType(t){return hz._series[t]}static getRegionInType(t){return hz._regions[t]}static getAnimationInKey(t){return hz._animations[t]}static getImplementInKey(t){return hz._implements[t]}static getSeriesMarkMap(t){return hz._series[t]?hz._series[t].mark:{}}static getChartPlugins(){return Object.values(hz._chartPlugin)}static getComponentPlugins(){return Object.values(hz._componentPlugin)}static getComponentPluginInType(t){return hz._componentPlugin[t]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}}hz._charts={},hz._series={},hz._components={},hz._marks={},hz._regions={},hz._animations={},hz._implements={},hz._chartPlugin={},hz._componentPlugin={},hz.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}},hz.dataParser={csv:Yr,dsv:Ur,tsv:Kr},hz._layout={};const cz=(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))},dz=(t,e,i,s)=>{var n;const r=jw(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:uz(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("_")}`,pz=(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},gz=(t,e)=>{if(!t)return null;if(!rB(t.getRegionsInIndex(),"polar"))return null;const{x:i,y:s}=e,n=pz(t,(t=>"angle"===t.getOrient()),e),r=pz(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&&jw(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=eB({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=iB(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=dz(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&&jw(r.type)){const h=t.getCenter(),c={x:i-t.getLayoutStartPoint().x-h.x,y:s-t.getLayoutStartPoint().y-h.y};let d=eB({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=iB(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 _=dz(f,t,"polar",o);a.push({index:v,value:f,position:r.scale(f),axis:t,data:_})}})),a.length?a:null};function mz(t){return"bottom"===t||"top"===t}function fz(t){return"left"===t||"right"===t}function vz(t){return"z"===t}function _z(t,e){return UF(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function yz(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function bz(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?mz(t)?"linear":"band":mz(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const xz=t=>t.fieldX[0],Sz=t=>t.fieldY[0],Az=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},kz=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},Mz=(t,e)=>t?e?xz:Az:e?Sz:kz,Tz=(t,e,i)=>{var s,n;if(!t)return null;if(!rB(t.getRegionsInIndex(),"cartesian"))return null;const{x:r,y:a}=e,o=null!==(s=pz(t,(t=>mz(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=pz(t,(t=>fz(t.getOrient())),e))&&void 0!==n?n:[],h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{jw(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=wz(s,i,t,Mz(e,jw(s.getScale().type)));n&&u.push(n)}}else{const n=h.size>0;if((n?h:c).has(s)){const r=wz(s,i,t,Mz(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},wz=(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 Cz(t,a,s)},Cz=(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=dz(e,t,"cartesian",null!=i?i:mz(t.getOrient())?xz:Sz);return{index:n,value:e,position:s.scale(e),axis:t,data:r}};class Ez{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:$y)("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:$y)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s;const n=null!==(i=Tz(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(s=gz(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=>jw(t.getScale().type))),r=n.length?n:s.filter((t=>{const e=t.getOrient();return mz(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=Cz(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var Pz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Pz||(Pz={}));const Bz={[Pz.dimensionHover]:class extends Ez{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)=>!cz(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}),tb(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}),tb(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[Pz.dimensionClick]:class extends Ez{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 Rz=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(Bz[t]){const e=new Bz[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(Bz[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}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class Lz{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}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const Oz={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 Iz{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 Lz);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}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 Oz[a]&&(a=Oz[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.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 hD.includes(e)||Object.values(t.VGRAMMAR_HOOK_EVENT).includes(e)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&kR.hasInteraction(e)}}function Dz(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function Fz(t,e,i){t.getParser(e)||t.registerParser(e,i)}const jz=new Map;let zz;function Hz(){zz||(zz=new va,Fz(zz,"geojson",da),Fz(zz,"topojson",pa),Dz(zz,"simplify",Rr))}function Vz(t,e,i={type:"geojson",centroid:!0}){jz.has(t)&&Xy(`map type of '${t}' already exists, will be overwritten.`),Hz();const s=new ya(zz),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}),jz.set(t,s)}function Nz(t){jz.has(t)?jz.delete(t):Xy(`map type of '${t}' does not exists.`)}function Gz(t,e=!1){let i=e;return t.latestData instanceof ya&&(i=!1),i?I(t.latestData):t.latestData.slice()}const Wz=(t,e)=>0===t.length?[]:1===t.length?Gz(t[0],null==e?void 0:e.deep):t.map((t=>Gz(t,null==e?void 0:e.deep)));function Uz(t,e,i){Dz(e=e instanceof va?e:t.dataSet,"copyDataView",Wz);const s=new ya(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:Xz.copyDataView}),s}function Yz(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:$y)(`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:$y)(`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([]),Xy("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 Kz(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var Xz;!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"}(Xz||(Xz={}));const $z=(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 uO(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:tH(this._option.mode),autoFit:!1,eventConfig:{gesture:tb(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())}clear(t,e=!1){const{chart:i}=t;i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=P_.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this._nextRafId&&(P_.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null),this._isRunning||(this.initView(),this._view&&(this._isRunning=!0,null===(e=this._view)||void 0===e||e.run(t),this._isRunning=!1,this._nextRafId&&(P_.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,this._isRunning=!0,null===(i=this._view)||void 0===i||i.run(t),this._isRunning=!1))))}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.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 Qy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function iH(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:$y)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function sH(t){t.crosshair=Y(t.crosshair||{}).map((e=>Tj({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function nH(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&&Qy(e.mode)){let t;t=_(h)?null===document||void 0===document?void 0:document.getElementById(h):h;const{width:e,height:s}=ii(t,i.width,i.height);a=e,o=s}else if(eb(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 rH(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")}),t}function aH(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"}(Jz||(Jz={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(Qz||(Qz={}));class oH{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({},oH.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]))))}}oH.defaultMarkInfo={};class lH{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new oH,this._markReverse=new oH,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement(Jz.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement(Jz.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement(Jz.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement(Jz.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement(Jz.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(Jz.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[Jz.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[Jz.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(Pz.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 hH={};Object.values(Jz).forEach((t=>{hH[t]=!0}));const cH={[Jz.STATE_HOVER]:Jz.STATE_HOVER_REVERSE,[Jz.STATE_SELECTED]:Jz.STATE_SELECTED_REVERSE,[Jz.STATE_DIMENSION_HOVER]:Jz.STATE_DIMENSION_HOVER_REVERSE};function dH(t){return cH[t]}class uH{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=dH(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=dH(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=dH(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=dH(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 pH{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 gH extends pH{constructor(){super(...arguments),this.id=sb(),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 mH extends gH{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,s){super(t),this.grammarType=Zz.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 fH extends pH{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 mH(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 vH extends fH{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 _H extends vH{constructor(){super(...arguments),this.id=sb(),this.stateKeyToSignalName=t=>`${hB}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===qz.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===qz.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?qz.none:qz.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?qz.exit:qz.appear}}}}class yH{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=>Tj({},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 bH extends pH{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=yH,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new oH,this._lastLayoutRect=null,this.id=sb(),this.userId=t.id,this._spec=t,this.effect={},this.event=new Rz(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=`${hB}_${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=hz.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 xH{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=XF($F(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:KF(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:KF(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:KF(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:KF(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:KF(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:KF(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=KF(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=KF(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]=KF(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 SH extends bH{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 xH(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 AH extends yH{_initTheme(t,e){return{spec:t,theme:this._theme}}}class kH extends SH{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=AH,this.modelType="region",this.specKey="region",this.type=kH.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.interaction=new uH,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 _H({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 lH(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 Qz)B(t.stateStyle[Qz[e]])||this.interaction.registerMark(Qz[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 MH(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 TH(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 wH(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 CH(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),wH(c,!0,u,o),s&&TH(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function EH(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),wH(c,!1,u,a),s&&TH(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function BH(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}=MH(t);s.length&&CH(s,e,i,!1,"left"),n.length&&CH(n,e,i,!0,"left"),r.length&&EH(r,e,0,"left")}(e,this,a),s.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=MH(t);s.length&&PH(s,e,i,!1,"top"),n.length&&PH(n,e,i,!0,"top"),r.length&&BH(r,e,0,"top")}(s,this,r),i.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=MH(t);s.length&&CH(s,e,i,!1,"right"),n.length&&CH(n,e,i,!0,"right"),r.length&&EH(r,e,0,"right")}(i,this,a),n.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=MH(t);s.length&&PH(s,e,i,!1,"bottom"),n.length&&PH(n,e,i,!0,"bottom"),r.length&&BH(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:$y)("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}}}RH.type="base";const LH=["line","area","trail"];function OH(t){return LH.includes(t)}class IH extends vH{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(OH)?s:!t.mark||OH(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=>!!hH[t])).map((t=>[t,10])),s=!t.mark||OH(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(hB)));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(hB)));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(Dw(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 DH extends gH{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=Zz.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 FH extends DH{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${hB}_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 jH extends gH{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=Zz.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 IH(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 Rz(s.getOption().eventDispatcher,s.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new FH(t)}stateKeyToSignalName(t){return`${hB}_${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=Jz.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=Jz.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===qz.appear&&this.runAnimationByState(qz.normal)})):this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,(()=>{this.runAnimationByState(qz.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),this._morph&&this._morphKey&&(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 zH extends jH{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].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))}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&&Tj(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(Fw(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=NF(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()):FD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Fw(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=LF(RF(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({},VD[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)FD.includes(null===(o=n.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(n.stroke)(t,e));else{const e=LF(RF(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 HH extends zH{constructor(){super(...arguments),this.type=HH.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)?(Xy("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?(Xy("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})}))}}HH.type="group";const VH=()=>{fM(),iM(),kR.registerGraphic(RB.group,ku),hz.registerMark(HH.type,HH)},NH={type:"clipIn"},GH={type:"fadeIn"};function WH(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 GH;default:return NH}}const UH={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"}},YH={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},KH={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},XH=()=>{hz.registerAnimation("scaleInOut",(()=>YH))},$H=()=>{hz.registerAnimation("fadeInOut",(()=>KH))},qH=(t,e)=>({appear:WH(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:Hc,duration:UH.update.duration,easing:UH.update.easing}],disappear:{type:"clipOut"}}),ZH=()=>{hz.registerAnimation("line",qH)},JH=()=>{uO.useRegisters([UI,YI,KI,XI,$I,qI,II,DI])},QH={measureText:(t,e,i,s)=>((t,e,i)=>GM(t,e,i,{fontFamily:vj.fontFamily,fontSize:vj.fontSize}))(e,i,s).measure(t)};class tV{static instance(){return tV.instance_||(tV.instance_=new tV),tV.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 eV{constructor(){this.id=sb(),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))?Xy("不要重复添加相同的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 iV extends eV{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 sV{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>hz.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>hz.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>hz.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return hz.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>hz.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){hz.registerTransform(t,e)}static registerFunction(t,e){t&&e&&tV.instance().registerFunction(t,e)}static unregisterFunction(t){t&&tV.instance().unregisterFunction(t)}static getFunction(t){return t?tV.instance().getFunction(t):null}static getFunctionList(){return tV.instance().getFunctionNameList()}static registerMap(t,e,i){const s=hz.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=hz.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,jz.get(e);var e}static hideTooltip(t=[]){Gj.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,c;this.id=sb(),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 d=this._option,{dom:u,renderCanvas:p,mode:g,stage:m,poptip:f}=d,v=e(d,["dom","renderCanvas","mode","stage","poptip"]),y=Qy(g);y&&u&&(this._container=_(u)?null===document||void 0===document?void 0:document.getElementById(u):u),p&&(this._canvas=p),m&&(this._stage=m),"node"===g||this._container||this._canvas||this._stage?(y?Cx(ql):"node"===g&&TA(ql),this._viewBox=this._option.viewBox,this._currentThemeName=Wj.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new eH({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:p},Object.assign(Object.assign({mode:this._option.mode,stage:m,pluginList:!1!==f?["poptipForText"]:[]},v),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new Iz(this,this._compiler),this._event=new Rz(this._eventDispatcher,g),this._compiler.initView(),null===(o=this.getStage())||void 0===o||o.setTheme({text:{fontFamily:null===(l=this._currentTheme)||void 0===l?void 0:l.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!y&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),Gj.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=Tj({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=Yj(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;sV.getFunctionList()&&sV.getFunctionList().length&&(t=Kj(t,sV)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=hz.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=hz.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=hz.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 nH(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:cB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:dB})}_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,Fz(this._dataSet,"dataview",ga),Fz(this._dataSet,"array",s),Dz(this._dataSet,"stackSplit",$z),Dz(this._dataSet,"copyDataView",Wz);for(const t in hz.transforms)Dz(this._dataSet,t,hz.transforms[t]);for(const t in hz.dataParser)Fz(this._dataSet,t,hz.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),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;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,null===(s=this._compiler)||void 0===s||s.releaseGrammar(!1===(null===(n=this._option)||void 0===n?void 0:n.animation)||!1===(null===(r=this._spec)||void 0===r?void 0:r.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.reCompile&&(null===(a=this._compiler)||void 0===a||a.clear({chart:this._chart,vChart:this},!this._option.animation||!this._spec.animation),null===(o=this._compiler)||void 0===o||o.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(){var t,e;this._option.animation&&(null===(t=this._chart)||void 0===t||t.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(qz.update,!0)})),null===(e=this._chart)||void 0===e||e.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(qz.update,!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,Gj.unregisterInstance(this)}updateData(t,e,s){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s)}))}_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){return u(this._dataSet)?this:this._chart?(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){if(this._chart)return this._chart.updateFullData(t),e&&this._compiler.render(),this;const i=Y(this._spec.data);return Y(t).forEach((t=>{var e;const{id:s,values:n,parser:r,fields:a}=t,o=i.find((t=>t.name===s));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 s=Yz(t,this._dataSet,i,{onError:null===(e=this._option)||void 0===e?void 0:e.onError});y(this._spec.data)&&this._spec.data.push(s)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i){const s=this._updateSpec(t,e);return s?(this.updateCustomConfigAndRerender(s,!0,{morphConfig:i,transformSpec:s.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){var i,s;const n=this._spec;if(!this._setNewSpec(t,e))return;G(n.theme,this._spec.theme)||this._setCurrentTheme();const r=this._shouldChartResize(n);return null===(s=null===(i=this._compiler)||void 0===i?void 0:i.getVGrammarView())||void 0===s||s.updateLayoutTag(),this._spec.type!==n.type?{reTransformSpec:!0,change:!0,reMake:!0,reCompile:!1,reSize:r}:(this._initChartSpec(this._spec,"render"),rH(this._chart.updateSpec(this._spec),{reTransformSpec:!1,change:r,reMake:!1,reCompile:!1,reSize:r}))}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)||wj(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)||wj(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=Tj({},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=Uj(this._currentThemeName,!0);else if(_(s)&&(!n||_(n))||_(n)&&(!s||_(s))){const t=Cj({},Uj(this._currentThemeName,!0),Uj(s,!0),Uj(n,!0));this._currentTheme=t}else{const t=Cj({},Uj(this._currentThemeName),Uj(s),Uj(n));this._currentTheme=Rj(t)}var r;r=R(this._currentTheme,"component.poptip"),z(eT.poptip,tT,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=!!Qy(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?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return Uj(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){if(!Wj.themeExist(t))return this;const e=this._setCurrentTheme(t);return yield this.updateCustomConfigAndRerender(e,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){if(!Wj.themeExist(t))return this;const e=this._setCurrentTheme(t);return this.updateCustomConfigAndRerender(e,!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}}_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 iH(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(!Qy(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)?null===document||void 0===document?void 0:document.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?qF(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 Xy("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?qF(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Xy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return tV.instance().getFunction(t)}registerFunction(t,e){t&&e&&tV.instance().registerFunction(t,e)}unregisterFunction(t){t&&tV.instance().unregisterFunction(t)}getFunctionList(){return tV.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}_initChartPlugin(){const t=hz.getChartPlugins();t.length>0&&(this._chartPlugin=new iV(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}}}sV.InstanceManager=Gj,sV.ThemeManager=Wj,sV.globalConfig={uniqueTooltip:!0},sV.Utils=QH,sV.vglobal=P_;hz.registerRegion("region",kH),hz.registerLayout("base",RH),VH(),uO.useRegisters([tI,eI]),uO.useRegisters([sD,nD,FI,jI,eD,iD,rD,aD,oD]),UR(),WR(),jj(yj.name,yj),at.getInstance(rt.Error);const nV=(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(oB).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=hz.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=hz.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},rV=(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=nV(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):bj(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const m=Tj({},i),f=d(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:Tj(m,f),hasChanged:!0};const i=Tj({},t,f);xj(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 aV{constructor(t){this.id=sb(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}const oV=t=>{hz.registerChartPlugin(t.type,t)};class lV extends aV{constructor(){super(lV.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[lV.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[lV.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=Sj(this._option.globalInstance.getSpec(),["data",lV.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=Sj(this._baseChartSpec,["data",lV.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=rV(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=Sj(i,["data",lV.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()}}lV.pluginType="chart",lV.specKey="media",lV.type="MediaQueryPlugin";const hV=/\{([^}]+)\}/,cV=/\{([^}]+)\}/g,dV=/:/;class uV extends aV{constructor(){super(uV.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[uV.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)),hz.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=hV.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(cV,((t,i)=>{if(!dV.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}}uV.pluginType="chart",uV.specKey="formatter",uV.type="formatterPlugin";const pV=()=>{oV(uV)};function gV(t){return 2===t.length&&k(t[0])&&k(t[1])&&t[1]>=t[0]}function mV(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 fV(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 vV(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 _V(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 yV(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 bV=(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 RC(v)};class xV extends aV{constructor(){super(xV.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!Dw(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&&gV(c)&&gV(d)))return;const u=mV(t,c),p=mV(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(!vV(u,p))return}else if(0===y&&0===b){if(!vV(p,u))return}else if(_||A)if(_&&!A){if(!fV(u,p))return}else if(A&&!_){if(!fV(p,u))return}else{if(m===b)return;if(m>b){if(!_V(u,p))return}else if(!_V(p,u))return}else{if(0===m&&0===y){if(!yV(u,p))return}else if(0===b&&0===g&&!yV(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){Dz(e.getOption().dataSet,"tickAlign",bV);const t={targetAxis:()=>s,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}xV.pluginType="component",xV.type="AxisSyncPlugin";const SV=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,AV=(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},mm||(mm=pm.CreateGraphic("richtext",{})),mm.setAttributes(a),mm.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}},kV="vchart-tooltip-container",MV={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}};function TV(t,e){return R(e,`component.${t}`)}function wV(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=hz.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const CV={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function EV(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 PV(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 BV(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function RV(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}const LV=(t,e,i)=>{var s;const n=null!==(s="band"===e?TV("axisBand",i):["linear","log","symlog"].includes(e)?TV("axisLinear",i):{})&&void 0!==s?s:{},r=mz(t)?TV("axisX",i):fz(t)?TV("axisY",i):TV("axisZ",i);return Tj({},TV("axis",i),n,r)},OV=(t,e,i)=>{var s;const n=null!==(s="band"===e?TV("axisBand",i):"linear"===e?TV("axisLinear",i):{})&&void 0!==s?s:{},r=TV("angle"===t?"axisAngle":"axisRadius",i);return Tj({},TV("axis",i),n,r)},IV=t=>"band"===t||"ordinal"===t||"point"===t;function DV(t,e){return{id:t,label:t,value:e,rawValue:t}}function FV(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 jV(t,e,i,s){let n=0,r=t.length-1;for(;n<=r;){const a=Math.floor((n+r)/2),o=t[a];if(o[i]<=e&&o[s||i]>=e)return o;o[i]>e?r=a-1:n=a+1}return null}const zV=(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(jw(a.type))A=a.bandwidth(),0===A&&a.step&&(M=a.step());else if(Dw(a.type)){const s=e.fieldX[0],r=e.fieldX2,a=jV(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=EV(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(jw(r.type))k=r.bandwidth(),0===k&&r.step&&(T=r.step());else if(Dw(r.type)){const s=e.fieldY[0],r=e.fieldY2,a=jV(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=EV(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(VV(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&&HV(t,"top",r.label),e.visible&&HV(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(VV(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&&HV(t,"left",a.label),e.visible&&HV(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}},HV=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=wV(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},VV=(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)}))}))},NV=(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=WV(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},GV=(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=WV(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},WV=(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},UV=(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},YV={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"]},KV=(t,e)=>{var i,s;return null!==(s=null===(i=YV[t])||void 0===i?void 0:i[0])&&void 0!==s?s:e},XV=(t,e)=>{var i,s;return null!==(s=null===(i=YV[t])||void 0===i?void 0:i[1])&&void 0!==s?s:e},$V=(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}=zV(3,e,i,s,n,r,a);return o?NV(r,o,d,h):l?GV(a,l,u,c):void 0},qV={fontFamily:vj.fontFamily,spacing:10,wordBreak:"break-word"};function ZV(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:qV),{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 JV=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},QV=(t,e)=>p(e)?t.map((t=>e[t])):void 0,tN=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),eN=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function iN(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=sN(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=>tN(i,s)(t)&&tN(n,r)(t)&&(u(a)||tN([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 sV.globalConfig.uniqueTooltip&&sV.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 sV.globalConfig.uniqueTooltip&&sV.hideTooltip(u.id),d}return"none"}const sN=(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=QV(c,t);let _=QV(d,t);const y=eN(_),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(tN(c,v));if(!y&&(_=QV(d,i),!eN(_)))return;const n=e.type===oB.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=jw(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(tN(c,n));f.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=QV(d,o),!eN(_))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(tN(c,n));if(!y&&(_=QV(d,r),!eN(_)))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===oB.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(tN(c,v))).find((t=>t[g]===m));f.forEach((n=>{if(_=QV(d,i),!eN(_))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},nN=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 rN=(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 aN{constructor(){this.activeTriggerSet={mark:new Set,dimension:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set,dimension:new Set,group:new Set}}}class oN extends aN{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:hN(e.title,{seriesId:this.series.id},!0),content:cN(e.content,{seriesId:this.series.id},!0)}))})),this.spec=a,this.activeType=nN(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 lN=(t,e,i)=>{const s=d(e)?e(t):e;return i?Object.assign(Object.assign({},t),s):Object.assign(Object.assign({},s),t)},hN=(t,e,i)=>p(t)?d(t)?(...s)=>lN(t(...s),e,i):lN(t,e,i):void 0,cN=(t,e,i)=>{const s=p(t)?Y(t).map((t=>d(t)?(...s)=>Y(t(...s)).map((t=>lN(t,e,i))):lN(t,e,i))):void 0;return s},dN=(t,e,i)=>{var s;let n={};switch(t){case"mark":case"group":e&&(n=null!==(s=rN(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=rN(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},uN=(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=pN(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)&&nN(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},pN=ft((t=>t.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(p))),[]))),gN=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},mN=(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}=wV(void 0,s,t,e);i&&r&&(n=i(...r))}return n},vN=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;class _N{}_N.dom=`${hB}_TOOLTIP_HANDLER_DOM`,_N.canvas=`${hB}_TOOLTIP_HANDLER_CANVAS`;const yN=20,bN={key:"其他",value:"..."},xN=(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)},SN=(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=vN(t.title,e,i),{visible:h,value:c,valueTimeFormat:p,valueTimeFormatMode:g,valueStyle:m,hasShape:f,valueFormatter:v}=null!=l?l:{},_=!1!==fN(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:xN(fN(c,t,i,v),p,g),valueStyle:fN(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=yN}=t,x=t.othersLine?Object.assign(Object.assign({},bN),t.othersLine):bN,S=t=>{if(null==t?void 0:t.length)for(const e of t)for(const t of null!=y?y:[]){const s=AN(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=AN(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},AN=(t,e,i)=>{const s=xN(fN(e.key,t,i,e.keyFormatter),e.keyTimeFormat,e.keyTimeFormatMode),n=xN(fN(e.value,t,i,e.valueFormatter),e.valueTimeFormat,e.valueTimeFormatMode),r=!1!==fN(e.visible,t,i)&&(p(s)||p(n)),a=fN(e.isKeyAdaptive,t,i),o=fN(e.spaceRow,t,i),l=fN(e.shapeType,t,i),h=fN(e.shapeColor,t,i),c=fN(e.shapeFill,t,i),d=fN(e.shapeStroke,t,i),u=fN(e.shapeLineWidth,t,i),g=fN(e.shapeHollow,t,i),m=fN(e.keyStyle,t,i),f=fN(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 kN extends aV{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=vN(x.position,b,e),M=null!==(n=vN(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:cB,R=null!==(o=null==P?void 0:P.height)&&void 0!==o?o:dB;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(Qy(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=SV(t,e),j=SV(T,D)}}else O.width=B,O.height=R;const z=j/F;let H,V,N,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=$V(e.dimensionInfo,rB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.x,a=t.end.x)}else W=t;if(L)switch(KV(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=$V(e.dimensionInfo,rB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.y,a=t.end.y)}else U=t;if(L)switch(XV(t)){case"top":V=r-C*z-_;break;case"bottom":V=a+_;break;case"center":V=(r+a)/2-C*z/2;break;case"centerTop":V=(r+a)/2-C*z-_;break;case"centerBottom":V=(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=UV(t,c),V=UV(i,c),N=UV(e,c),G=UV(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=UV(t,c):Y(t),S(e)||d(e)?V=UV(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(N))$=B-w*z-N;else{const t=Z;switch(KV(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(V))q=V;else if(k(G))q=R-C*z-G;else{const t=J;switch(XV(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,Qy(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"===KV(A,"right")?$+=v+w/2:$+=2*v+w)},at=()=>{et()&&($=-D.x/j)},ot=()=>{it()&&(L?$=(Q-D.x)/j-w:"center"===KV(A,"right")?$-=v+w/2:$-=2*v+w)},lt=()=>{it()&&($=(Q-D.x)/j-w)},ht=()=>{st()&&(L?q=-D.y/j:"center"===XV(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"===XV(A,"bottom")?q-=_+C/2:q-=2*_+C)},ut=()=>{nt()&&(q=(tt-D.y)/j-C)};switch(KV(A,"right")){case"center":case"centerLeft":case"centerRight":et()?(rt(),lt()):(ot(),at());break;case"left":rt(),lt();break;case"right":ot(),at()}switch(XV(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({},MV),{offsetX:null!==(t=null==i?void 0:i.x)&&void 0!==t?t:MV.offsetX,offsetY:null!==(e=null==i?void 0:i.y)&&void 0!==e?e:MV.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=$F(d.padding),S=ZV(Object.assign({textAlign:"right"===y?"right":"left"},u),i),A=ZV(Object.assign({textAlign:"right"===y?"right":"left"},m),i),k=ZV(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:JV(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=Tj({},A,ZV(b,void 0,{})),{width:s,height:n,text:r}=AV(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=Tj({},k,ZV(x,void 0,{})),{width:e,height:s,text:n}=AV(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(N){Y=Tj({},S,ZV(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}=AV(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,V=H+(O?T.title.spaceRow:0)}return P+=V,B+=V,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(Qy(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=SV(t,s),u=SV(l,c)}return s*=d,n*=d,Qy(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()}}kN.specKey="tooltip";const MN=(t,e)=>p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",TN=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 wN;const CN=(t=document.body)=>{if(u(wN)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),wN=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return wN};function EN(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}=Tj({},e,t),s={};return s.width=MN(i),s}(C),R=PN(E),L=PN(P),{bottom:O,left:I,right:D,top:F}=$F(h),j="right"===m?"marginLeft":"marginRight";return{align:m,panel:{width:MN(T+2*M),minHeight:MN(g+2*M),paddingBottom:MN(O),paddingLeft:MN(I),paddingRight:MN(D),paddingTop:MN(F),borderColor:k,borderWidth:MN(M),borderRadius:MN(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)?MN(null==r?void 0:r.spaceRow):"0px"},PN(Tj({},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 BN.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=BN.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==Jy?void 0:Jy.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(BN.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}}BN.type="tooltipModel";const RN={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},LN={boxSizing:"border-box"},ON={display:"inline-block",verticalAlign:"top"},IN={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},DN={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},FN={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},jN={lineHeight:"normal",boxSizing:"border-box"};class zN extends BN{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=TN(u),y=t=>new yg({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 HN extends BN{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 VN={overflowWrap:"normal",wordWrap:"normal"};class NN extends BN{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(Tj({},ON,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=Tj({},o?DN:IN,Object.assign(Object.assign(Object.assign({height:MN(l)},VN),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 Tj({},FN,Object.assign(Object.assign(Object.assign({height:MN(s)},VN),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 Tj({},jN,Object.assign(Object.assign({height:MN(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 GN extends BN{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 NN(this.product,this._option,t,e);return i.init(),this.children[i.childIndex]=i,i}setStyle(t){super.setStyle(Tj(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+TN(e)),0);return Object.assign(Object.assign({},t),{width:`${a+CN(this._option.getContainer())}px`,maxHeight:MN(s),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class WN extends BN{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 zN(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 HN(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(Tj({},RN,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 UN="99999999999999";class YN extends BN{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:UN,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 WN(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 GN(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(Tj({},LN,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 KN=t=>{hz.registerComponentPlugin(t.type,t)};class XN extends kN{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(XN.type),this.type=_N.dom,this._tooltipContainer=null==Jy?void 0:Jy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(Jy&&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=EN(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()}))}}XN.type=_N.dom;class $N extends kN{constructor(){super($N.type),this.type=_N.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 XP({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()}}$N.type=_N.canvas;const qN=()=>{KN($N)},ZN=(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},JN={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}},QN=(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=Xj([],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 tG(a,n,o)},tG=(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)=>{nb(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=>{nb(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]=JN[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},eG=(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=>{nb(t[e])||(t[e]=0)}))})),t};class iG extends DH{_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 sG=`${hB}_HIERARCHY_DEPTH`,nG=`${hB}_HIERARCHY_ROOT`,rG=`${hB}_HIERARCHY_ROOT_INDEX`;function aG(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function oG(t,e,i){t&&(i.needDefaultSeriesField&&(t[bD]=i.defaultSeriesField),t[_D]=e,t[yD]=i.getKey(t,e,i))}function lG(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function hG(t,e,i,s=0,n,r){void 0===r&&(r=e),oG(t,e,i),t[sG]=s,t[nG]=n||t[i.categoryField],t[rG]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>hG(e,s,i,t[sG]+1,t[nG],r)))}const cG=["appear","enter","update","exit","disappear","normal"];function dG(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 fG(n)&&delete n.type,n.oneByOne&&(n=pG(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:gG,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=Tj({},o[e],a);return fG(n)&&delete n.type,n.oneByOne&&(n=pG(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:gG,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s.state=s.update,s}function uG(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),vG(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 pG(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 gG(t,e){var i,s;return null!==(i=null==t?void 0:t[_D])&&void 0!==i?i:null===(s=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===s?void 0:s.elementIndex}function mG(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 fG(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function vG(t,e){if(y(t))t.forEach(((i,s)=>{t[s]=e(t[s],s),vG(t[s],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),vG(t[i],e)}class _G extends yH{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=EF(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=Pj(R(a,`series.${h}`),h,l,o),d=R(a,`series.${h}_${r}`);return Tj({},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),c(t.stackOffsetSilhouette)&&(this.stack=t.stackOffsetSilhouette||this.stack),p(t.stackValue)&&(this.stack=!0),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=Tj({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>Tj({},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 yG extends bH{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:`${hB}_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=_G,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=function(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)}(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)&&(Dz(this._rawData.dataSet,"invalidTravel",eG),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=Yz(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=Uz(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=Uz(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new iG(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;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){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];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):this._rawStatisticsCache[t]=tG(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t]}}return e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))&&(this._rawStatisticsCache[t].min=$(this._rawStatisticsCache[t].values),this._rawStatisticsCache[t].max=X(this._rawStatisticsCache[t].values)),this._rawStatisticsCache[t]}_statisticViewData(){Dz(this._dataSet,"dimensionStatistics",QN);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&&Xj(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){Dz(this._dataSet,"dimensionStatistics",QN);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=Xj(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&Xj(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)&&(Dz(this._rawData.dataSet,"addVChartProperty",ZN),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:aG.bind(this),call:oG}},!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=dG({},uG(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"}}:tb(s)||eb(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=Tj(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=Tj(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:Jz.STATE_HOVER_REVERSE,highlightState:Jz.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:Jz.STATE_SELECTED_REVERSE,state:Jz.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 t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:bD;this.getMarksWithoutRoot().forEach((t=>{const s={},n={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(s[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{n[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:xD,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][i]]:!0===s[t[i]]});const a={};Object.keys(n).forEach((e=>{a[e]=s=>{var n,a;let o;if(Array.isArray(s)){if(0===s.length)return;o=null===(n=r[s[0][i]])||void 0===n?void 0:n[e]}return o=null===(a=r[s[i]])||void 0===a?void 0:a[e],o||t.getAttribute(e,s)}})),this.setMarkStyle(t,a,xD)}))}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 oN(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=null!=i?i:{data:!0}).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((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||Kz(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()}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:bD,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new HF).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return RF(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:bD}}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()}`),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,Tj({},h,d||a[T.name]))}return T}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:yD}_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!==MD&&t!==wD&&t!==kD&&t!==TD||(t=this.getStackValueField()),null!==(e=qj(this.getRawData(),t))&&void 0!==e?e:t}getMarkInfoList(){var t;const e=super.getMarkInfoList();return e.length?e:Object.values(null!==(t=CF[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=>nb(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:bD]}}function bG(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();Dw(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 xG(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}}}yG.mark=ND,yG.transformerConstructor=_G;class SG extends yG{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);Dw(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:`${hB}_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(MD),this.setFieldX2(kD)):(this.setFieldY(MD),this.setFieldY2(kD))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(wD),this.setFieldX2(TD)):(this.setFieldY(wD),this.setFieldY2(TD))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(ED),this.setFieldX2(CD)):(this.setFieldY(ED),this.setFieldY2(CD))}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)&&(bG("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 AG="monotone",kG="linear";class MG{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($D.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:kG,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===AG?"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($D.point,{morph:mG(this._spec,$D.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:`${hB}_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(Pz.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:Jz.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[$D.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(Pz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,Tj({},this._spec[$D.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:Jz.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 TG extends zH{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)&&(Fw(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);let c=this._styleConvert(h);a&&"angle"===l&&(c=this.convertAngleToRadian(c)),this.setAttribute(l,c,e,i,s)})),o&&this.setEnableSegments(o)}}class wG extends TG{constructor(){super(...arguments),this.type=wG.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)===oB.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}wG.type="line";const CG=()=>{hz.registerMark(wG.type,wG),fM(),aM(),kR.registerGraphic(RB.line,Ag),JH()};class EG extends zH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class PG extends EG{constructor(){super(...arguments),this.type=PG.type}}PG.type="symbol";const BG=()=>{hz.registerMark(PG.type,PG),fO()};class RG extends _G{_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 LG extends eV{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function OG(t,e,i,s){switch(t){case r.cartesianBandAxis:return LV(_z(i,["z"]),"band",e);case r.cartesianLinearAxis:return LV(_z(i,["z"]),"linear",e);case r.cartesianLogAxis:return LV(_z(i,["z"]),"log",e);case r.cartesianSymlogAxis:return LV(_z(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return LV(_z(i),void 0,e);case r.polarBandAxis:return OV(i.orient,"band",e);case r.polarLinearAxis:return OV(i.orient,"linear",e);case r.polarAxis:return OV(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=TV(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>mz(t.orient)));let d;d=p(c)?Tj({},IV(c.type)?a:o,l):l;const u=n.find((t=>fz(t.orient)));let g;return g=p(u)?Tj({},jw(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=TV(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>"angle"===t.orient));let d;d=p(c)?Tj({},IV(c.type)?a:o,l):l;const u=n.find((t=>"radius"===t.orient));let g;return g=p(u)?Tj({},jw(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 IG(i,TV(t,e));default:return TV(t,e)}}const IG=(t,e)=>{var i;const s=Tj({},e,e[yz(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class DG extends yH{getTheme(t,e){return OG(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({},$F(e)),{[s]:0}))}}class FG extends SH{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 LG(this)}constructor(e,i){super(e,i),this.name="component",this.modelType="component",this.transformerConstructor=DG,this._delegateEvent=(e,i,s,n=null,r=null)=>{var a,o;i instanceof ec||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 _H({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}}}FG.transformerConstructor=DG;class jG extends zH{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(RB.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}jG.type="component";const zG=()=>{hz.registerMark(jG.type,jG)},HG=t=>t;class VG extends FG{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()?DB.circleAxisGrid:DB.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=dG(null===(o=hz.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 DH(this._option,t)]}collectData(t,e){const i=[];return sB(this._regions,(s=>{var n;let r=this.collectSeriesField(t,s);if(r=y(r)?Dw(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 sB(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=nB(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()})),sB(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(sB(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;tthis._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=az(s=t.domainLine)).startSymbol=az(s.startSymbol),s.endSymbol=az(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 lz(Tj({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:lz(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)=>lz(t[i](e.rawValue,s,e,n,r)):B(t[i])||(e[i]=lz(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 lz(Tj({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:lz(t.tick.style)),t.tick.state&&(i.tick.state=oz(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 lz(Tj({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:lz(t.subTick.style)),t.subTick.state&&(i.subTick.state=oz(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=CV[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?te(p):null,textStyle:Tj({},d,lz(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:lz(h.style)}),h.state&&(i.title.state.shape=oz(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:lz(o.style)}),o.state&&(i.title.state.background=oz(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=oz(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=lz(t.background.style)),t.background.state&&(i.panel.state=oz(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 lz(Tj({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:lz(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:lz(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=wV(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){Fz(this._option.dataSet,"scale",HG),Dz(this._option.dataSet,"ticks",UC);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)}}VG.specKey="axes";const NG=()=>{kR.registerGraphicComponent(IB.lineAxis,((t,e)=>new Cw(t,e))),kR.registerGraphicComponent(IB.circleAxis,(t=>new Rw(t))),kR.registerComponent(LB.axis,FO),kR.registerGraphicComponent(DB.lineAxisGrid,((t,e)=>new qC(t,e))),kR.registerGraphicComponent(DB.circleAxisGrid,((t,e)=>new JC(t,e))),kR.registerComponent(LB.grid,HO),zG(),hz.registerAnimation("axis",(()=>({appear:{custom:Ow},update:{custom:Lw},exit:{custom:Wc}})))},GG=[xV];class WG extends VG{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),sB(this._regions,(t=>{const e=this.getOrient();mz(e)?t.setXAxisHelper(this.axisHelper()):fz(e)?t.setYAxisHelper(this.axisHelper()):vz(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=Tj({x:t.x,y:t.y},this._axisStyle,n);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(Tj({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=mz(this.getOrient()),n=t=>{var e;return(s?!mz(t.getOrient()):mz(t.getOrient()))&&Dw(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=_z(i,["z"]),vz(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(!BV(e))return null;const{axisType:t,componentName:s}=bz(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=>fz(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(!BV(t))return;const{axisType:s,componentName:n}=bz(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=hz.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=[];mz(this.getOrient())?k(e)&&(o=this._inverse?[e-n,s]:[s,e-n]):vz(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(GG.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){mz(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&&!mz(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),!vz(this.getOrient())&&this._spec.innerOffset){const t=this._spec;fz(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=KF(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=KF(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=mz(this.getOrient())?t.fieldX:vz(this.getOrient())?t.fieldZ:t.fieldY,Dw(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:Dw(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&&(mz(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=mz(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 sB(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]:mz(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:vz(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();sB(this._regions,(e=>{mz(t)?(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):fz(t)?(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):vz(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=mz(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=mz(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=Tj(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 DV(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}=PV(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>=UG?10:n>=YG?5:n>=KG?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 $G extends WG{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new TC}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}}$G.type=r.cartesianLinearAxis,$G.specKey="axes",U($G,XG);const qG=()=>{NG(),hz.registerComponent($G.type,$G)};class ZG{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=DV(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=>DV(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 JG extends WG{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new rC}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{NG(),hz.registerComponent(JG.type,JG)};class tW extends $G{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),sB(this._regions,(t=>{mz(this.getOrient())?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=Tj({},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 DH(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=>DV(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=>DV(e.value,this._getNormalizedValue([e.value],t))))),s}transformScaleDomain(){}}tW.type=r.cartesianTimeAxis,tW.specKey="axes";class eW extends $G{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new EC}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(){}}eW.type=r.cartesianLogAxis,eW.specKey="axes",U(eW,XG);class iW extends $G{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new PC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}transformScaleDomain(){}}iW.type=r.cartesianSymlogAxis,iW.specKey="axes",U(iW,XG);class sW extends SG{constructor(){super(...arguments),this.type=oB.line,this.transformerConstructor=RG,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(dG(null===(i=hz.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),uG("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=xG(this);this._symbolMark.setAnimationConfig(dG(null===(s=hz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),uG("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]}}sW.type=oB.line,sW.mark=qD,sW.transformerConstructor=RG,U(sW,MG);class nW{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)=>{Kz(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 rW{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)=>{rb(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{Xj(e,[{key:t,operations:Dw(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&&Xj(e,[{key:i.field,operations:Dw(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?NF("colorOrdinal"):NF(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(rb(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),rb(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(!rb(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=Dw(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=Dw(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;Dw(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(Dw(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=Dw(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)));Dw(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 aW{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=Zj(t,!0);for(const e in a)for(const i in a[e].nodes)ez(a[e].nodes[i],t.getStackInverse(),n);if(r)for(const t in a)for(const e in a[t].nodes)tz(a[t].nodes[e]);s&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&Qj(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 oW extends pH{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=sb(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:cB,height:dB},this._viewRect={width:cB,height:dB},this._viewBox={x1:0,y1:0,x2:cB,y2:dB},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=$F(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new Rz(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new nW(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._spec.background&&"object"==typeof this._spec.background&&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 aW(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=function(t){if(!t)return null;if("string"==typeof t)return{fill:t,fillOpacity:1};if("object"!=typeof t)return null;const e=H(t,["x","y","width","height","x1","y1","image"]);return e.background=t.image,e}(this._spec.background);t&&(this._backgroundMark=hz.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({},t),{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=hz.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 bH)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 zH))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof zH)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&&Kz(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=nH(this._spec,this._option,{width:cB,height:dB})),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=RF(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new rW(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){rH(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=RF(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{rH(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{var s,n;const r=i.specKey||i.type,a=null!==(s=this._spec[r])&&void 0!==s?s:{};y(a)?(e[r]=e[r]||{specCount:a.length,componentCount:0},e[r].componentCount++,rH(t,i.updateSpec(null!==(n=a[i.getSpecIndex()])&&void 0!==n?n:{},a))):rH(t,i.updateSpec(a))}));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()];rH(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=XF(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(Jz.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(Jz.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(Jz.STATE_SELECTED)}clearHovered(){this.clearState(Jz.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===Pz.dimensionHover||s===Pz.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>jw(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=>{r?i[t.series.fieldY[0]]=s:i[t.series.fieldX[0]]=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 lW=(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 hW{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);xj(t,r,l.spec),xj(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}));xj(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=lW(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=lW(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(hz.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(hz.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=hz.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=hz.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=hz.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 cW extends hW{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")&&Tj(i,aH(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 dW extends cW{_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),sH(t)}}class uW extends oW{constructor(){super(...arguments),this.transformerConstructor=dW,this.type="line",this.seriesType=oB.line,this._canStack=!0}}uW.type="line",uW.seriesType=oB.line,uW.transformerConstructor=dW;class pW extends TG{constructor(){super(...arguments),this.type=pW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}pW.type="area";const gW=()=>{hz.registerMark(pW.type,pW),fM(),qk(),kR.registerGraphic(RB.area,Ug),JH()};class mW extends oN{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 fW=()=>{hz.registerAnimation("area",qH),ZH(),XH()};class vW extends RG{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=Tj({},m.style,g.style),l.state=Tj({},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 _W extends SG{constructor(){super(...arguments),this.type=oB.area,this.transformerConstructor=vW,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(_W.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===AG?"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 GF(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 GF(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(dG(null===(e=hz.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),uG("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(dG(null===(i=hz.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),uG("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=xG(this);this._symbolMark.setAnimationConfig(dG(null===(s=hz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),uG("point",this._spec,this._markAttributeContext),t))}}initTooltip(){this._tooltipHelper=new mW(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}}}_W.type=oB.area,_W.mark=JD,_W.transformerConstructor=vW,U(_W,MG);class yW extends cW{_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),sH(t)}}class bW extends oW{constructor(){super(...arguments),this.transformerConstructor=yW,this.type="area",this.seriesType=oB.area,this._canStack=!0}}bW.type="area",bW.seriesType=oB.area,bW.transformerConstructor=yW;function xW(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 SW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:xW(t,e)}),AW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:xW(t,e)}),kW={type:"fadeIn"},MW={type:"growCenterIn"};function TW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return kW;case"scaleIn":return MW;default:return SW(t)}}class wW extends zH{constructor(){super(...arguments),this.type=wW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}wW.type="rect";const CW=()=>{hz.registerMark(wW.type,wW),gO(),uO.useRegisters([VI,NI,GI,WI,zI,HI])};function EW(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[GD]):this._spec.barMinHeight?this._calculateRectPosition(t,!1):GF(this._dataToPosX(t),e),this._getBarXEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[WD]):GF(this._dataToPosX1(t),e),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[UD]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):GF(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[YD]):GF(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({},RW.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{morph:mG(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(RW.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(Dz(this._option.dataSet,"addVChartProperty",ZN),s){const t=([t],{scaleDepth:e})=>{var i;let s=[{}];const n=this.getDimensionField(),r=u(e)?n.length:Math.min(n.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};Dz(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:aG.bind(this),call:oG}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new iG(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=YD,s=UD,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=WD,s=GD,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=Zj(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)EW(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=GF(this[n](t),o),d=GF(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[kD],n=t[MD],r=t[TD],h=t[wD];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]),{[kD]:i,[MD]:s}),a?{[TD]:o,[wD]:l}:void 0);t.push(Tg(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=>GF(this._dataToPosY(t),a),y1:t=>GF(this._dataToPosY1(t),a)}:{y:t=>GF(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=>GF(this._dataToPosX(t),r),x1:t=>GF(this._dataToPosX1(t),r)}:{x:t=>GF(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=xG(this);this._barMark.setAnimationConfig(dG(null===(e=hz.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),uG(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;if(void 0!==this._spec.barWidth&&r===n)return ZF(this._spec.barWidth,a);const o=void 0!==this._spec.barMinWidth,l=void 0!==this._spec.barMaxWidth;let h=a;return o&&(h=Math.max(h,ZF(this._spec.barMinWidth,a))),l&&(h=Math.min(h,ZF(this._spec.barMaxWidth,a))),h}_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=ZF(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=Dw(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}}RW.type=oB.bar,RW.mark=KD,RW.transformerConstructor=BW;const LW=()=>{iI(),CW(),hz.registerAnimation("bar",((t,e)=>({appear:TW(t,e),enter:SW(t,!1),exit:AW(t,!1),disappear:AW(t)}))),QG(),qG(),hz.registerSeries(RW.type,RW)};class OW extends cW{_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),sH(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 IW extends oW{constructor(){super(...arguments),this.transformerConstructor=OW,this.type="bar",this.seriesType=oB.bar,this._canStack=!0}}IW.type="bar",IW.seriesType=oB.bar,IW.transformerConstructor=OW;class DW extends zH{constructor(){super(...arguments),this.type=DW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}DW.type="rect3d";class FW extends RW{constructor(){super(...arguments),this.type=oB.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d"}}FW.type=oB.bar3d,FW.mark=XD;class jW extends OW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}class zW extends IW{constructor(){super(...arguments),this.transformerConstructor=jW,this.type="bar3d",this.seriesType=oB.bar3d}}zW.type="bar3d",zW.seriesType=oB.bar3d,zW.transformerConstructor=jW;const HW=[10,20],VW=Pw.Linear,NW="circle",GW=Pw.Ordinal,WW=["circle","square","triangle","diamond","star"],UW=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class YW extends _G{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class KW extends SG{constructor(){super(...arguments),this.type=oB.scatter,this.transformerConstructor=YW,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=`${hB}_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=`${hB}_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:VW,defaultRange:HW},"size")}getShapeAttribute(t,e){return u(e)?NW:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:GW,defaultRange:WW},"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(KW.mark.point,{morph:mG(this._spec,KW.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=xG(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(dG(null===(i=hz.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),uG("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:NW},Jz.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},Jz.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},Jz.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},Jz.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},Jz.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]}}KW.type=oB.scatter,KW.mark=ZD,KW.transformerConstructor=YW;const XW=()=>{BG(),hz.registerAnimation("scatter",((t,e)=>Object.assign({appear:UW(0,e)},YH))),QG(),qG(),hz.registerSeries(KW.type,KW)};class $W extends cW{_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 qW extends oW{constructor(){super(...arguments),this.transformerConstructor=$W,this.type="scatter",this.seriesType=oB.scatter,this._canStack=!0}}qW.type="scatter",qW.seriesType=oB.scatter,qW.transformerConstructor=$W;Ln();const ZW={},JW=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function QW(t,e){t&&_(t)||lb("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(ZW[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 JW.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}(i,e)),ZW[i]||null}const tU={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(tU).forEach((t=>{QW(t,tU[t])}));const eU="Feature",iU="FeatureCollection";function sU(t){const e=Y(t);return 1===e.length?e[0]:{type:iU,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===iU?t.features:Y(t).filter((t=>!u(t))).map((t=>t.type===eU?t:{type:eU,geometry:t}))}(e))),[])}}const nU=JW.concat(["pointRadius","fit","extent","size"]);function rU(t,e){let i=[];return t?(Object.keys(t).forEach((s=>{nU.includes(s)&&(i=i.concat(dR(t[s],e)))})),i):i}let aU=class extends $R{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(dR(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(dR(t,this.view)),this.commit(),this}size(t){return u(this.spec.size)||this.detach(dR(this.spec.size,this.view)),this.spec.size=t,this.attach(dR(t,this.view)),this.commit(),this}extent(t){return u(this.spec.extent)||this.detach(dR(this.spec.extent,this.view)),this.spec.extent=t,this.attach(dR(t,this.view)),this.commit(),this}fit(t){return u(this.spec.fit)||this.detach(dR(this.spec.fit,this.view)),this.spec.fit=t,this.attach(dR(t,this.view)),this.commit(),this}configure(t){return this.detach(rU(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(rU(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=QW((t||"mercator").toLowerCase());return e||lb("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),JW.forEach((t=>{u(this.spec[t])||function(t,e,i){d(t[e])&&t[e](i)}(this.projection,t,pR(this.spec[t],e,QW))})),u(this.spec.pointRadius)||this.projection.path.pointRadius(pR(this.spec.pointRadius,e,QW)),!(u(this.spec.fit)||u(this.spec.extent)&&u(this.spec.size))){const t=sU(pR(this.spec.fit,e,QW));this.spec.extent?this.projection.fitExtent(pR(this.spec.extent,e,QW),t):this.spec.size&&this.projection.fitSize(pR(this.spec.size,e,QW),t)}return this.projection}output(){return this.projection}};const oU=(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 lU extends yG{constructor(){super(...arguments),this.type=oB.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=`${hB}_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 hU=`${hB}_MAP_LOOK_UP_KEY`,cU=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[_D]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[hU]=e.nameMap[n]:t[hU]=n})),t.features);class dU extends oN{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 uU extends zH{constructor(){super(...arguments),this.type=uU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}uU.type="path";const pU=()=>{hz.registerMark(uU.type,uU),pO()};class gU{constructor(t){this.projection=QW(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 mU{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 fU{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 vU(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:mU}:tb(e)||eb(e)?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:fU}:null}const _U={debounce:xt,throttle:St};class yU{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=tb(this._renderMode)||eb(this._renderMode),vU(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return vU(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;u(n)||De({x:r,y:a},this._getRegionOrSeriesLayout(e),!1)&&(i&&i({zoomDelta:n,zoomX:r,zoomY:a},s),this._eventObj.emit("zoom",{scale:s.zoomDelta,scaleCenter:{x:s.zoomX,y:s.zoomY},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,_U[o]((t=>{this._zoomableTrigger.clearZoom()}),l)),h.on(...c,_U[o]((t=>{this._zoomEventDispatch(t,i,s)}),l))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||vU(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||vU(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,_U[o]((t=>{this._zoomableTrigger.clearScroll()}),l)),h.on(...c,_U[o]((t=>this._scrollEventDispatch(t,i,s)),l))}initScrollEventOfSeries(t,e,i){vU(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||vU(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||vU(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||vU(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=_U[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)}),l),_=_U[o]((t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1;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 bU(t,e){return`${hB}_${e}_${t}`}class xU extends FG{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:bU(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),e&&(e.zoomDelta=l),this.zoom(l,[t.zoomX,t.zoomY]),l},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=Tj(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},s=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,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 gU(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===oB.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),sB(this._regions,(t=>{var e;if(t.type===oB.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===oB.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[hU],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}}xU.type=r.geoCoordinate,U(xU,yU);const SU=()=>{hz.registerComponent(xU.type,xU)};class AU extends _G{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class kU extends lU{constructor(){super(...arguments),this.type=oB.map,this.transformerConstructor=AU,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 !`),jz.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),Dz(this._dataSet,"copyDataView",Wz),Dz(this._dataSet,"map",cU),Dz(this._dataSet,"lookup",oU);const i=jz.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:Xz.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:hU,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 iG(this._option,s)}initMark(){this._pathMark=this._createMark(kU.mark.area,{morph:mG(this._spec,kU.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:bD])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:bD]):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(dG(null===(t=hz.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),uG("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new dU(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[_D]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[_D],{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 _D}getActiveMarks(){return[this._pathMark]}}kU.type=oB.map,kU.mark=sF,kU.transformerConstructor=AU;const MU=()=>{kR.registerGrammar("projection",aU,"projections"),SU(),pU(),hz.registerSeries(kU.type,kU),hz.registerImplement("registerMap",Vz),hz.registerImplement("unregisterMap",Nz),$H()},TU=(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[RD]=!0:delete t[RD]})),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=wU([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}=CU(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=wU(a,t,n,r,h,l,i,e),r.push(n)})),r};function wU(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}=CU(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===pD)&&(t[pD]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function CU(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?Xy("total.collectCountField error"):n=e[a].start;o<0?Xy("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 EU=(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},PU={type:"fadeIn"},BU={type:"growCenterIn"};function RU(t,e){switch(e){case"fadeIn":return PU;case"scaleIn":return BU;default:return SW(t,!1)}}class LU extends zH{constructor(){super(...arguments),this.type=LU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}LU.type="rule";const OU=()=>{hz.registerMark(LU.type,LU),mO()},IU=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:DU(t.map((t=>t.latestData)).flat(),e.fields,i)}};function DU(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)=>DU(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class FU{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"}),Dz(e,"dimensionTree",IU),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 jU extends BW{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel")}}const zU={rect:WU,symbol:NU,arc:YU,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=NU(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1);return e},stackLabel:KU,line:XU,area:XU,rect3d:WU,arc3d:YU,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function HU(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}=wV(i,s,o.text,e);return h&&(o.text=h(...c,{series:a})),o}function VU(t){return d(t)?e=>t(e.data):t}function NU(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=VU(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:GU(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function GU(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function WU(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=VU(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:UU(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function UU(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 YU(t){var e;const{labelSpec:i}=t,s=null!==(e=VU(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 KU(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=HU(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),mp(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 XU(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 $U extends RW{constructor(){super(...arguments),this.type=oB.waterfall,this.transformerConstructor=jU,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 FU(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=pD)}getSeriesKeys(){return this._seriesField===pD?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),Dz(this._dataSet,"waterfallFillTotal",EU),Dz(this._dataSet,"waterfall",TU),(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=Uz(this.getViewData(),this._dataSet,{name:`${hB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new iG(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:kD,endAs:MD,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=xG(this);this._barMark.setAnimationConfig(dG(null===(i=hz.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),uG("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(dG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),uG("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($U.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){if(!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible))return super.initLabelMarkStyle(t),void(this._labelMark=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 KU(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?GF(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):GF(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))}}$U.type=oB.waterfall,$U.mark=uF,$U.transformerConstructor=jU;const qU=()=>{OU(),CW(),hz.registerAnimation("waterfall",((t,e)=>({appear:RU(t,e),enter:SW(t,!1),exit:AW(t,!1),disappear:AW(t,!1)}))),$H(),QG(),qG(),hz.registerSeries($U.type,$U)},ZU=`${hB}_BOX_PLOT_OUTLIER_VALUE`;var JU;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(JU||(JU={}));const QU=(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={[ZU]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class tY extends oN{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===JU.OUTLIER)return this.series.getOutliersField();if(t===JU.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case JU.MIN:return this.series.getMinField();case JU.MAX:return this.series.getMaxField();case JU.MEDIAN:return this.series.getMedianField();case JU.Q1:return this.series.getQ1Field();case JU.Q3:return this.series.getQ3Field();case JU.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===JU.OUTLIER)return e[ZU];if(t===JU.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case JU.MIN:return e[this.series.getMinField()];case JU.MAX:return e[this.series.getMaxField()];case JU.MEDIAN:return e[this.series.getMedianField()];case JU.Q1:return e[this.series.getQ1Field()];case JU.Q3:return e[this.series.getQ3Field()];case JU.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[ZU])}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.getContentKey(JU.OUTLIER),value:this.getContentValue(JU.OUTLIER),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(JU.MAX),value:this.getContentValue(JU.MAX),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(JU.Q3),value:this.getContentValue(JU.Q3),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(JU.MEDIAN),value:this.getContentValue(JU.MEDIAN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(JU.Q1),value:this.getContentValue(JU.Q1),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(JU.MIN),value:this.getContentValue(JU.MIN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(JU.SERIES_FIELD),value:this.getContentValue(JU.SERIES_FIELD),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]}}}class eY extends zH{constructor(){super(...arguments),this.type=eY.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}}eY.type="boxPlot";const iY=()=>{hz.registerMark(eY.type,eY),kR.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(SO).registerChannelEncoder("x",((t,e,i,s,n,r)=>r&&yb(r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,s,n,r)=>r&&yb(r.direction)?{shaft:{y:e,y1:e}}:null)).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&yb(r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&yb(r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&yb(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&&yb(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&&yb(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&&yb(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}}))),kR.registerAnimationType("boxplotScaleIn",AO),kR.registerAnimationType("boxplotScaleOut",kO),_O(),gO(),mO(),kR.registerGlyph("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(TO).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&yb(r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&yb(r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&yb(r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&yb(r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&yb(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}}))),kR.registerAnimationType("barBoxplotScaleIn",wO),kR.registerAnimationType("barBoxplotScaleOut",CO),_O(),gO(),mO()};class sY extends SG{constructor(){super(...arguments),this.type=oB.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(sY.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(sY.mark.outlier,{progressive:t,key:_D,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,Jz.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"},Jz.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=>GF(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>GF(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>GF(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>GF(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>GF(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},Jz.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=>GF(e(this.getDatumPositionValues(t,ZU),{bandPosition:this._bandPosition}),s)}:{x:this.dataToPositionX.bind(this),y:t=>GF(e(this.getDatumPositionValues(t,ZU),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,Jz.STATE_NORMAL,t.AttributeLevel.Series)}}initData(){if(super.initData(),!this._data)return;Dz(this._dataSet,"foldOutlierData",QU),Dz(this._dataSet,"addVChartProperty",ZN);const t=new ya(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${hB}_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:aG.bind(this),call:oG}},!1),this._outlierDataView=new iG(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=xG(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=hz.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(uG("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(dG(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(dG(null===(a=hz.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new tY(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]}}sY.type=oB.boxPlot,sY.mark=pF;class nY extends zH{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=nY.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})}}nY.type="text";const rY=()=>{hz.registerMark(nY.type,nY),vO(),fM(),gM(),kR.registerGraphic(RB.richtext,zg)};function aY(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 oY extends oN{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 lY=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),hY={type:"fadeIn"},cY=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function dY(t,e){return"fadeIn"===e?hY:lY(t)}class uY extends BW{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 pY extends RW{constructor(){super(...arguments),this.type=oB.rangeColumn,this._barMarkType="rect",this._barName=oB.bar,this.transformerConstructor=uY}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(pY.mark.bar,{morph:mG(this._spec,pY.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(pY.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(pY.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}});aY(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}});aY(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=xG(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(dG(null===(i=hz.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),uG("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(dG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),uG("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(dG(null===(n=hz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),uG("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new oY(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)}}pY.type=oB.rangeColumn,pY.mark=yF,pY.transformerConstructor=uY;const gY=()=>{CW(),rY(),hz.registerAnimation("rangeColumn",((t,e)=>({appear:dY(t,e),enter:lY(t),exit:cY(t),disappear:cY(t)}))),$H(),QG(),qG(),hz.registerSeries(pY.type,pY)};class mY extends pY{constructor(){super(...arguments),this.type=oB.rangeColumn3d,this._barMarkType="rect3d",this._barName=oB.bar3d}}mY.type=oB.rangeColumn3d,mY.mark=bF;class fY extends oN{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 vY extends _W{constructor(){super(...arguments),this.type=oB.rangeArea}initMark(){var t;const{customShape:e,stateSort:i}=null!==(t=this._spec.area)&&void 0!==t?t:{};this._areaMark=this._createMark(vY.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 fY(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))}}vY.type=oB.rangeArea,vY.mark=kF;class _Y extends yG{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=EB,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:[]};Dw(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:[]};Dw(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)&&bG(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 yY=(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[_B],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[_B]*t;g(e,b,i),b+=i}))}return 0!==m&&(i[i.length-1][l]=r),i};function bY(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const xY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:bY(t,!0,qz.appear)}),SY={type:"fadeIn"},AY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:bY(t,!0,qz.enter)}),kY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:bY(t,!0,qz.exit)}),MY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:bY(t,!0,qz.exit)});function TY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return SY;case"growRadius":return xY(Object.assign(Object.assign({},t),{growField:"radius"}));default:return xY(Object.assign(Object.assign({},t),{growField:"angle"}))}}class wY extends zH{constructor(t,e){super(t,e),this.type=CY.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[AB])[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 CY extends wY{constructor(){super(...arguments),this.type=CY.type}}CY.type="arc";const EY=()=>{fM(),Xk(),kR.registerGraphic(RB.arc,Xg),uO.useRegisters([QI,tD,ZI,JI]),hz.registerMark(CY.type,CY)};class PY extends _G{_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=Tj({},this._theme,i,t);const n=(t,e)=>Tj({},"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 BY extends _Y{constructor(){super(...arguments),this.transformerConstructor=PY,this._pieMarkName="pie",this._pieMarkType="arc",this._startAngle=TB,this._endAngle=wB,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this.dataToCentralPosition=t=>{const e=t[AB];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;Dz(this._dataSet,"pie",yY),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:bB,asEndAngle:xB,asRatio:yB,asMiddleAngle:AB,asRadian:MB,asQuadrant:kB,asK:SB}},!1);const e=new ya(this._dataSet,{name:`${hB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new iG(this._option,e)}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},BY.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{morph:mG(this._spec,this._pieMarkName),defaultMorphElementKey:this._seriesField,key:yD,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 aB(bB)(t)}endAngleScale(t){return aB(xB)(t)}initMarkStyle(){const e=this._pieMark;e&&this.setMarkStyle(e,{x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:WF(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:WF(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:aB(mB).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[AB];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===qz.appear)return this._startAngle;if(i===qz.disappear)return this._endAngle;const n=[qz.disappear,qz.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[_D];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[_D]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[_D])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[_D])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+se({x:0,y:0},a,e[AB]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+se({x:0,y:0},a,e[AB]).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[AB]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+se({x:0,y:0},a,e[AB]).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]}}BY.transformerConstructor=PY,BY.mark=tF;class RY extends BY{constructor(){super(...arguments),this.type=oB.pie}}RY.type=oB.pie;const LY=()=>{EY(),hz.registerAnimation("pie",((t,e)=>({appear:TY(t,e),enter:AY(t),exit:kY(t),disappear:MY(t)}))),hz.registerSeries(RY.type,RY)};class OY extends wY{constructor(){super(...arguments),this.type=OY.type,this._support3d=!0}}OY.type="arc3d";class IY extends PY{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class DY extends BY{constructor(){super(...arguments),this.type=oB.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=IY}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[AB];return"inside"===i.position?ee(e):0},this.setMarkStyle(e,Object.assign(Object.assign({},s),{z:100}),void 0,t.AttributeLevel.Mark)}}DY.type=oB.pie3d,DY.mark=eF,DY.transformerConstructor=IY;const FY=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)=>e.getGraphicAttribute("innerRadius")},outerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("outerRadius")}}}},jY={type:"fadeIn"},zY=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),HY=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),VY=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function NY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return jY;case"growAngle":return FY(Object.assign(Object.assign({},t),{growField:"angle"}));default:return FY(Object.assign(Object.assign({},t),{growField:"radius"}))}}class GY extends _Y{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(MD),this.setInnerRadiusField(kD)}setValueFieldToPercent(){this.setRadiusField(wD),this.setInnerRadiusField(TD)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}class WY extends _G{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}const UY=(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:CB,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:EB,layoutRadius:e.layoutRadius}};class YY extends VG{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(!RV(e))return null;const{axisType:i,componentName:s,startAngle:n,endAngle:r,center:a,outerRadius:o,layoutRadius:l}=UY(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(!RV(e))return;const{axisType:a,componentName:o,startAngle:l,endAngle:h,center:c,outerRadius:d,layoutRadius:u}=UY(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=hz.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=TB,this._endAngle=wB,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),sB(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:EV(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(){sB(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 Dw(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:Dw(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:KF(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:KF(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=>DV(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=EB,e=0;const i=this.getChart().getSpec();return sB(this.getRegions(),(s=>{const n=s;if(r=n.type,[oB.rose,oB.radar,oB.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(Tj({},this._axisStyle,s)),this._gridMark){this._gridMark.getProduct().encode(Tj({},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)}}YY.type=r.polarAxis,YY.specKey="axes";class KY extends YY{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new TC}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}}KY.type=r.polarLinearAxis,KY.specKey="axes",U(KY,XG);const XY=()=>{NG(),hz.registerComponent(KY.type,KY)};class $Y extends YY{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new rC}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(){}}$Y.type=r.polarBandAxis,$Y.specKey="axes",U($Y,ZG);const qY=()=>{NG(),hz.registerComponent($Y.type,$Y)};class ZY extends GY{constructor(){super(...arguments),this.type=oB.rose,this.transformerConstructor=WY,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(ZY.mark.rose,{morph:mG(this._spec,ZY.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=>GF(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=GF(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(dG(null===(i=hz.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),uG("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}ZY.type=oB.rose,ZY.mark=iF,ZY.transformerConstructor=WY;const JY=()=>{hz.registerSeries(ZY.type,ZY),EY(),hz.registerAnimation("rose",((t,e)=>({appear:NY(t,e),enter:zY(t),exit:HY(t),disappear:VY(t)}))),qY(),XY()};class QY extends mc{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);k(t*e)||(this.valid=!1),this._fromAngle=t,this._fromRadius=e;const{angle:i,radius:s}=this._pointToCoord(this.to);k(i*s)||(this.valid=!1),this._toAngle=i,this._toRadius=s}onUpdate(t,e,i){if(!1!==this.valid)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 tK extends Hc{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}),r=re(s.angle),a=re(n.angle),o=this._pointToCoord(e),l=this._pointToCoord({x:e.x1,y:e.y1}),h=re(o.angle),c=re(l.angle),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 eK=t=>({type:"in"===t?"fadeIn":"fadeOut"});function iK(t,e,i){return"fadeIn"===e?eK(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function sK(t,e,i){return"fadeIn"===e?eK(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 nK=(t,e)=>({custom:Nc,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 rK extends GY{constructor(){super(...arguments),this.type=oB.radar,this.transformerConstructor=RG,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(rK.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:kG,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):TB,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(dG(null===(s=hz.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),uG("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=hz.getAnimationInKey(e);t.setAnimationConfig(dG(null==i?void 0:i(n,r),uG(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}}}rK.type=oB.radar,rK.mark=QD,rK.transformerConstructor=RG,U(rK,MG);const aK=()=>{hz.registerSeries(rK.type,rK),sI(),gW(),CG(),BG(),hz.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:iK(t,e,"in"),enter:iK(t,e,"in"),exit:iK(t,e,"out"),disappear:"clipIn"===e?void 0:iK(t,e,"out"),update:[{options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:tK,customParameters:t,duration:UH.update.duration,easing:UH.update.easing}]}))),hz.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:sK(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:sK(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:QY,customParameters:t,duration:UH.update.duration,easing:UH.update.easing}]}))),hz.registerAnimation("radarGroup",((t,e)=>({appear:nK(t,"in"),disappear:nK(t,"out")}))),Xk(),qY(),XY()};class oK extends oN{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 lK=(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},hK={fill:"#bbb",fillOpacity:.2};class cK extends SG{constructor(){super(...arguments),this.type=oB.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]])),Dz(this._option.dataSet,"objFlat",lK),Dz(this._option.dataSet,"copyDataView",Wz),Fz(this._option.dataSet,"dataview",ga),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:Xz.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(Tj(hK,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(cK.mark.group),this._containerMark=this._createMark(cK.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(cK.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(cK.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(cK.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(cK.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(cK.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(cK.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:bD}}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 HF).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:bD}}initTooltip(){this._tooltipHelper=new oK(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]}}cK.type=oB.dot,cK.mark=oF;class dK extends oN{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 uK=(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 pK extends SG{constructor(){super(...arguments),this.type=oB.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(),Dz(this._option.dataSet,"linkDotInfo",uK),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:Xz.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(pK.mark.group),this._containerMark=this._createMark(pK.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(pK.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(pK.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:bD}}initInteraction(){const t=[];this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new dK(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]}}pK.type=oB.link,pK.mark=aF;class gK extends _Y{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()?kD:LD],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()?MD: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):TB;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?te(r):wB,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=GF(this.angleAxisHelper.dataToPosition([t[kD]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=GF(this.angleAxisHelper.dataToPosition([t[MD]]),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(gK.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 Xg(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[Tg({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 vK=()=>{hz.registerAnimation("circularProgress",((t,e)=>({appear:fK(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class _K extends _G{constructor(){super(...arguments),this._supportStack=!0}}class yK extends gK{constructor(){super(...arguments),this.type=oB.circularProgress,this.transformerConstructor=_K,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(yK.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(yK.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()?kD:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?MD: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(dG(null===(i=hz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),uG("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(dG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),uG("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}yK.type=oB.circularProgress,yK.mark=rF,yK.transformerConstructor=_K;function bK(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const xK=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:bK(t)}),SK={type:"fadeIn"};function AK(t,e){return!1===e?{}:"fadeIn"===e?SK:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:bK(t)}))(t)}class kK extends oN{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 MK extends SG{constructor(){super(...arguments),this.type=oB.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(MK.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 GF(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 GF(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 GF(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 GF(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(MK.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 GF(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 GF(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(MK.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=GF(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(Tg({x:i,y:0,height:r,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=GF(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(Tg({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(dG(null===(i=hz.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),uG("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(dG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),uG("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new kK(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}MK.type=oB.linearProgress,MK.mark=dF;const TK=()=>{CW(),hz.registerAnimation("linearProgress",((t,e)=>({appear:AK(t,e),enter:{type:"grow"},disappear:xK(t)}))),$H(),hz.registerSeries(MK.type,MK)},wK=[0],CK=[20,40],EK=[200,500],PK={shrink:!1,enlarge:!1,fontSizeLimitMin:0},BK=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],RK=`${hB}_WORD_CLOUD_WEIGHT`,LK=`${hB}_WORD_CLOUD_TEXT`;class OK extends yG{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=CK}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:EK,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:wK,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)?LK:this._nameField,this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:PK},this._spec.wordCloudConfig),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:wK,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=!BK.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(OK.mark.word,{key:yD,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(dG(hz.getAnimationInKey("wordCloud")(n,s),uG("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 HF).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:bD])}}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 TC,o=this._fontWeightRange;if(r){const[e,i]=pb(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:RK,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:LK,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:Qy(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[r,a],shape:this._maskShape,dataIndexKey:yD,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:RK}: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:yD,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:RK}: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)}}OK.mark=lF;function IK(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)||UH.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 FK(){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 jK(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 zK=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function HK(t){return d(t)?t:function(){return t}}class VK{constructor(t){var e,i,s;switch(this.options=z({},VK.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=(s=this.options.shape,DK[s]?DK[s]():DK.circle()),this.getText=null!==(e=HK(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=HK(this.options.fontWeight),this.getTextFontSize=HK(this.options.fontSize),this.getTextFontStyle=HK(this.options.fontStyle),this.getTextFontFamily=HK(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>zK(10,50);break;case"random-light":this.getTextColor=()=>zK(50,90);break;default:this.getTextColor=HK(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 GK extends VK{constructor(t){var e;super(z({},GK.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<=GK.defaultOptions.minFontSize&&(this.options.minFontSize=GK.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=NK[this.options.spiral])&&void 0!==e?e:NK.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=HK(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}=jK(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(P_.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(KK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(YK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}KK(p,this._size)&&(p=XK(p,this._size))}else if(KK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||UK(p,i))&&(!i||!WK(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 WK(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 UK(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,KK=(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 XK(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}=jK(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)}qK.defaultOptions={enlarge:!1};const JK={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},QK=(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?tX(t.fontFamily):"sans-serif",d=t.fontStyle?tX(t.fontStyle):"normal",u=t.fontWeight?tX(t.fontWeight):"normal",p=t.rotate?tX(t.rotate):0,g=tX(t.text),m=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",f=t.padding?tX(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||JK,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?tX(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=iX(sX(t,l),C);w=i=>e(t(i))}let E=GK;"fast"===t.layoutType?E=qK:"grid"===t.layoutType&&(E=$K);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()},tX=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],eX=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),iX=(t,e)=>{if(t[0]===t[1])return t=>e[0];const i=eX(t[0]),s=eX(t[1]),n=Math.min(i,s),r=Math.max(i,s);return t=>(eX(t)-n)/(r-n)*(e[1]-e[0])+e[0]},sX=(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 nX(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{kR.registerTransform("wordcloud",{transform:QK,markPhase:"beforeJoin"},!0),rY(),hz.registerAnimation("wordCloud",((t,e)=>({appear:IK(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),hz.registerSeries(rX.type,rX)};(class extends OK{constructor(){super(...arguments),this.type=oB.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(OK.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(dG(null===(e=hz.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}})),uG("word",this._spec,this._markAttributeContext)))}}).type=oB.wordCloud3d;const oX=(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},lX=(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},hX=`${hB}_FUNNEL_TRANSFORM_RATIO`,cX=`${hB}_FUNNEL_REACH_RATIO`,dX=`${hB}_FUNNEL_HEIGHT_RATIO`,uX=`${hB}_FUNNEL_VALUE_RATIO`,pX=`${hB}_FUNNEL_LAST_VALUE_RATIO`,gX=`${hB}_FUNNEL_NEXT_VALUE_RATIO`,mX=`${hB}_FUNNEL_LAST_VALUE`,fX=`${hB}_FUNNEL_CURRENT_VALUE`,vX=`${hB}_FUNNEL_NEXT_VALUE`,_X=`${hB}_FUNNEL_TRANSFORM_LEVEL`,yX=20;class bX extends oN{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[cX])).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 xX extends zH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class SX extends xX{constructor(){super(...arguments),this.type=SX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}SX.type="polygon";const AX=()=>{hz.registerMark(SX.type,SX),fM(),cM(),kR.registerGraphic(RB.polygon,Zg),uO.useRegisters([UI,YI])};class kX extends _G{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class MX extends yG{constructor(){super(...arguments),this.type=oB.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=kX,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;Dz(this._dataSet,"funnel",oX),Dz(this._dataSet,"funnelTransform",lX);const t=new ya(this._dataSet,{name:`${hB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new iG(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:fX,asTransformRatio:hX,asReachRatio:cX,asHeightRatio:dX,asValueRatio:uX,asNextValueRatio:gX,asLastValueRatio:pX,asLastValue:mX,asNextValue:vX,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:_X}})}initMark(){var t,e,i,s,n,r,a,o,l,h,c,d;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},MX.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,morph:mG(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({},MX.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(MX.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(MX.mark.outerLabelLine,{themeSpec:e,markSpec:t,depend:[this._funnelOuterLabelMark.label],noSeparateStyle:!0})}}initTooltip(){this._tooltipHelper=new bX(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*aB(cX).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(dG(null===(s=hz.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),uG("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(dG(hz.getAnimationInKey("fadeInOut")(),uG(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(dG(hz.getAnimationInKey("funnel")({},o),uG(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(dG(null===(a=hz.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),uG("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[pX])/2:this._getSecondaryAxisLength(t[uX])/2,n=this._getSecondaryAxisLength(t[uX])/2):(s=this._getSecondaryAxisLength(t[uX])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[gX])/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[_X])}_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[yD]===t[yD]));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?yX: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{AX(),rY(),OU(),hz.registerSeries(MX.type,MX),hz.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},KH))),hz.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Gc,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Gc,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),$H()};class wX extends xX{constructor(){super(...arguments),this.type=wX.type}}wX.type="pyramid3d";class CX extends kX{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class EX extends MX{constructor(){super(...arguments),this.type=oB.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=CX}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},EX.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({},EX.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(EX.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(EX.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())}}EX.type=oB.funnel3d,EX.mark=cF,EX.transformerConstructor=CX;const PX=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},BX=t=>{const e=t.mark.elements.filter((t=>t.diffState===BB.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}))},RX=(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]},LX=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=BX(i),a=RX(r,s,n);return PX(e.startAngle,a)*(n-s)+s},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=BX(i),a=RX(r,s,n);return PX(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}}}),OX=t=>{const e=$(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),i=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[e,i]},IX=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=BX(i),a=OX(r);return PX(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=BX(i),a=OX(r);return PX(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}}}),DX=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},FX=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):FX(t.children,e,i)))})),e};function jX(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=VX(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}},NX=(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=NX(t.children,e,t,n))})),s},GX=(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=GX(t.children,e,t,n)),n=e(t,s,i,n)})),n},WX={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:jX,slice:zX,sliceDice:function(t,e,i,s,n){(t.depth%2==1?zX:jX)(t,e,i,s,n)}};class UX{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({},UX.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?cb(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?HX(this.options.aspectRatio):null!==(e=WX[this.options.splitType])&&void 0!==e?e:WX.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=VX(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)}))}}UX.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const YX=(t,e)=>{const i=new UX(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 FX(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},KX={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class XX{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];jX(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),KX);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({},XX.defaultOpionts,t):Object.assign({},XX.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?cb(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+mb(this.options.center[0],t.width),s=t.y0+mb(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=>mb(t,n))):mb(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>mb(t,n))):mb(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=mb(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=VX(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)}}}XX.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const $X=4294967296;function qX(t,e){let i,s;if(QX(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function QX(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 s$(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 n$(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 r$(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 a$(t){return{_:t,next:null,prev:null}}function o$(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];s$(n,s,r);let a,o,l,h,c,d,u,p=a$(s),g=a$(n),m=a$(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=VX(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)%$X)/$X}(),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:d$.defaultOpionts.nodeSort;NX([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)NX([o],l$(h)),GX([o],h$(this._getPadding,.5,a)),NX([o],c$(1,this._maxDepth));else{const t=Math.min(s.width,s.height);NX([o],l$(d$.defaultOpionts.setRadius)),GX([o],h$(ub,1,a)),c&&GX([o],h$(this._getPadding,o.radius/t,a)),NX([o],c$(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}d$.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const u$=(t,e={})=>{if(!t)return[];const i=[];return FX(t,i,e),i},p$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new XX(i).layout(t,{width:s,height:n})};class g$ extends oN{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var m$;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(m$||(m$={}));const f$=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===m$.DrillDown){return Y(sz(t,n,s,"children"))}if(i.type===m$.DrillUp){const e=nz(t,n,s,"children");if(e)return Y(e)}return t};class v${_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=vU(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;Dz(t,"drillFilter",f$),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:m$.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:m$.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:m$.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:m$.DrillUp},model:this}),r}}class _$ extends _Y{constructor(){super(...arguments),this.type=oB.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:nG),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:yD},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),Dz(this._dataSet,"sunburstLayout",p$),Dz(this._dataSet,"flatten",u$),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:sG,operations:["max","min","values"]},{key:nG,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(Dz(t.dataSet,"addVChartProperty",ZN),t.transform({type:"addVChartProperty",options:{beforeCall:lG.bind(this),call:hG}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t,e;if(!1===this._sunburst.visible)return;const i=this._createMark(_$.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()},Jz.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(_$.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},Jz.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new g$(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(dG(null===(e=hz.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),uG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(dG(null===(e=hz.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),uG(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]}}_$.type=oB.sunburst,_$.mark=_F,U(_$,v$);const y$=()=>{hz.registerSeries(_$.type,_$),EY(),rY(),$H(),hz.registerAnimation("sunburst",((t,e)=>({appear:DX(0,e),enter:LX(t),exit:IX(t),disappear:IX(t)})))},b$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new d$(i).layout(t,{width:s,height:n})};class x$ extends oN{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const S$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"};class A$ extends SG{constructor(){super(...arguments),this.type=oB.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:nG),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:yD},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),Dz(this._dataSet,"circlePackingLayout",b$),Dz(this._dataSet,"flatten",u$),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)||(Dz(t.dataSet,"addVChartProperty",ZN),t.transform({type:"addVChartProperty",options:{beforeCall:lG.bind(this),call:hG}}))}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(A$.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},Jz.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(A$.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"},Jz.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:sG,operations:["max","min","values"]},{key:nG,operations:["values"]}])}initTooltip(){this._tooltipHelper=new x$(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(dG(null===(i=hz.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),uG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(dG(null===(e=hz.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),uG(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]}}A$.type=oB.circlePacking,A$.mark=xF,U(A$,v$);const k$=()=>{hz.registerSeries(A$.type,A$),EY(),rY(),XH(),hz.registerAnimation("circlePacking",((t,e)=>({appear:S$(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},M$=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=M$(t.children):t.value=0),e+=Math.abs(t.value)})),e};function T$(t){return t.depth}function w$(t,e){return e-1-t.endDepth}const C$=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),E$=(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},P$={left:T$,right:w$,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:T$,end:w$},B$=yt(0,1);class R${constructor(t){this._ascendingSourceBreadth=(t,e)=>C$(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>C$(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},R$.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?cb(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):P$[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)};bb(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))),bb(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=[];M$(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}`;if(n[r])return n[r].value+=wt(t.value),void n[r].datum.push(t);const a={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[t],value:t.value,parents:t.parents.map((t=>t.key))};i.push(a),s[t.source].sourceLinks.push(a),s[t.target].targetLinks.push(a),n[r]=a})),{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=[E$(s[t.source]),E$(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=Math.min(n>0?Math.max(this.options.nodeGap,n):this.options.nodeGap,this._viewBox.height/e);a=()=>i,this._gapY=i,this.options.equalNodeHeight?o=this._viewBox.height/e-i:r=t.reduce(((t,e)=>{const s=e.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-(e.length-1)*i)/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,n,0),p=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.max(e.value?i*B$(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&&(o/=i.length-1,n+o>0)){n+=o,this._gapY=Math.min(n);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(C$),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(C$),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 R$(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]:[]},O$=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&O$(t,e.children,i)}))},I$=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},D$=(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 R$(e),r=[];return r.push(n.layout(s,i)),r},F$=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:[]},j$=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 z$ extends oN{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 H$=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),V$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:H$(t),N$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class G$ extends zH{constructor(){super(...arguments),this.type=G$.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}}G$.type="linkPath";const W$=()=>{kR.registerGlyph("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(BO).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),kR.registerAnimationType("linkPathGrowIn",RO),kR.registerAnimationType("linkPathGrowOut",LO),kR.registerAnimationType("linkPathUpdate",OO),_O(),pO(),hz.registerMark(G$.type,G$)};class U$ extends SG{constructor(){super(...arguments),this.type=oB.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=[Jz.STATE_SANKEY_EMPHASIS,Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:s})}else n.target===e.key?i.includes(n.source)||i.push(n.source):(t.removeState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState(Jz.STATE_SANKEY_EMPHASIS),e.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS)):(t.removeState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(Jz.STATE_SANKEY_EMPHASIS),void s.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(Jz.STATE_SANKEY_EMPHASIS),void s.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:h.value/r.value});s.removeState(Jz.STATE_SANKEY_EMPHASIS),s.addState(Jz.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=[Jz.STATE_SANKEY_EMPHASIS,Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS),void t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS),void t.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:o.value/i.value});t.removeState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.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){Dz(this._dataSet,"sankeyLayout",D$),Dz(this._dataSet,"sankeyFormat",I$),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:Xz.sankeyLayout});const{dataSet:a}=this._option;Dz(a,"sankeyNodes",F$),Dz(a,"flatten",u$);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:aG.bind(this),call:oG}},!1),this._nodesSeriesData=new iG(this._option,o),Dz(a,"sankeyLinks",j$);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:aG.bind(this),call:oG}},!1),this._linksSeriesData=new iG(this._option,l)}}initMark(){var t,e,i,s;const n=this._createMark(U$.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(U$.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(U$.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},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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(dG(null===(i=hz.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(r,a),uG("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(dG(null===(s=hz.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(r,a),uG("link",this._spec,this._markAttributeContext))),this._labelMark&&this._labelMark.setAnimationConfig(dG(null===(n=hz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),uG("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([Jz.STATE_SANKEY_EMPHASIS_REVERSE,Jz.STATE_SANKEY_EMPHASIS]),e.includes(t.getDatum().key)||t.addState(Jz.STATE_SANKEY_EMPHASIS_REVERSE)}))}initTooltip(){this._tooltipHelper=new z$(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 HF;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 O$(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]}}U$.type=oB.sankey,U$.mark=mF;const Y$=()=>{kR.registerTransform("sankey",{transform:L$,markPhase:"beforeJoin"},!0),CW(),W$(),rY(),hz.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:V$(t,e)},KH))),hz.registerAnimation("sankeyLinkPath",((t,e)=>({appear:N$(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),$H(),hz.registerSeries(U$.type,U$)},K$=(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=u$(n);return i=QN([{latestData:r}],e),i};class X$ extends oN{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}get defaultShapeType(){return"square"}}const $$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class q$ extends _G{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}class Z$ extends SG{constructor(){super(...arguments),this.type=oB.treemap,this.transformerConstructor=q$,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:nG),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:yD},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&&[nG,"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)&&(Dz(this._rawData.dataSet,"addVChartProperty",ZN),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:lG.bind(this),call:hG}}))}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){Dz(this._dataSet,"hierarchyDimensionStatistics",K$),Dz(this._dataSet,"flatten",u$);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:sG,operations:["max","min","values"]},{key:nG,operations:["values"]}])}initMark(){var t,e,i,s;const n=this._createMark(Z$.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(Z$.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()},Jz.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()},Jz.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},Jz.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},Jz.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},Jz.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},Jz.STATE_NORMAL,t.AttributeLevel.Series))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(dG(null===(e=hz.getAnimationInKey("treemap"))||void 0===e?void 0:e(),uG(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 X$(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]}}Z$.type=oB.treemap,Z$.mark=gF,Z$.transformerConstructor=q$,U(Z$,v$),U(Z$,yU);const J$=()=>{CW(),rY(),hz.registerAnimation("treemap",((t,e)=>({appear:$$(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),$H(),kR.registerTransform("treemap",{transform:YX,markPhase:"beforeJoin"},!0),hz.registerSeries(Z$.type,Z$)},Q$={type:"fadeIn"};function tq(t,e){return"fadeIn"===e?Q$:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class eq extends _G{constructor(){super(...arguments),this._supportStack=!1}}class iq extends gK{constructor(){super(...arguments),this.type=oB.gaugePointer,this.transformerConstructor=eq,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(iq.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},iq.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(iq.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(dG(null===(i=hz.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),uG("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}iq.type=oB.gaugePointer,iq.mark=vF,iq.transformerConstructor=eq;const sq=()=>{hz.registerSeries(iq.type,iq),pU(),CW(),hz.registerAnimation("gaugePointer",((t,e)=>{const i=tq(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),qY(),XY()};class nq extends _G{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class rq extends gK{constructor(){super(...arguments),this.type=oB.gauge,this.transformerConstructor=nq,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();Dz(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[OD]=t[this._angleField[0]],t[LD]=e>0?i[e-1][OD]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(rq.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(rq.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[LD])?this.angleAxisHelper.dataToPosition([t[LD]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[OD]])}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(dG(null===(i=hz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),uG("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}rq.type=oB.gauge,rq.mark=fF,rq.transformerConstructor=nq;class aq extends EG{constructor(){super(...arguments),this.type=aq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}aq.type="cell";const oq=()=>{hz.registerMark(aq.type,aq),fM(),_M(),kR.registerGraphic(RB.cell,bg),kR.registerMark(RB.cell,lD)};function lq(t){return!1===t?{}:{type:"fadeIn"}}class hq extends oN{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return p(i)&&"dimension"===t&&(i.visible=!1),i}}class cq extends _G{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class dq extends SG{constructor(){super(...arguments),this.type=oB.heatmap,this.transformerConstructor=cq}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(dq.mark.cell,{morph:mG(this._spec,dq.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(dq.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=xG(this);this._cellMark.setAnimationConfig(dG(null===(i=hz.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),uG("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 hq(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]}}dq.type=oB.heatmap,dq.mark=SF,dq.transformerConstructor=cq;const uq=()=>{rY(),oq(),hz.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},KH),{appear:lq(e)}))),QG(),qG(),hz.registerSeries(dq.type,dq)},pq=(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=mb(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=mb(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+mb(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+mb(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=cb(e.field),C=t.map(w),[E,P]=pb(C),B=E===P?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(P-E),R=u(e.radiusField)?w:cb(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?pb(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=gq(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),mq({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},mq=(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,[_D]:null==n?void 0:n[_D],[bD]:null==n?void 0:n[bD]}};class vq extends zH{constructor(){super(...arguments),this.type=vq.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}}vq.type="ripple";const _q=()=>{hz.registerMark(vq.type,vq),kR.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}}))),_O(),fO()},yq=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class bq extends _G{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class xq extends _Y{constructor(){super(...arguments),this.type=oB.correlation,this.transformerConstructor=bq,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;Dz(this._dataSet,"correlation",pq);const s=new va;Fz(s,"dataview",ga),Dz(s,"correlationCenter",fq);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 iG(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(xq.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:_D,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(xq.mark.ripplePoint,{key:_D,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});a&&(this._ripplePointMark=a);const o=this._createMark(xq.mark.centerPoint,{key:_D,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[gD],y:t=>t[mD],size:t=>t[fD],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},Jz.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},Jz.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},Jz.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)},Jz.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(dG(null===(e=hz.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),uG("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()}}xq.type=oB.correlation,xq.mark=AF,xq.transformerConstructor=bq;const Sq=()=>{BG(),_q(),hz.registerSeries(xq.type,xq),hz.registerAnimation("correlation",((t,e)=>Object.assign({appear:yq(0,e)},YH)))};class Aq extends zH{constructor(){super(...arguments),this.type=Aq.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}}Aq.type="liquid";const kq=(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/2):t;class Mq extends oN{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 Tq extends yG{constructor(){super(...arguments),this.type=oB.liquid,this.transformerConstructor=RG,this._liquidBackgroundMark=null,this._liquidOutlineMark=null}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){super.setAttrFromSpec(),this._marginSpec=$F(this._spec.outlineMargin),this._paddingSpec=$F(this._spec.outlinePadding),this.setValueField(this._spec.valueField)}rawDataUpdate(t){super.rawDataUpdate(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(Tq.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(Tq.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidMark=this._createMark(Tq.mark.liquid,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_getPosAndSizeFormRegion(t=!1){const{top:e=0,bottom:i=0,left:s=0,right:n=0}=this._marginSpec,{top:r=0,bottom:a=0,left:o=0,right:l=0}=this._paddingSpec,{width:h,height:c}=this._region.getLayoutRect();return t?{x:h/2+(s-n)/2,y:c/2+(e-i)/2,size:Math.min(h-(s+n),c-(e+i))}:{x:h/2+(s+l-(n+l))/2,y:c/2+(e+r-(i+a))/2,size:Math.min(h-(s+n+o+l),c-(e+i+r+a))}}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),x:()=>this._getPosAndSizeFormRegion(!0).x,y:()=>this._getPosAndSizeFormRegion(!0).y,size:()=>this._getPosAndSizeFormRegion(!0).size,symbolType:()=>{var t;return kq(null!==(t=this._spec.maskShape)&&void 0!==t?t:"circle",this._getPosAndSizeFormRegion(!0).size)}},"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:()=>{var t;const{x:e,y:i,size:s}=this._getPosAndSizeFormRegion();return[bg({x:e,y:i,size:s,symbolType:kq(null!==(t=this._spec.maskShape)&&void 0!==t?t:"circle",s),fill:!0})]}},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setInteractive(!1)}_initLiquidMarkStyle(){const e=this._liquidMark;e&&this.setMarkStyle(e,{dx:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,y:()=>{const{y:t,size:e}=this._getPosAndSizeFormRegion();return t-e/2+e-e*this._heightRatio},height:()=>{const{size:t}=this._getPosAndSizeFormRegion();return t*this._heightRatio},fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new Mq(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}initInteraction(){this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i;const s={y:{from:()=>{const{y:t,size:e}=this._getPosAndSizeFormRegion();return t-e/2+e},to:()=>{const{y:t,size:e}=this._getPosAndSizeFormRegion();return t-e/2+e-e*this._heightRatio}},height:{from:0,to:()=>{const{size:t}=this._getPosAndSizeFormRegion();return t*this._heightRatio}}},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(dG(null===(i=hz.getAnimationInKey("liquid"))||void 0===i?void 0:i(s,n),uG("liquid",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=DM(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]}}Tq.type=oB.liquid,Tq.mark=MF,Tq.transformerConstructor=RG;const wq=t=>Y(t).join(",");class Cq extends oN{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>wq(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>wq(null==t?void 0:t[this.series.getDimensionField()[0]])}}class Eq extends _G{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}class Pq extends yG{constructor(){super(...arguments),this.type=oB.venn,this.transformerConstructor=Eq,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:yD)}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(Pq.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(Pq.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()},Jz.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},Jz.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},Jz.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=>wq(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)}},Jz.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=>wq(t.sets)},Jz.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new Cq(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:wq(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return wq(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[wq(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(wq(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(dG(null===(e=hz.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),uG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(dG(null===(e=hz.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),uG(t.name,this._spec,this._markAttributeContext)))}))}}Pq.type=oB.venn,Pq.mark=TF,Pq.transformerConstructor=Eq;class Bq extends hW{_isValidSeries(t){return t===oB.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 Rq extends oW{constructor(){super(...arguments),this.transformerConstructor=Bq,this.type="map",this.seriesType=oB.map}}Rq.type="map",Rq.seriesType=oB.map,Rq.transformerConstructor=Bq;class Lq extends hW{_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 Oq extends Lq{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=PV(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,Tj({},s,l)),n&&Object.assign(o,Tj({},n,o))}}class Iq extends Lq{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 Dq extends Lq{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 Fq extends oW{constructor(){super(...arguments),this.transformerConstructor=Dq}}Fq.transformerConstructor=Dq;class jq extends Fq{constructor(){super(...arguments),this.transformerConstructor=Dq,this.type="pie",this.seriesType=oB.pie}}jq.type="pie",jq.seriesType=oB.pie,jq.transformerConstructor=Dq;class zq extends Dq{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class Hq extends Fq{constructor(){super(...arguments),this.transformerConstructor=zq,this.type="pie3d",this.seriesType=oB.pie3d}}Hq.type="pie3d",Hq.seriesType=oB.pie3d,Hq.transformerConstructor=zq;class Vq extends Iq{_getDefaultSeriesSpec(t){var e,i,s;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:EB,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:EB,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=>Tj({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}class Nq extends oW{constructor(){super(...arguments),this.transformerConstructor=Vq,this.type="rose",this.seriesType=oB.rose,this._canStack=!0}}Nq.type="rose",Nq.seriesType=oB.rose,Nq.transformerConstructor=Vq;class Gq extends Iq{_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:Tj({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=>Tj({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class Wq extends oW{constructor(){super(...arguments),this.transformerConstructor=Gq,this.type="radar",this.seriesType=oB.radar,this._canStack=!0}}Wq.type="radar",Wq.seriesType=oB.radar,Wq.transformerConstructor=Gq;class Uq extends hW{_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")&&Tj(e,aH(this.type,t))})),this._transformAxisSpec(t)}}class Yq extends oW{constructor(){super(...arguments),this.transformerConstructor=Uq,this.type="common",this._canStack=!0}}Yq.type="common",Yq.transformerConstructor=Uq;class Kq extends cW{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 Xq extends oW{constructor(){super(...arguments),this.transformerConstructor=Kq,this._canStack=!0}}Xq.transformerConstructor=Kq;class $q extends Kq{transformSpec(t){super.transformSpec(t),sH(t)}}class qq extends Xq{constructor(){super(...arguments),this.transformerConstructor=$q,this.type="histogram",this.seriesType=oB.bar}}qq.type="histogram",qq.seriesType=oB.bar,qq.transformerConstructor=$q;class Zq extends Xq{constructor(){super(...arguments),this.transformerConstructor=$q,this.type="histogram3d",this.seriesType=oB.bar3d}}Zq.type="histogram3d",Zq.seriesType=oB.bar3d,Zq.transformerConstructor=$q;class Jq extends Oq{_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 Qq extends oW{constructor(){super(...arguments),this.transformerConstructor=Jq,this.type="circularProgress",this.seriesType=oB.circularProgress,this._canStack=!0}}Qq.type="circularProgress",Qq.seriesType=oB.circularProgress,Qq.transformerConstructor=Jq;class tZ extends Oq{_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:oB.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===oB.gauge||t.type===oB.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===oB.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 eZ extends oW{constructor(){super(...arguments),this.transformerConstructor=tZ,this.type="gauge",this.seriesType=oB.gaugePointer}}eZ.type="gauge",eZ.seriesType=oB.gaugePointer,eZ.transformerConstructor=tZ;class iZ extends hW{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class sZ extends oW{constructor(){super(...arguments),this.transformerConstructor=iZ,this.type="wordCloud",this.seriesType=oB.wordCloud}}sZ.transformerConstructor=iZ;class nZ extends iZ{_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 rZ extends sZ{constructor(){super(...arguments),this.transformerConstructor=nZ,this.type="wordCloud",this.seriesType=oB.wordCloud}}rZ.type="wordCloud",rZ.seriesType=oB.wordCloud,rZ.transformerConstructor=nZ;class aZ extends iZ{_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 oZ extends sZ{constructor(){super(...arguments),this.transformerConstructor=aZ,this.type="wordCloud3d",this.seriesType=oB.wordCloud3d}}oZ.type="wordCloud3d",oZ.seriesType=oB.wordCloud3d,oZ.transformerConstructor=aZ;class lZ extends hW{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 hZ extends oW{constructor(){super(...arguments),this.transformerConstructor=lZ,this.type="funnel",this.seriesType=oB.funnel}}hZ.type="funnel",hZ.seriesType=oB.funnel,hZ.transformerConstructor=lZ;class cZ extends oW{constructor(){super(...arguments),this.transformerConstructor=lZ,this.type="funnel3d",this.seriesType=oB.funnel3d}}cZ.type="funnel3d",cZ.seriesType=oB.funnel3d,cZ.transformerConstructor=lZ;class dZ extends cW{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=PV(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=PV(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class uZ extends oW{constructor(){super(...arguments),this.transformerConstructor=dZ,this.type="linearProgress",this.seriesType=oB.linearProgress,this._canStack=!0}}uZ.type="linearProgress",uZ.seriesType=oB.linearProgress,uZ.transformerConstructor=dZ;class pZ extends cW{_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),sH(t)}}class gZ extends oW{constructor(){super(...arguments),this.transformerConstructor=pZ,this.type="rangeColumn",this.seriesType=oB.rangeColumn}}gZ.type="rangeColumn",gZ.seriesType=oB.rangeColumn,gZ.transformerConstructor=pZ;class mZ extends cW{_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 fZ extends oW{constructor(){super(...arguments),this.transformerConstructor=mZ,this.type="rangeColumn3d",this.seriesType=oB.rangeColumn3d}}fZ.type="rangeColumn3d",fZ.seriesType=oB.rangeColumn3d,fZ.transformerConstructor=mZ;class vZ extends hW{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:CB,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=oB.sunburst;return s.type=n,s[n]=t[n],s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class _Z extends oW{constructor(){super(...arguments),this.transformerConstructor=vZ,this.type="sunburst",this.seriesType=oB.sunburst}}_Z.type="sunburst",_Z.seriesType=oB.sunburst,_Z.transformerConstructor=vZ;class yZ extends hW{_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=oB.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class bZ extends oW{constructor(){super(...arguments),this.transformerConstructor=yZ,this.type="circlePacking",this.seriesType=oB.circlePacking}}bZ.type="circlePacking",bZ.seriesType=oB.circlePacking,bZ.transformerConstructor=yZ;class xZ extends hW{_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 SZ extends oW{constructor(){super(...arguments),this.transformerConstructor=xZ,this.type="treemap",this.seriesType=oB.treemap}}SZ.type="treemap",SZ.seriesType=oB.treemap,SZ.transformerConstructor=xZ;class AZ extends OW{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),sH(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}class kZ extends IW{constructor(){super(...arguments),this.transformerConstructor=AZ,this.type="waterfall",this.seriesType=oB.waterfall}}kZ.type="waterfall",kZ.seriesType=oB.waterfall,kZ.transformerConstructor=AZ;class MZ extends cW{_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"}]),sH(t)}}class TZ extends oW{constructor(){super(...arguments),this.transformerConstructor=MZ,this.type="boxPlot",this.seriesType=oB.boxPlot}}TZ.type="boxPlot",TZ.seriesType=oB.boxPlot,TZ.transformerConstructor=MZ;class wZ extends hW{_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 CZ extends oW{constructor(){super(...arguments),this.transformerConstructor=wZ,this.type="sankey",this.seriesType=oB.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)}))}}CZ.type="sankey",CZ.seriesType=oB.sankey,CZ.transformerConstructor=wZ;class EZ extends cW{_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),sH(t)}}class PZ extends oW{constructor(){super(...arguments),this.transformerConstructor=EZ,this.type="rangeArea",this.seriesType=oB.rangeArea}}PZ.type="rangeArea",PZ.seriesType=oB.rangeArea,PZ.transformerConstructor=EZ;class BZ extends cW{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}class RZ extends oW{constructor(){super(...arguments),this.transformerConstructor=BZ,this.type="heatmap",this.seriesType=oB.heatmap}}RZ.type="heatmap",RZ.seriesType=oB.heatmap,RZ.transformerConstructor=BZ;class LZ extends hW{_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=oB.correlation;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class OZ extends oW{constructor(){super(...arguments),this.transformerConstructor=LZ,this.type="correlation",this.seriesType=oB.correlation}}OZ.type="correlation",OZ.seriesType=oB.correlation,OZ.transformerConstructor=LZ;function IZ(t){var e,i;const s=Object.assign({},t);return B(t.style)||(s.textStyle=lz(t.style)),B(t.textStyle)||Tj(s.textStyle,lz(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&lz(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&lz(s.background.style),s}const DZ=(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},FZ=(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:bD;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 jZ extends FG{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:()=>{sB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),sB(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=UF(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 DH(this._option,e),this._initSelectedData(),sB(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)||(sB(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(Tj({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(Tj({},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(Tj({},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}}jZ.specKey="legends";class zZ extends jZ{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),sB(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:Xz.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){Dz(this._option.dataSet,"discreteLegendFilter",FZ),Dz(this._option.dataSet,"discreteLegendDataMake",DZ);const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return sB(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(!rb(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=qj(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=IZ(s)),B(n.focusIconStyle)||lz(n.focusIconStyle),n.shape&&(n.shape=az(n.shape)),n.label&&(n.label=az(n.label)),n.value&&(n.value=az(n.value)),n.background&&(n.background=az(n.background)),YF(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),YF(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),YF(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)||lz(r.railStyle),B(r.sliderStyle)||lz(r.sliderStyle)):(B(r.textStyle)||lz(r.textStyle),r.handler&&az(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(Tj(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 uP}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(rP.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(rP.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(rP.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}=wV(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=wV(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}zZ.specKey="legends",zZ.type=r.discreteLegend;const HZ=(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[]},VZ=(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)?rz(t,+e,+i):t.filter((t=>t[o]>=e&&t[o]<=i))}return t};function NZ(t){return"color"===t||"size"===t}const GZ={color:vP,size:yP},WZ=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],UZ=[2,10];class YZ extends jZ{static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!y(e))return NZ(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)=>{NZ(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),sB(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData},level:Xz.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(){Dz(this._option.dataSet,"continuousLegendFilter",VZ),Dz(this._option.dataSet,"continuousLegendDataMake",HZ);const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>nB(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=qj(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!rb(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=qj(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?WZ:UZ);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=Tj({},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=IZ(s)),w.showHandler=!1!==n.visible,B(n.style)||(w.handlerStyle=lz(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),B(r.style)||(w.railStyle=lz(r.style)),B(a.style)||(w.trackStyle=lz(a.style)),w.startText=az(o),w.endText=az(l),w.handlerText=az(h),B(c)||(w.sizeBackground=lz(c)),d.visible&&!B(d.style)&&(Tj(w,d.style),p(d.padding)&&(w.padding=d.padding)),w}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return GZ[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))}}}YZ.specKey="legends",YZ.type=r.continuousLegend;class KZ{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=Tz(n,a,!0))&&void 0!==e?e:[],...null!==(i=gz(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(!jw(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=nN(s).includes(t):p(e.visible)||p(e.activeType)?d.visible=nN(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)&&(pN(s).every((t=>{var e;return!nN(null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec).includes("dimension")}))?d.visible=!1:p(e.visible)||p(e.activeType)?d.visible=nN(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=dN(t,i,s),m=uN(t,i,s),f=Tj({},I(e[t]),m),v=g.title,_=mN(void 0,f,u.shape,void 0,v);p(f.title)?f.title=hN(f.title,Object.assign(Object.assign({},v),_)):f.title=hN(v,_,!0);const y=Y(g.content);if(p(f.content)){const t=gN(y);f.content=cN(f.content,(e=>mN(e,f,u.shape,t)))}else f.content=cN(y,(t=>mN(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=SN(a,t,e),l=!!p(o)&&!1!==vN(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 XZ extends KZ{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 $Z extends KZ{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 qZ extends KZ{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 ZZ=t=>p(t)&&!y(t),JZ=t=>p(t)&&y(t);class QZ extends DG{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:s}=super._initTheme(t,e);return i.style=Tj({},this._theme,i.style),{spec:i,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h,c,d;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=nN(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:eb(this._option.mode)||!Qy(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=null===(d=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===d?void 0:d.getElementById(t.parentElement)):Qy(this._option.mode)&&(t.parentElement=null==Jy?void 0:Jy.body)}}class tJ extends FG{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=QZ,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._getMouseOutHandler=t=>e=>{var i,s,n;if(this._alwaysShow)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=Qy(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(!t&&this._clickLock)return;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&&ZZ(this._cacheInfo)?a.mark=this._showTooltipByMouseEvent("mark",i,e,t,!0):r&&JZ(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),t&&this._clickLock&&(this._clickLock=!1))},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(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));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&sV.globalConfig.uniqueTooltip&&l&&sV.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._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?_N.canvas:_N.dom,n=hz.getComponentPluginInType(t);n||$y("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 $Z(this),dimension:new XZ(this),group:new qZ(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)),(tb(i)||eb(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)))}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=iN(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(JZ(t)){if(ZZ(this._cacheInfo))return!1;const e=this._cacheInfo;if(!(e.length===t.length&&t.every(((t,i)=>cz(t,e[i])))))return!1}else{if(JZ(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}}tJ.type=r.tooltip,tJ.transformerConstructor=QZ,tJ.specKey="tooltip";var eJ,iJ;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(eJ||(eJ={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(iJ||(iJ={}));const sJ={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class nJ extends FG{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=>{this._handleIn(t),this._clickLock=this._hasActive&&this._spec.lockAfterClick,this._clickLock&&S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._clickLock=!1,this._handleOutEvent()}),this.triggerOff))},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"}:tb(e)||eb(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=this.trigger||"hover",e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;if(y(t)){const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return[{click:"click"===t,in:i[t],out:e(t)}]}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)=>{sJ[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||t.yField)&&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){mz(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=>{jw(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[0],s=e.series.dataToPosition(e.datum[0]);(p(t.dimType)?"y"===t.dimType:fz(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=s.y:r=s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=e.x,a=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=rB(this._regions,"cartesian");if(!e)return;const{x:i,y:s,offsetWidth:n,offsetHeight:r,bandWidth:a,bandHeight:o}=zV(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=NV(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=GV(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 uT(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(n=new pT(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 QM(e)),null==s||s.add(t)),FV(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}rJ.specKey="crosshair",rJ.type=r.cartesianCrosshair;class aJ extends nJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return e.categoryField||e.valueField?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.polarCrosshair}]:void 0;const i=[];return e.forEach(((t,e)=>{(t.categoryField||t.valueField)&&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=>{jw(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=rB(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:"",Tj(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=EV(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=EV(s.getSpec())),c.angle=a.angle,c.axis=s,Tj(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}=wV(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}=wV(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 uT(Object.assign(Object.assign({},l),{lineStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===o&&(t=new mT(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 fT(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex+1})):new gT(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 QM(e),null==s||s.add(t),i(t)),FV(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair]}}aJ.specKey="crosshair",aJ.type=r.polarCrosshair;const oJ=(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)},lJ=(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 hJ extends FG{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 sB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),sB(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=_z(t),this._isHorizontal="horizontal"===yz(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=>!Dw(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(Dw(this._stateScale.type));this._stateScale.domain(e,!0),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={};sB(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=Dw(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 sB(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;Fz(s,"dataview",ga),Dz(s,"dataFilterComputeDomain",lJ);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 DH(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(Dw(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&&Dw(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,Dw(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=Dw(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 rC,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||(Dz(this._option.dataSet,"dataFilterWithNewDomain",oJ),sB(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:()=>Dw(this._stateScale.type)},level:Xz.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(Dw(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&&jw(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,jw(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(hJ,yU);class cJ extends DG{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=Tj({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 dJ extends hJ{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=cJ,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 TC;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(!Dw(t.type)||e[0]!==e[1])&&(!jw(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 rE(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:lz(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:lz(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:lz(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:lz(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:lz(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:lz(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:lz(g.style)},selectedBackgroundStyle:lz(this._spec.selectedBackground.style),dragMaskStyle:lz(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:Tj(lz(null===(l=m.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},lz(null===(h=m.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:Tj(lz(null===(c=f.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},lz(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}=wV(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()}}dJ.type=r.dataZoom,dJ.transformerConstructor=cJ,dJ.specKey="dataZoom";class uJ extends hJ{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 EM(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=$P(this._start,e)&&$P(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=lz(t.style)),B(null==e?void 0:e.style)||(s.sliderStyle=lz(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}uJ.type=r.scrollBar,uJ.specKey="scrollBar";const pJ=(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 gJ extends FG{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!==gJ.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(){Dz(this._option.dataSet,"indicatorFilter",pJ);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 DH(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=Tj({},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({},lz(e.style)),{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?ZF(this._spec.offsetX,this._computeLayoutRadius()):0,dy:this._spec.offsetY?ZF(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({},lz(this._spec.title.style)),{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 SP(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}}gJ.type=r.indicator,gJ.specKey="indicator";const mJ=["sum","average","min","max","variance","standardDeviation","median"];function fJ(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=X(s);return er}function vJ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&fJ(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=YF(t.x)?xJ(t.x,n)+r.x:l.getXAxisHelper().dataToPosition([t.x])+r.x,h}function _J(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&fJ(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=YF(t.y)?xJ(t.y,n)+r.y:l.getYAxisHelper().dataToPosition([t.y])+r.y,h}function yJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&fJ(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 bJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&fJ(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 xJ(t,e){return Number(t.substring(0,t.length-1))*e/100}function SJ(t){return mJ.includes(t)}function AJ(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=vJ(t,m,n,d,h,a),i=_J(t,f,n,d,c,a);u.push([{x:e,y:i}])}else if(e){const e=vJ(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=_J(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 kJ(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=yJ(t,l,n,r),i=bJ(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=yJ(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=bJ(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function MJ(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=YF(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=YF(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])&&fJ(_,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])&&fJ(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 TJ(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])&&fJ(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])&&fJ(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 wJ(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 YF(e)&&(e=xJ(e,r)),e+=s,YF(i)&&(i=xJ(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 YF(e)&&(e=xJ(e,s)),YF(i)&&(i=xJ(i,n)),{x:e,y:i}}))}function CJ(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 EJ(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},lz(r.style)):t.shape={visible:!1},!1!==s.visible?(t.panel=Object.assign({visible:!0},BJ(lz(s.style),i)),p(s.padding)&&(t.padding=ei(s.padding))):(t.panel={visible:!1},t.padding=0),n&&(t.textStyle=BJ(lz(n),i)),t}return{visible:!1}}function PJ(t,e){for(const i in t)d(t[i])&&(t[i]=t[i](e));return t}function BJ(t,e){return d(t)?t(e):t}function RJ(t,e){return d(t)?t(e):t}function LJ(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 OJ(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 IJ(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 DJ(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function FJ(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=>zJ(i,t,e))):s.x=zJ(i,t,e)}if(p(e.y)){const i=e.y;y(i)?s.y=i.map((i=>zJ(i,t,e))):s.y=zJ(i,t,e)}if(p(e.angle)){const i=e.angle;y(i)?s.angle=i.map((i=>zJ(i,t,e))):s.angle=zJ(i,t,e)}if(p(e.radius)){const i=e.radius;y(i)?s.radius=i.map((i=>zJ(i,t,e))):s.radius=zJ(i,t,e)}if(p(e.areaName)){const i=e.areaName;s.areaName=zJ(i,t,e)}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),i.push(s)})),i}const jJ={min:(t,e)=>qP(t[0].latestData,e.field),max:(t,e)=>ZP(t[0].latestData,e.field),sum:function(t,e){return JP(t[0].latestData,e.field)},average:function(t,e){return QP(t[0].latestData,e.field)},variance:function(t,e){return tB(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(tB(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 zJ(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 jJ[i](e,{field:s})}return t}class HJ extends FG{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)&&SJ(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])&&SJ(t[h])?i.x={field:h,aggrType:t[h]}:i.x=Y(h).map((e=>t[e])),_(t[c])&&SJ(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])&&SJ(t[o])?i.angle={field:o,aggrType:t[o]}:i.angle=Y(o).map((e=>t[e])),_(t[l])&&SJ(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=rB(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=KF(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=KF(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 VJ(t,e){return function(t,e,i){const{predict:s}=_b(t,(t=>t[e]),(t=>t[i])),n=qP(t,e),r=ZP(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 NJ(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 GJ extends HJ{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}=OJ(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:BJ(lz(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:EJ(y,this._markerData),state:{line:PJ(null!==(a=null===(r=this._spec.line)||void 0===r?void 0:r.state)&&void 0!==a?a:{},this._markerData),lineStartSymbol:PJ(null!==(l=null===(o=this._spec.startSymbol)||void 0===o?void 0:o.state)&&void 0!==l?l:{},this._markerData),lineEndSymbol:PJ(null!==(c=null===(h=this._spec.endSymbol)||void 0===h?void 0:h.state)&&void 0!==c?c:{},this._markerData),label:PJ(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:PJ(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:lz(b.style)}):S.startSymbol={visible:!1},x.visible?S.endSymbol=Object.assign(Object.assign({},x),{visible:!0,style:lz(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}=CJ([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}=OJ(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;Dz(this._option.dataSet,"markerAggregation",FJ),Dz(this._option.dataSet,"markerRegression",VJ),Dz(this._option.dataSet,"markerFilter",NJ);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}}GJ.specKey="markLine";class WJ extends GJ{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new UE(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:_}=OJ(e);let y=[];if(u||m||g||f||v||a&&l||a&&h){const t=AJ(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=MJ(i,r,d,e.coordinatesOffset):c&&(y=wJ(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(YF(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}=OJ(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}}}WJ.type=r.markLine,WJ.coordinateType="cartesian";class UJ extends GJ{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=OJ(this._spec);return e||i?new XE(t):new UE(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}=OJ(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=kJ(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=TJ(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}=OJ(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}}}UJ.type=r.polarMarkLine,UJ.coordinateType="polar";class YJ extends FG{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=UF(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 bP(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}}YJ.type=r.title,YJ.specKey=r.title;class KJ extends HJ{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=IJ(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:BJ(lz(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:EJ(u,this._markerData),state:{area:PJ(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData),label:PJ(null===(o=this._spec.label)||void 0===o?void 0:o.state,this._markerData),labelBackground:PJ(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}=CJ([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}=IJ(t);if(!(e||i||s||n||r||a||o))return null;const{options:l}=this._computeOptions(),h=this._getRelativeDataView();Dz(this._option.dataSet,"markerAggregation",FJ),Dz(this._option.dataSet,"markerFilter",NJ);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}}KJ.specKey="markArea";class XJ extends KJ{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new KE(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}=IJ(e),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t;let u=[],g=[];if(l){g=AJ(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=AJ(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[...t,e[1],e[0]])}else h?u=MJ(i,r,d,e.coordinatesOffset):c&&(u=wJ(e.positions,r,e.regionRelative));return{points:u}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=IJ(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}}}XJ.type=r.markArea,XJ.coordinateType="cartesian";class $J extends KJ{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=IJ(this._spec);return i||e||s?new $E(t):new KE(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}=IJ(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=kJ(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=TJ(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}=IJ(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}}}$J.type=r.polarMarkArea,$J.coordinateType="polar";const qJ=t=>lz(Object.assign({},t)),ZJ=t=>Object.assign(Object.assign({},t),{style:Object.assign({},lz(t.style))}),JJ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,m;const f=qJ(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=qJ(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:{},lz(Object.assign({},y)));var y;const b=ZJ(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=ZJ(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=ZJ(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=ZJ(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},QJ=t=>"left"===t||"right"===t,tQ=t=>"top"===t||"bottom"===t;class eQ extends FG{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({},JJ(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({},JJ(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 DP(t):this._playerComponent=new zP(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=QJ(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=QJ(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(PP.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(PP.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(PP.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(PP.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(PP.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(PP.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=QJ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=tQ(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)):QJ(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))):tQ(this._orient)?this._maxSize():t.height}_computeDx(t){return QJ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return tQ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}}eQ.specKey="player",eQ.type=r.player;class iQ extends FG{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)))}}iQ.type=r.label;class sQ extends nY{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}}sQ.type="text",sQ.constructorType="label";const nQ=()=>{hz.registerMark(sQ.constructorType,sQ),vO()};class rQ extends DG{_initTheme(t,e){return{spec:t,theme:this._theme}}}class aQ extends iQ{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=rQ,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),sB(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=Tj({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=zU[t])&&void 0!==i?i:zU.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}:HU(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}}aQ.type=r.label,aQ.specKey="label",aQ.transformerConstructor=rQ;class oQ extends iQ{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[PD]},"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 Tj({textStyle:{pickable:!0===this._spec.interactive},position:lQ(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[RD]))},a))}})).encode((e=>HU({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 lQ(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}oQ.type=r.totalLabel,oQ.specKey="totalLabel";class hQ extends HJ{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=DJ(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:RJ(E.offsetX,this._relativeSeries.getRegion()),offsetY:RJ(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:BJ(B.style,this._markerData)},state:{line:PJ(null!==(h=null===(l=this._spec.itemLine.line)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData),lineStartSymbol:PJ(null!==(d=null===(c=this._spec.itemLine.startSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData),lineEndSymbol:PJ(null!==(p=null===(u=this._spec.itemLine.endSymbol)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData),symbol:PJ(null!==(m=null===(g=this._spec.itemContent.symbol)||void 0===g?void 0:g.state)&&void 0!==m?m:{},this._markerData),image:PJ(null!==(v=null===(f=this._spec.itemContent.image)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData),text:PJ(null!==(y=null===(_=this._spec.itemContent.text)||void 0===_?void 0:_.state)&&void 0!==y?y:{},this._markerData),textBackground:PJ(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:PJ(null!==(A=null===(S=this._spec.itemContent.richText)||void 0===S?void 0:S.state)&&void 0!==A?A:{},this._markerData),customMark:PJ(null!==(M=null===(k=this._spec.itemContent.customMark)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData),targetItem:PJ(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=lz(BJ(L.style,this._markerData))),(null==O?void 0:O.style)&&(F.itemContent.imageStyle=BJ(O.style,this._markerData)),R&&(F.itemContent.textStyle=EJ(R,this._markerData)),(null==I?void 0:I.style)&&(F.itemContent.richTextStyle=BJ(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:lz(z.style)}):{visible:!1};return new ZE(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}=CJ([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:LJ(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:LJ(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}=DJ(t);if(!(p(t.coordinate)||e||i||s))return;Dz(this._option.dataSet,"markerAggregation",FJ),Dz(this._option.dataSet,"markerFilter",NJ);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}}hQ.specKey="markPoint";class cQ extends hQ{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=AJ(i,s,s,s,o)[0][0]:r?l=MJ(i,s,o,e.coordinatesOffset)[0]:a&&(l=wJ([e.position],s,e.regionRelative)[0]),{point:l}}_computeOptions(){const t=this._spec,{doXYProcess:e}=DJ(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}}}cQ.type=r.markPoint,cQ.coordinateType="cartesian";class dQ extends hQ{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=kJ(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}])]}}}dQ.type=r.polarMarkPoint,dQ.coordinateType="polar";class uQ extends hQ{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}])]}}}uQ.type=r.geoMarkPoint,uQ.coordinateType="geo";const pQ="inBrush",gQ="outOfBrush";class mQ extends FG{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),pQ,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),gQ,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 GP(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:lz(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(FP.drawStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(FP.moveStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(FP.drawing,(s=>{this._needInitOutState&&"single"===o&&this._initMarkBrushState(i,gQ),this._needInitOutState=!1,this._needDisablePickable=!0,this._handleBrushChange(t.ChartEvent.brushChange,e,s),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(FP.moving,(i=>{this._handleBrushChange(t.ChartEvent.brushChange,e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(FP.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(FP.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(FP.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({},lz(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(pQ),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(pQ),i.addState(gQ),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(pQ),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(pQ),i.addState(gQ),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(pQ),i.removeState(gQ),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}}}mQ.type=r.brush,mQ.specKey="brush";class fQ extends FG{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,`${hB}_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=dG({},uG(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}}}fQ.type=r.customMark,fQ.specKey="customMark";function vQ(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 _Q(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function yQ(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:_Q(t.rect),anchorCandidates:MQ(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=>vQ(t,r)));if(n.anchorCandidates)if(a&&(null===(e=n.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;tvQ(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 bQ(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=AQ(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(!AQ(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],xQ(SQ(t.point,l)))):t.point;n&&(s.x=n.x,s.y=n.y);const r=xQ(SQ(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=kQ(t.rect,a,0),t}));return yQ(h)}function xQ(t){return t>180?t-360:t}function SQ(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function AQ(t,e){for(let i=0;i{const{x:r,y:a}=kQ(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,s);n.push({x:r,y:a})})),n}class TQ extends FG{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:Xz.copyDataView},!1),this._data=new DH(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 ZE({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=$F(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=ku({});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=Tg(lz(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=bg(lz(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=mp(lz(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=mp(lz(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=kQ(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:lz(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]}))):yQ(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}}TQ.type=r.mapLabel,TQ.specKey="mapLabel";class wQ{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=>CQ(t))),a=n.filter((t=>!CQ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>CQ(t))),h=o.filter((t=>!CQ(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 CQ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}wQ.type="grid";sV.useRegisters([()=>{iI(),sI(),CG(),BG(),ZH(),XH(),QG(),qG(),hz.registerSeries(sW.type,sW),hz.registerChart(uW.type,uW)},()=>{iI(),sI(),CG(),gW(),BG(),fW(),QG(),qG(),hz.registerSeries(_W.type,_W),hz.registerChart(bW.type,bW)},()=>{LW(),hz.registerChart(IW.type,IW)},()=>{XW(),hz.registerChart(qW.type,qW)},()=>{LY(),hz.registerChart(jq.type,jq)},()=>{JY(),hz.registerChart(Nq.type,Nq)},()=>{aK(),hz.registerChart(Wq.type,Wq)},()=>{LW(),hz.registerChart(qq.type,qq)},()=>{MU(),hz.registerChart(Rq.type,Rq)},()=>{sq(),hz.registerSeries(rq.type,rq),EY(),vK(),XY(),hz.registerChart(eZ.type,eZ)},()=>{aX(),hz.registerChart(rZ.type,rZ)},()=>{TX(),hz.registerChart(hZ.type,hZ)},()=>{qU(),hz.registerChart(kZ.type,kZ)},()=>{iY(),BG(),XH(),QG(),qG(),hz.registerSeries(sY.type,sY),hz.registerChart(TZ.type,TZ)},()=>{hz.registerSeries(yK.type,yK),EY(),vK(),$H(),qY(),XY(),hz.registerChart(Qq.type,Qq)},()=>{TK(),hz.registerChart(uZ.type,uZ)},()=>{gY(),hz.registerChart(gZ.type,gZ)},()=>{gW(),QG(),qG(),hz.registerSeries(vY.type,vY),hz.registerChart(PZ.type,PZ)},()=>{y$(),hz.registerChart(_Z.type,_Z)},()=>{k$(),hz.registerChart(bZ.type,bZ)},()=>{J$(),hz.registerChart(SZ.type,SZ)},()=>{Y$(),hz.registerChart(CZ.type,CZ)},()=>{uq(),hz.registerChart(RZ.type,RZ)},()=>{Sq(),hz.registerChart(OZ.type,OZ)},()=>{hz.registerChart(Yq.type,Yq)},qG,QG,()=>{NG(),hz.registerComponent(tW.type,tW)},()=>{NG(),hz.registerComponent(eW.type,eW)},()=>{NG(),hz.registerComponent(iW.type,iW)},qY,XY,()=>{hz.registerComponent(zZ.type,zZ)},()=>{hz.registerComponent(YZ.type,YZ)},()=>{hz.registerComponent(tJ.type,tJ)},()=>{hz.registerComponent(rJ.type,rJ)},()=>{hz.registerComponent(aJ.type,aJ)},()=>{hz.registerComponent(dJ.type,dJ)},()=>{hz.registerComponent(uJ.type,uJ)},()=>{hz.registerComponent(gJ.type,gJ)},SU,()=>{hz.registerComponent(WJ.type,WJ),WE()},()=>{hz.registerComponent(XJ.type,XJ),YE()},()=>{hz.registerComponent(cQ.type,cQ),qE()},()=>{hz.registerComponent(UJ.type,UJ),XE._animate=TE,WE()},()=>{hz.registerComponent($J.type,$J),$E._animate=CE,YE()},()=>{hz.registerComponent(dQ.type,dQ),qE()},()=>{hz.registerComponent(uQ.type,uQ),qE()},()=>{hz.registerComponent(YJ.type,YJ)},()=>{hz.registerComponent(eQ.type,eQ)},()=>{zO(),nQ(),zG(),hz.registerComponent(aQ.type,aQ,!0)},()=>{zO(),nQ(),zG(),hz.registerComponent(oQ.type,oQ,!0)},()=>{hz.registerComponent(mQ.type,mQ)},()=>{hz.registerComponent(fQ.type,fQ)},()=>{hz.registerComponent(TQ.type,TQ)},()=>{ql.load(cT)},()=>{hz.registerLayout(wQ.type,wQ)},qN,pV,UR,WR]),sV.useRegisters([()=>{cA(ql)}]),t.ARC_END_ANGLE=xB,t.ARC_K=SB,t.ARC_MIDDLE_ANGLE=AB,t.ARC_QUADRANT=kB,t.ARC_RADIAN=MB,t.ARC_RATIO=yB,t.ARC_START_ANGLE=bB,t.ARC_TRANSFORM_VALUE=_B,t.AxisSyncPlugin=xV,t.BASE_EVENTS=hD,t.CORRELATION_SIZE=fD,t.CORRELATION_X=gD,t.CORRELATION_Y=mD,t.CanvasTooltipHandler=$N,t.DEFAULT_CHART_HEIGHT=dB,t.DEFAULT_CHART_WIDTH=cB,t.DEFAULT_CONICAL_GRADIENT_CONFIG=HD,t.DEFAULT_DATA_INDEX=_D,t.DEFAULT_DATA_KEY=yD,t.DEFAULT_DATA_SERIES_FIELD=bD,t.DEFAULT_GRADIENT_CONFIG=VD,t.DEFAULT_LABEL_ALIGN=pB,t.DEFAULT_LABEL_LIMIT=uB,t.DEFAULT_LABEL_TEXT=gB,t.DEFAULT_LABEL_VISIBLE=mB,t.DEFAULT_LABEL_X=fB,t.DEFAULT_LABEL_Y=vB,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_GRADIENT_CONFIG=jD,t.DEFAULT_MEASURE_CANVAS_ID=vD,t.DEFAULT_RADIAL_GRADIENT_CONFIG=zD,t.DEFAULT_SERIES_STYLE_NAME=xD,t.DomTooltipHandler=XN,t.Factory=hz,t.FormatterPlugin=uV,t.GradientType=FD,t.MediaQuery=lV,t.POLAR_DEFAULT_RADIUS=EB,t.POLAR_END_ANGLE=270,t.POLAR_END_RADIAN=wB,t.POLAR_START_ANGLE=CB,t.POLAR_START_RADIAN=TB,t.PREFIX=hB,t.SEGMENT_FIELD_END=OD,t.SEGMENT_FIELD_START=LD,t.STACK_FIELD_END=MD,t.STACK_FIELD_END_OffsetSilhouette=ED,t.STACK_FIELD_END_PERCENT=wD,t.STACK_FIELD_KEY=AD,t.STACK_FIELD_START=kD,t.STACK_FIELD_START_OffsetSilhouette=CD,t.STACK_FIELD_START_PERCENT=TD,t.STACK_FIELD_TOTAL=PD,t.STACK_FIELD_TOTAL_PERCENT=BD,t.STACK_FIELD_TOTAL_TOP=RD,t.ThemeManager=Wj,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=sV,t.WaterfallDefaultSeriesField=pD,t.builtinThemes=Lj,t.computeActualDataScheme=LF,t.darkTheme=yj,t.dataScheme=JF,t.default=sV,t.defaultThemeName=Oj,t.getActualColor=IF,t.getColorSchemeBySeries=zF,t.getDataScheme=RF,t.getMergedTheme=Nj,t.getTheme=zj,t.hasThemeMerged=Fj,t.isColorKey=DF,t.isProgressiveDataColorScheme=FF,t.isTokenKey=fj,t.lightTheme=_j,t.queryColorFromColorScheme=OF,t.queryToken=mj,t.registerCanvasTooltipHandler=qN,t.registerChartPlugin=oV,t.registerDomTooltipHandler=()=>{KN(XN)},t.registerFormatPlugin=pV,t.registerMediaQuery=()=>{oV(lV)},t.registerTheme=jj,t.removeTheme=Hj,t.themeExist=Vj,t.themes=Ij,t.token=vj,t.transformColorSchemeToStandardStruct=jF,t.version="1.11.5",t.vglobal=P_,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 829c0c9ec2..e5cdefcd2b 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.4", + "version": "1.11.5", "description": "@visactor/vchart 针对 harmonyOS 打造的图表库,拥有非常酷炫的动画能力,近20种图表类型,以及原生的渲染性能", "main": "Index.ets", "author": { diff --git a/packages/lark-vchart/package.json b/packages/lark-vchart/package.json index 2c48b32a42..9c048169c6 100644 --- a/packages/lark-vchart/package.json +++ b/packages/lark-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/lark-vchart", - "version": "1.11.4", + "version": "1.11.5", "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 41b0b39258..3af0f794b1 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 V(t){return Object.prototype.toString.call(t)}function N(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(V(t)!==V(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=N(t),n=N(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 Vt(t){return t>1?0:t<-1?Et:Math.acos(t)}function Nt(t){return t>=1?Pt:t<=-1?-Pt:Math.asin(t)}function Gt(t,e,i,s,n){let r,a;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 Ve,Ne,Ge,We;function Ue(t){return Ve=1/0,Ne=1/0,Ge=-1/0,We=-1/0,t.forEach((t=>{Ve>t.x&&(Ve=t.x),Get.y&&(Ne=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},Vi=Math.sqrt,Ni=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=Vi(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=Ns},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=Vs,Rs=Os=t,Ls=Is=e}function Vs(t,e){Fs.add(Is*t-Os*e),Os=t,Is=e}function Ns(){Vs(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=Vi(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=Vi(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(Vi(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 Vn=16,Nn=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=Vi(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()):Vi(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 Ni((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)*Vi(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 Vr(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 Vr(s).parse(t)},Yr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Lr.DSV,Nr(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",Va="Function",Na="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 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 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 No(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 No("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){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"linearClosed":return ll(t,i)}}class cl 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 dl=["l",0,0,0,0,0,0,0];function ul(t,e,i){const s=dl[0]=t[0];if("a"===s||"A"===s)dl[1]=e*t[1],dl[2]=i*t[2],dl[3]=t[3],dl[4]=t[4],dl[5]=t[5],dl[6]=e*t[6],dl[7]=i*t[7];else if("h"===s||"H"===s)dl[1]=e*t[1];else if("v"===s||"V"===s)dl[1]=i*t[1];else for(let s=1,n=t.length;s{at.getInstance().warn("空函数")}}),Cl=Object.assign(Object.assign({},bl),{points:[],cornerRadius:0,closePath:!0}),El=Object.assign(Object.assign({},bl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},bl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const Pl=Object.assign(Object.assign({},bl),{symbolType:"circle",size:10,keepDirIn3d:!0}),Bl=Object.assign(Object.assign(Object.assign({},bl),vl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Rl=Object.assign(Object.assign(Object.assign({},bl),vl),{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}),Ll=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},bl),{fill:!0,cornerRadius:0}),Ol=Object.assign(Object.assign({},Ll),{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 Il=new class{},Dl={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"}},Fl=!0,jl=!1,zl=/\w|\(|\)|-/,Hl=/[.?!,;:/,。?!、;:]/,Vl=/\S/;function Nl(t,e,i,s,n){if(!e||e<=0)return 0;const r=Il.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=Gl(t,a)),a}function Gl(t,e){let i=e;for(;zl.test(t[i-1])&&zl.test(t[i])||Hl.test(t[i]);)if(i--,i<=0)return e;return i}function Wl(t,e){const i=Il.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 Ul=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Yl=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=Bl.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=Gl(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=Gl(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}};Yl=Ul([Oa()],Yl);var Kl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Xl=Symbol.for("TextMeasureContribution");let $l=class extends Yl{};$l=Kl([Oa()],$l);const ql=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 Va: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===Da&&(t.cache=e,t.activated=!0)}},Zl=Symbol.for("CanvasFactory"),Jl=Symbol.for("Context2dFactory");function Ql(t){return ql.getNamed(Zl,Il.global.env)(t)}const th=1e-4,eh=Math.sqrt(3),ih=1/3;function sh(t){return t>-vh&&tvh||t<-vh}const rh=[0,0],ah=[0,0],oh=[0,0];function lh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function hh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function ch(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 dh(t){return(t%=Rt)<0&&(t+=Rt),t}function uh(t,e,i,s,n,r){if(r>e&&r>s||rn?o:0}function ph(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 fh(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(sh(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 yh=[-1,-1,-1],bh=[-1,-1];function xh(){const t=bh[0];bh[0]=bh[1],bh[1]=t}function Sh(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(sh(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,ih):Math.pow(i,ih),s=s<0?-Math.pow(-s,ih):Math.pow(s,ih);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+eh*Math.sin(e)))/(3*a),h=(-o+i*(s-eh*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,yh);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&xh(),p=ch(e,s,r,o,bh[0]),u>1&&(g=ch(e,s,r,o,bh[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(sh(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,yh);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=hh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);yh[0]=-l,yh[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>=yh[0]+t&&a<=yh[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=yh[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 Mh(t){return Math.round(t/Et*1e8)/1e8%2*Et}function Th(t,e){let i=Mh(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-Mh(i-n)):e&&i1&&(i||(h+=uh(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;wh[0]=S,wh[1]=A,Th(wh,Boolean(a[6])),S=wh[0],A=wh[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(fh(c,d,f,v,e,s,n))return!0}else h+=uh(c,d,f,v,s,n)||0;c=f,d=v;break;case po.C:if(i){if(gh(c,d,f,v,_,y,b,x,e,s,n))return!0}else h+=Sh(c,d,f,v,_,y,b,x,s,n)||0;c=b,d=x;break;case po.Q:if(i){if(ph(c,d,f,v,_,y,e,s,n))return!0}else h+=Ah(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+=uh(c,d,o,l,s,n),i){if(mh(f,v,_,k,k+M,T,e,w,n))return!0}else h+=kh(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(fh(u,p,o,p,e,s,n)||fh(o,p,o,l,e,s,n)||fh(o,l,u,l,e,s,n)||fh(u,l,u,p,e,s,n))return!0}else h+=uh(o,p,o,l,s,n),h+=uh(u,l,u,p,s,n);break;case po.Z:if(i){if(fh(c,d,u,p,e,s,n))return!0}else h+=uh(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},Bh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Rh=Symbol.for("VWindow"),Lh=Symbol.for("WindowHandlerContribution");let Oh=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&&(ql.getNamed(Lh,t.env).configure(this,t),this.actived=!0)},this._uid=ba.GenAutoIncrementId(),this.global=Il.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)}};Oh=Ph([Oa(),Bh("design:paramtypes",[])],Oh);var Ih=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fh=function(t,e){return function(i,s){e(i,s,t)}};let jh=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=Il.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=Eh.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:vl.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:vl.fontFamily,fontSize:vl.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=ql.get(Rh),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 zh;jh=Ih([Oa(),Fh(0,Ra(qa)),Fh(0,Ia(Xl)),Dh("design:paramtypes",[Object])],jh),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(zh||(zh={}));const Hh=new oe;let Vh=class{constructor(){this.matrix=new oe}init(t){return this.mode=zh.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=zh.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Hh.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(Hh.a,Hh.b,Hh.c,Hh.d,Hh.e,Hh.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Hh.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(Hh.a,Hh.b,Hh.c,Hh.d,Hh.e,Hh.f),this}scale(t,e,i){return this.mode===zh.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===zh.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Hh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Hh.a,Hh.b,Hh.c,Hh.d,Hh.e,Hh.f),this}translate(t,e){return this.mode===zh.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===zh.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Vh=Ih([Oa(),Dh("design:paramtypes",[])],Vh);const Nh={arc:xl,area:Sl,circle:Al,line:Tl,path:wl,symbol:Pl,text:Bl,rect:El,polygon:Cl,richtext:Rl,richtextIcon:Ol,image:Ll,group:kl,glyph:Ml},Gh=Object.keys(Nh);function Wh(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Uh={arc:Object.assign({},Nh.arc),area:Object.assign({},Nh.area),circle:Object.assign({},Nh.circle),line:Object.assign({},Nh.line),path:Object.assign({},Nh.path),symbol:Object.assign({},Nh.symbol),text:Object.assign({},Nh.text),rect:Object.assign({},Nh.rect),polygon:Object.assign({},Nh.polygon),richtext:Object.assign({},Nh.richtext),richtextIcon:Object.assign({},Nh.richtextIcon),image:Object.assign({},Nh.image),group:Object.assign({},Nh.group),glyph:Object.assign({},Nh.glyph)};class Yh{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Gh.forEach((t=>{this._defaultTheme[t]=Object.create(Uh[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;Gh.forEach((s=>{const n=Object.create(Uh[s]);t&&t[s]&&Wh(n,t[s]),i[s]&&Wh(n,i[s]),e[s]&&Wh(n,e[s]),this.combinedTheme[s]=n})),e.common&&Gh.forEach((t=>{Wh(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 Kh=new Yh;function Xh(t,e){return t.glyphHost?Xh(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)):Kh.getTheme()}return null}(t)||t.attachedThemeGraphic&&Xh(t.attachedThemeGraphic)||Kh.getTheme()}var $h=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=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 $h(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 Qh))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(sc(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 Qh))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=sc(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 Qh))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=sc(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 Qh))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=sc(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 Qh))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=ic.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(sc(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(sc(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,sc(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 Qh))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"):sc(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 tc))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=ic.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 nc(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 Qh,this.rootWheelEvent=new tc,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 lc{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return lc.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 hc{static Avaliable(){return!0}avaliable(){return hc.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 cc{static Avaliable(){return!!Il.global.getRequestAnimationFrame()}avaliable(){return cc.Avaliable()}tick(t,e){Il.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var dc;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(dc||(dc={}));class uc{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-uc.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*uc.bounceIn(2*t):.5*uc.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}}}uc.quadIn=uc.getPowIn(2),uc.quadOut=uc.getPowOut(2),uc.quadInOut=uc.getPowInOut(2),uc.cubicIn=uc.getPowIn(3),uc.cubicOut=uc.getPowOut(3),uc.cubicInOut=uc.getPowInOut(3),uc.quartIn=uc.getPowIn(4),uc.quartOut=uc.getPowOut(4),uc.quartInOut=uc.getPowInOut(4),uc.quintIn=uc.getPowIn(5),uc.quintOut=uc.getPowOut(5),uc.quintInOut=uc.getPowInOut(5),uc.backIn=uc.getBackIn(1.7),uc.backOut=uc.getBackOut(1.7),uc.backInOut=uc.getBackInOut(1.7),uc.elasticIn=uc.getElasticIn(1,.3),uc.elasticOut=uc.getElasticOut(1,.3),uc.elasticInOut=uc.getElasticInOut(1,.3*1.5);class pc{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 gc=new pc;class mc{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(){}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 fc extends mc{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let vc=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]:gc;this.id=t,this.timeline=e,this.status=Ao.INITIAL,this.tailAnimate=new _c(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.duration===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 fc((()=>{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 _c(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()}};vc.mode=ko.NORMAL,vc.interpolateMap=new Map;class _c{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 yc(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?uc[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?uc[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 yc(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 yc{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 bc=200,xc="cubicOut",Sc=1e3,Ac="quadInOut";var kc;!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"}(kc||(kc={}));const Mc=[!1,!1,!1,!1],Tc=[0,0,0,0],wc=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Tc[0]=t[0],Tc[2]=t[0],Tc[1]=t[1],Tc[3]=t[1],Tc):t:t:0,Cc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Ec=[1,2,3,0,1,2,3,0];function Pc(t,e,i,s){for(;t>=Rt;)t-=Rt;for(;t<0;)t+=Rt;for(;t>e;)e+=Rt;Cc[0].x=i,Cc[1].y=i,Cc[2].x=-i,Cc[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]:Ic.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)}}Ic.TimeOut=1e3/60;const Dc=new Ic,Fc=(t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class jc extends mc{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 zc;!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"}(zc||(zc={}));class Hc extends mc{constructor(t,e,i,s,n){super(t,e,i,s,n),this.newPointAnimateType="appear"===(null==n?void 0:n.newPointAnimateType)?"appear":"grow"}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}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?[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=Bc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),i.points=this.points}}class Vc extends mc{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 Nc extends Vc{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=Il.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 Gc extends Vc{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=Il.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 Wc extends mc{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 Uc extends mc{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?uc[n]:n;e=r(e),s.onUpdate(t,e,i)})),this.updating=!1)}}function Yc(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 Kc(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 Qc(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 td(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 sd(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}))),ad=(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]},od=(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 ad(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return ad(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);od(n[0],s,i),od(n[1],e-s,i)}};var ld;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(ld||(ld={}));class hd{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ld.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===ld.Color1){const e=hd.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];hd.store1[t]=e,hd.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=hd.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&&(hd.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],hd.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===ld.Color1){if(hd.store1[t])return;hd.store1[t]=i,hd.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(hd.store255[t])return;hd.store255[t]=i,hd.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function cd(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 dd(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)=>ud(y(t)?t[r]:t,y(e)?e[r]:e,i,s))):ud(t,e,i,s,n)}function ud(t,e,i,s,n){if(!t||!e)return t&&cd(t)||e&&cd(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=hd.Get(t,ld.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=hd.Get(e,ld.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:cd(a)})))});return o?dd(r,l,i,s,n):dd(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:md(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:md(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:md(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),cd(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)}hd.store255={},hd.store1={};const pd=[0,0,0,0],gd=[0,0,0,0];function md(t,e,i){return hd.Get(t,ld.Color255,pd),hd.Get(e,ld.Color255,gd),`rgba(${Math.round(pd[0]+(gd[0]-pd[0])*i)},${Math.round(pd[1]+(gd[1]-pd[1])*i)},${Math.round(pd[2]+(gd[2]-pd[2])*i)},${pd[3]+(gd[3]-pd[3])*i})`}const fd=(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=dd(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},vd=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?Qc(t):[],n=Qc(e);i&&s&&(i.fromTransform&&td(s,i.fromTransform.clone().getInverse()),td(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})))},yd=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],bd=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!yd.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]?hd.Get(t[n],ld.Color255):t[n],to:"string"==typeof r?hd.Get(r,ld.Color255):r,key:n}):i.push({from:t[n],to:r,key:n}),s=!0)})),s?i:null};class xd extends mc{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;vd(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&fd(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Sd=(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=_d(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=bd(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 xd({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Sc,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Ac)),c};class Ad extends mc{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;vd(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&&fd(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const kd=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Lc.includes(t))(i)||(e[i]=t[i])})),e},Md=(t,e,i)=>{const s=kd(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=Il.graphicService.creator.rect({x:0,y:0,width:a,height:o});n.appendChild(i),e.push(i)}))}},Td=(t,e,i)=>{const s=[],n=i?null:kd(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:kd(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=id(t.attribute),n=sd(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(Il.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=sd(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(Il.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=sd(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(Il.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 nd(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 nd(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(Il.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:rd(i)}];const s=[];return od(i,e,s),s})(t,e).forEach((t=>{s.push(Il.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 od(r,e,h),h})(t,e).forEach((t=>{s.push(Il.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=Qc(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(Il.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(Il.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Md(t,s,e),s};class Cd{static GetImage(t,e){var i;const s=Cd.cache.get(t);s?"fail"===s.loadState?Il.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):Cd.loadImage(t,e)}static GetSvg(t,e){var i;let s=Cd.cache.get(t);s?"fail"===s.loadState?Il.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"},Cd.cache.set(t,s),s.dataPromise=Il.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=Cd.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"},Cd.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Il.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Il.global.loadBlob(t):"json"===e&&(i.dataPromise=Il.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Cd.isLoading&&Cd.toLoadAueue.length){Cd.isLoading=!0;const t=Cd.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Cd.cache.set(i,n),n.dataPromise=Il.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((()=>{Cd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Cd.loading()})).catch((t=>{console.error(t),Cd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Cd.loading()}))}}),0)}static loadImage(t,e){const i=Ed(t,Cd.toLoadAueue);if(-1!==i)return Cd.toLoadAueue[i].marks.push(e),void Cd.loading();Cd.toLoadAueue.push({url:t,marks:[e]}),Cd.loading()}static improveImageLoading(t){const e=Ed(t,Cd.toLoadAueue);if(-1!==e){const t=Cd.toLoadAueue.splice(e,1);Cd.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Ed(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;Dd.x=n+(null!==(i=t.scrollX)&&void 0!==i?i:0),Dd.y=r+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else Dd.x=n,Dd.y=r;return Dd}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Il.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Il.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]:Rd;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Rd;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(Il.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:bc,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:xc),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 Bd.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(Bd),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=pl.x,y:e=pl.y,scaleX:i=pl.scaleX,scaleY:s=pl.scaleY,angle:n=pl.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),Il.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(pl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Pd.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),Il.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=dd(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=dd(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=dd(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 Xh(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:Il.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 cl).fromString(t):this.pathProxy=new cl,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",Il.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new ec(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)}}}jd.mixin(rc);class zd{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 Hd(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Vd(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 Nd=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class Gd{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=Vd(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Hd(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Vd(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 zd(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 zd(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 Wd(t,e){return Ud(t)}function Ud(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 Zd=0;function Jd(){return Zd++}var Qd;function tu(t){const e=[];let i=0,s="";for(let n=0;neu.set(t,!0)));const iu=new Map;function su(t){if(eu.has(t))return!0;if(iu.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>iu.set(t,!0)));const nu=Jd(),ru=Jd(),au=Jd(),ou=Jd(),lu=Jd(),hu=Jd(),cu=Jd(),du=Jd(),uu=Jd(),pu=Jd();Jd();const gu=Jd();Jd();const mu=Jd(),fu=Jd(),vu=Jd(),_u=Symbol.for("GraphicService"),yu=Symbol.for("GraphicCreator"),bu={"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"},xu=Object.keys(bu);var Su;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Su||(Su={}));let Au=class t extends jd{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=hu,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 Yh),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Yh)}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;Il.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),Il.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=pl.x,y:e=pl.y,dx:i=pl.dx,dy:s=pl.dy,scaleX:n=pl.scaleX,scaleY:r=pl.scaleY,angle:a=pl.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=Xh(this).group;this._AABBBounds.clear();const i=Il.graphicService.updateGroupAABBBounds(t,e,this._AABBBounds,this),{boundsPadding:s=e.boundsPadding}=t,n=wc(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(),Il.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Il.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,Il.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{Il.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),Il.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=Il.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 ku(t){return new Au(t)}Au.NOWORK_ANIMATE_ATTR=Fd;class Mu extends Au{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 Yh,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=>{Il.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=>{Il.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 Tu=Symbol.for("TransformUtil"),wu=Symbol.for("GraphicUtil"),Cu=Symbol.for("LayerService"),Eu=Symbol.for("StaticLayerHandlerContribution"),Pu=Symbol.for("DynamicLayerHandlerContribution"),Bu=Symbol.for("VirtualLayerHandlerContribution");var Ru,Lu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)};let Iu=Ru=class{static GenerateLayerId(){return`${Ru.idprefix}_${Ru.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Il.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(Eu):"dynamic"===t?ql.get(Pu):ql.get(Bu),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 Mu(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Ru.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)}};Iu.idprefix="visactor_layer",Iu.prefix_count=0,Iu=Ru=Lu([Oa(),Ou("design:paramtypes",[])],Iu);var Du=new xa((t=>{t(io).to(ao).inSingletonScope(),t(Rh).to(Oh),t(wu).to(jh).inSingletonScope(),t(Tu).to(Vh).inSingletonScope(),t(Cu).to(Iu).inSingletonScope()}));function Fu(t,e){return!(!t&&!e)}function ju(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function zu(t,e,i){return i&&t*e>0}function Hu(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Vu(t,e){return t*e>0}function Nu(t,e,i,s){return t*e>0&&0!==i&&0!==s}function Gu(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 Uu(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(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:m,outerEndAngle:f,innerEndAngle:v,innerStartAngle:_}=t.getParsePadAngle(o,l),y=u,b=u,x=u,S=u,A=Math.max(b,y),k=Math.max(x,S);let M=A,T=k;const w=n*It(m),C=n*jt(m),E=r*It(v),P=r*jt(v);let B,R,L,O;if((k>Ct||A>Ct)&&(B=n*It(f),R=n*jt(f),L=r*It(_),O=r*jt(_),hCt){const t=Ft(y,M),r=Ft(b,M),o=Wu(L,O,w,C,n,t,Number(c)),l=Wu(B,R,E,P,n,r,Number(c));M0&&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+B,s+n*jt(f))}else!a||a[0]?(e.moveTo(i+w,s+C),e.arc(i,s,n,m,f,!c)):e.moveTo(i+n*It(f),s+n*jt(f));if(!(r>Ct)||g<.001)!a||a[1]?e.lineTo(i+E,s+P):e.moveTo(i+E,s+P),d=!0;else if(T>Ct){const t=Ft(S,T),n=Ft(x,T),o=Wu(E,P,B,R,r,-n,Number(c)),l=Wu(w,C,L,O,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),T0&&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+L,s+O)}else!a||a[1]?e.lineTo(i+E,s+P):e.moveTo(i+E,s+P),!a||a[2]?e.arc(i,s,r,v,_,c):e.moveTo(i+r*It(_),s+r*jt(_))}return a?a[3]&&e.lineTo(i+n*It(o),s+n*jt(o)):e.closePath(),d}class Yu{static GetCanvas(){try{return Yu.canvas||(Yu.canvas=Il.global.createCanvas({})),Yu.canvas}catch(t){return null}}static GetCtx(){if(!Yu.ctx){const t=Yu.GetCanvas();Yu.ctx=t.getContext("2d")}return Yu.ctx}}class Ku extends le{static getInstance(){return Ku._instance||(Ku._instance=new Ku),Ku._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=Yu.GetCanvas(),s=Yu.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 Ku(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Xu{static GetSize(t){for(let e=0;e=t)return Xu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Xu.GenKey(t,e,i,s,n),l=Xu.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=Xu.GenKey(t,e,i,s,n);Xu.cache[l]?Xu.cache[l].push({width:a,height:o,pattern:r}):Xu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}Xu.cache={},Xu.ImageSize=[20,40,80,160,320,640,1280,2560];const $u=Symbol.for("ArcRenderContribution"),qu=Symbol.for("AreaRenderContribution"),Zu=Symbol.for("CircleRenderContribution"),Ju=Symbol.for("GroupRenderContribution"),Qu=Symbol.for("ImageRenderContribution"),tp=Symbol.for("PathRenderContribution"),ep=Symbol.for("PolygonRenderContribution"),ip=Symbol.for("RectRenderContribution"),sp=Symbol.for("SymbolRenderContribution"),np=Symbol.for("TextRenderContribution"),rp=Symbol.for("InteractiveSubRenderContribution"),ap=["radius","startAngle","endAngle",...Rd];class op extends jd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=ou}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=Xh(this).circle;this._AABBBounds.clear();const i=this.attribute,s=Il.graphicService.updateCircleAABBBounds(i,Xh(this).circle,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=wc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xh(this).circle[t]}needUpdateTags(t){return super.needUpdateTags(t,ap)}needUpdateTag(t){return super.needUpdateTag(t,ap)}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 cl;return o.arc(0,0,n,r,a),o}clone(){return new op(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return op.NOWORK_ANIMATE_ATTR}}function lp(t){return new op(t)}function hp(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 cp(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function dp(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)}op.NOWORK_ANIMATE_ATTR=Fd;class up{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=vu,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=Xh(this).text;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=this.attribute,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}updateWrapAABBBounds(t){var e,i,s,n;const r=Xh(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=Fc(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=Il.graphicUtil.textMeasure,k=new up(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===Qd.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=cp(x,o),M=dp(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=Xh(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=Fc(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 _=Il.graphicUtil.textMeasure,y=new up(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=Xh(this).text,a=Il.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=Fc(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=cp(x,o),e=this.cache.verticalList.length*b,i=dp(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=>tu(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===Qd.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=cp(x,o),M=this.cache.verticalList.length*b,T=dp(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 Xh(this).text[t]}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pp;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pp;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function mp(t){return new gp(t)}gp.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Fd),gp.baselineMapAlign={top:"left",bottom:"right",middle:"center"},gp.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class fp{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 vp(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 _p=new class extends fp{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 vp(t,e/2,i,s,n)}drawOffset(t,e,i,s,n,r){return vp(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 yp=new class extends fp{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 bp(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 xp=new class extends fp{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 bp(t,e/2,i,s,n)}drawFitDir(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)}};function Sp(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Ap=new class extends fp{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Sp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Sp(t,e/2+n,i,s)}};class kp extends fp{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 Mp=new kp;var Tp=new class extends kp{constructor(){super(...arguments),this.type="triangle"}};const wp=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Cp=Math.sin(Bt/10)*wp,Ep=-Math.cos(Bt/10)*wp;function Pp(t,e,i,s){const n=Cp*e,r=Ep*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 Bp=new class extends fp{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 Pp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Pp(t,e/2+n,i,s)}};const Rp=zt(3);function Lp(t,e,i,s){const n=e,r=n/Rp,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 Op=new class extends fp{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 Lp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Lp(t,e/2+n,i,s)}};function Ip(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 Dp=new class extends fp{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Ip(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Ip(t,e/2+n,i,s)}};function Fp(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var jp=new class extends fp{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}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)}};const zp=-.5,Hp=zt(3)/2,Vp=1/zt(12);function Np(t,e,i,s){const n=e/2,r=e*Vp,a=n,o=e*Vp+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(zp*n-Hp*r+i,Hp*n+zp*r+s),t.lineTo(zp*a-Hp*o+i,Hp*a+zp*o+s),t.lineTo(zp*l-Hp*h+i,Hp*l+zp*h+s),t.lineTo(zp*n+Hp*r+i,zp*r-Hp*n+s),t.lineTo(zp*a+Hp*o+i,zp*o-Hp*a+s),t.lineTo(zp*l+Hp*h+i,zp*h-Hp*l+s),t.closePath(),!1}var Gp=new class extends fp{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 Np(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Np(t,e/2+n,i,s)}};var Wp=new class extends fp{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 Up=new class extends fp{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 Yp=new class extends fp{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 Kp=zt(3);function Xp(t,e,i,s){const n=e*Kp;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var $p=new class extends kp{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Xp(t,e/2/Kp,i,s)}drawOffset(t,e,i,s,n){return Xp(t,e/2/Kp+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 Zp=new class extends fp{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 Jp(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 Qp=new class extends fp{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 Jp(t,e/4,i,s)}drawOffset(t,e,i,s,n){return Jp(t,e/4+n,i,s)}};function tg(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 eg=new class extends fp{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 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-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var sg=new class extends fp{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 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,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var rg=new class extends fp{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return ng(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return ng(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 ag(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var og=new class extends fp{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return ag(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return ag(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 lg(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 hg=new class extends fp{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 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-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function cg(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function dg(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var ug=new class extends fp{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)?dg(t,e,i,s):cg(t,e,i,s)}drawOffset(t,e,i,s,n){return S(e)?dg(t,e+2*n,i,s):cg(t,[e[0]+2*n,e[1]+2*n],i,s)}};const pg=new Qt;class gg{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;pg.x1=s.bounds.x1*t,pg.y1=s.bounds.y1*t,pg.x2=s.bounds.x2*t,pg.y2=s.bounds.y2*t,e.union(pg)}))}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 mg={};[_p,yp,xp,Ap,$p,Tp,Bp,Op,Dp,jp,Gp,Wp,Up,Mp,Yp,Zp,Qp,eg,sg,ug,rg,og,hg].forEach((t=>{mg[t.type]=t}));const fg={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"},vg=new Qt,_g=["symbolType","size",...Rd];let yg=class t extends jd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=fu}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=Xh(this).symbol;let{symbolType:i=e.symbolType}=this.attribute,s=mg[i];if(s)return this._parsedPath=s,s;if(s=t.userSymbolMap[i],s)return this._parsedPath=s,s;if(i=fg[i]||i,!0===((n=i).startsWith("{const e=(new cl).fromString(t.d),i={};xu.forEach((e=>{t[e]&&(i[bu[e]]=t[e])})),r.push({path:e,attribute:i}),vg.union(e.bounds)}));const a=vg.width(),o=vg.height(),l=1/Dt(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new gg(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var n;const r=(new cl).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 gg(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=Xh(this).symbol;this._AABBBounds.clear();const i=this.attribute,s=Il.graphicService.updateSymbolAABBBounds(i,Xh(this).symbol,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=wc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xh(this).symbol[t]}needUpdateTags(t){return super.needUpdateTags(t,_g)}needUpdateTag(t){return super.needUpdateTag(t,_g)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new cl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new cl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function bg(t){return new yg(t)}yg.userSymbolMap={},yg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Fd);const xg=["segments","points","curveType",...Rd];let Sg=class t extends jd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=du}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=Rc(i,s,e))}doUpdateAABBBounds(){const t=Xh(this).line;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateLineAABBBounds(e,Xh(this).line,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xh(this).line[t]}needUpdateTags(t){return super.needUpdateTags(t,xg)}needUpdateTag(t){return super.needUpdateTag(t,xg)}toCustomPath(){const t=this.attribute,e=new cl,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 Ag(t){return new Sg(t)}Sg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Fd);const kg=["width","x1","y1","height","cornerRadius",...Rd];class Mg extends jd{constructor(t){super(t),this.type="rect",this.numberType=gu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}doUpdateAABBBounds(){const t=Xh(this).rect;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateRectAABBBounds(e,Xh(this).rect,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xh(this).rect[t]}needUpdateTags(t){return super.needUpdateTags(t,kg)}needUpdateTag(t){return super.needUpdateTag(t,kg)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:s,height:n}=id(t),r=new cl;return r.moveTo(e,i),r.rect(e,i,s,n),r}clone(){return new Mg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Mg.NOWORK_ANIMATE_ATTR}}function Tg(t){return new Mg(t)}Mg.NOWORK_ANIMATE_ATTR=Fd;class wg extends jd{constructor(t){super(t),this.type="glyph",this.numberType=lu,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=Il.graphicService.updateGlyphAABBBounds(this.attribute,Xh(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 wg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return wg.NOWORK_ANIMATE_ATTR}}function Cg(t){return new wg(t)}wg.NOWORK_ANIMATE_ATTR=Fd;class Eg{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=Dl[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 Pg{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const s=Fc(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}=Wl(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}=Wl(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=Nl(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}=Wl(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||jl;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||Fl;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=Nl(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Wl(this.text.slice(t),this.character);return i+this.ellipsisWidth-s}return i}}const Bg=["width","height","image",...Rd];class Rg extends jd{constructor(t){super(t),this.type="image",this.numberType=cu,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=Xh(this).image;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateImageAABBBounds(e,Xh(this).image,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Ll[t]}needUpdateTags(t){return super.needUpdateTags(t,Bg)}needUpdateTag(t){return super.needUpdateTag(t,Bg)}clone(){return new Rg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Rg.NOWORK_ANIMATE_ATTR}}function Lg(t){return new Rg(t)}Rg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Fd);class Og extends Rg{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=wc(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=wc(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=Ll.width,height:e=Ll.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 Ig{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 Og?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=Dl[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Pg){const e=Vl.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 Og)break;if("vertical"===this.direction&&"vertical"!==s.direction){s.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";s.ellipsisStr=r;const{width:a}=Wl(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 Og)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 Og)break;const{width:n}=Wl(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 Og?t.width:t.getWidthWithEllips(this.direction)})),i}}class Dg{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=Dl[this.direction]}store(t){if(t instanceof Og){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 Ig(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 Og?"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=Nl(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 Pg(i,t.newLine,t.character),new Pg(s,!0,t.character)]}(t,s);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const Fg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...Rd];class jg extends jd{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=mu}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Rl.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:Rl.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:Rl.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:Rl.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:Rl.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:Rl.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:Rl.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:Rl.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=Xh(this).richtext;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateRichTextAABBBounds(e,Xh(this).richtext,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Rl[t]}needUpdateTags(t){return super.needUpdateTags(t,Fg)}needUpdateTag(t){return super.needUpdateTag(t,Fg)}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(){var t;const{textConfig:e=[],maxWidth:i,maxHeight:s,width:n,height:r,ellipsis:a,wordBreak:o,verticalDirection:l,textAlign:h,textBaseline:c,layoutDirection:d,singleLine:u,disableAutoWrapLine:p}=this.attribute,g=[];for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,g.push(t)}}else{const i=this.combinedStyleToCharacter(e[t]);if(S(i.text)&&(i.text=`${i.text}`),i.text&&i.text.includes("\n")){const t=i.text.split("\n");for(let e=0;e0,f="number"==typeof s&&Number.isFinite(s)&&s>0,v="number"==typeof n&&Number.isFinite(n)&&n>0&&(!m||n<=i),_="number"==typeof r&&Number.isFinite(r)&&r>0&&(!f||r<=s),y=new Eg(0,0,(v?n:m?i:0)||0,(_?r:f?s:0)||0,a,o,l,h,c,d||"horizontal",!v&&m,!_&&f,u||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),b=new Dg(y);if(p){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 jg.NOWORK_ANIMATE_ATTR}}function zg(t){return new jg(t)}jg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Fd);const Hg=["path","customPath",...Rd];class Vg extends jd{constructor(t){super(t),this.type="path",this.numberType=uu}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=Xh(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof cl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof cl?this.cache:t.path)}doUpdateAABBBounds(){const t=Xh(this).path;this.doUpdatePathShape(),this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updatePathAABBBounds(e,Xh(this).path,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new cl).fromString(t.path):t.customPath&&(this.cache=new cl,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xh(this).path[t]}needUpdateTags(t){return super.needUpdateTags(t,Hg)}needUpdateTag(t){return super.needUpdateTag(t,Hg)}toCustomPath(){return(new cl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Vg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Vg.NOWORK_ANIMATE_ATTR}}function Ng(t){return new Vg(t)}Vg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Fd);const Gg=["segments","points","curveType",...Rd];class Wg extends jd{constructor(t){super(t),this.type="area",this.numberType=au}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=Xh(this).area;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateAreaAABBBounds(e,Xh(this).area,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Rc(i,s,e))}getDefaultAttribute(t){return Xh(this).area[t]}needUpdateTags(t){return super.needUpdateTags(t,Gg)}needUpdateTag(t){return super.needUpdateTag(t,Gg)}toCustomPath(){const t=new cl,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 Wg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Wg.NOWORK_ANIMATE_ATTR}}function Ug(t){return new Wg(t)}Wg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Fd);const Yg=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Rd];class Kg extends jd{constructor(t){super(t),this.type="arc",this.numberType=nu}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=Xh(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);return Math.min(S(e,!0)?e:a*parseFloat(e)/100,a/2)}getParsedAngle(){const t=Xh(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=Xh(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=Nt(Number(l)/o*jt(g)),n=Nt(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=Xh(this).arc;this._AABBBounds.clear();const i=this.attribute,s=Il.graphicService.updateArcAABBBounds(i,Xh(this).arc,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=wc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return super.needUpdateTags(t,Yg)}needUpdateTag(t){return super.needUpdateTag(t,Yg)}getDefaultAttribute(t){return Xh(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 Kg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Kg.NOWORK_ANIMATE_ATTR}}function Xg(t){return new Kg(t)}Kg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Fd);const $g=["points","cornerRadius",...Rd];class qg extends jd{constructor(t){super(t),this.type="polygon",this.numberType=pu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=Xh(this).polygon;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updatePolygonAABBBounds(e,Xh(this).polygon,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Rc(i,s,e))}getDefaultAttribute(t){return Xh(this).polygon[t]}needUpdateTags(t){return super.needUpdateTags(t,$g)}needUpdateTag(t){return super.needUpdateTag(t,$g)}toCustomPath(){const t=this.attribute.points,e=new cl;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 Zg(t){return new qg(t)}qg.NOWORK_ANIMATE_ATTR=Fd;class Jg extends Au{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 Qg(t){return new Jg(t)}class tm{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 em extends tm{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 im{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 im.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},am=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},om=function(t,e){return function(i,s){e(i,s,t)}};function lm(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 hm(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 cm(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 dm(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),lm(t,t,[n+o,r+l,a+h]),lm(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),lm(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=nm.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]}lm(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),lm(i,i,[-s[0],-s[1],0]),cm(t,t,i)}}let um=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 tm],this._symbolBoundsContribitions=[new em],this._imageBoundsContribitions=[new tm],this._circleBoundsContribitions=[new tm],this._arcBoundsContribitions=[new tm],this._pathBoundsContribitions=[new tm]}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,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}=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 h=this.tempAABBBounds1,c=this.tempAABBBounds2;return h.setValue(i.x1,i.y1,i.x2,i.y2),c.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=dp(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=cp(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),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}=t,r=i;return n.forEach((t=>{r.add(t.x,t.y)})),r}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{r.add(t.x,t.y)}))})),r}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):Pc(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):(Pc(h,l,n,i),Pc(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&&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)}};um=rm([Oa(),om(0,Ra(yu)),am("design:paramtypes",[Object])],um);const pm=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 gm,mm;function fm(t){return gm||(gm=pm.CreateGraphic("text",{})),gm.initAttributes(t),gm.AABBBounds}const vm={x:0,y:0,z:0,lastModelMatrix:null};class _m{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=zu(o,l,n),p=Vu(o,c),g=Fu(n,r),m=ju(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;vm.x=n,vm.y=r,vm.z=a,vm.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=nm.allocate(),n=nm.allocate();dm(n,t,e),cm(s,d||s,n),vm.x=0,vm.y=0,vm.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),nm.free(n)}if(g&&!d){const s=t.getOffsetXY(e);vm.x+=s.x,vm.y+=s.y,vm.z=a,i.setTransformForCurrent()}else if(p)vm.x=0,vm.y=0,vm.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);vm.x+=s.x,vm.y+=s.y,this.transformWithoutTranslate(i,vm.x,vm.y,vm.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),vm.x=0,vm.y=0,vm.z=0;return vm}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=Xh(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,_=zu(d,u,h),y=Vu(d,g),b=Fu(h),x=ju(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&&nm.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}const ym=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 bm{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(bm.IsGradientStr(t))try{const e=ym(t)[0];if(e){if("linear"===e.type)return bm.ParseLinear(e);if("radial"===e.type)return bm.ParseRadial(e);if("conic"===e.type)return bm.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 xm(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 Sm(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 Am=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},km=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mm=function(t,e){return function(i,s){e(i,s,t)}};class Tm{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=Xh(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=Eh.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),Eh.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 wm=new Tm;let Cm=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)}))}};Cm=Am([Oa(),Mm(0,Ra(qa)),Mm(0,Ia(rp)),km("design:paramtypes",[Object])],Cm);class Em{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=Eh.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])),Eh.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 Pm=new Em;const Bm=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=xm(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T+r,innerRadius:M-r,startAngle:_-a,endAngle:y+a}),e.beginPath(),Uu(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=xm(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T-r,innerRadius:M+r,startAngle:_+a,endAngle:y-a}),e.beginPath(),Uu(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})}},Rm=Pm,Lm=wm;const Om=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=xm(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=xm(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()}}}},Im=Pm,Dm=wm;const Fm=new class extends Tm{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()}},jm=Et/2;function zm(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],-jm,0,!1)}if(t.lineTo(_[0],_[1]),!q(v,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,jm,!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],jm,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+jm,!1)}return t.closePath(),t}var Hm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Vm{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=xm(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(),zm(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=xm(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(),zm(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 Nm=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)}};Nm=Hm([Oa()],Nm);let Gm=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()}}};Gm=Hm([Oa()],Gm);const Wm=new Vm,Um=Pm,Ym=wm;const Km=new class extends Vm{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)}},Xm=new class extends Tm{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=Xh(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=wc(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?zm(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 $m=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=xm(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=xm(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=Pm,Zm=wm;var Jm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},tf=function(t,e){return function(i,s){e(i,s,t)}};let ef=class extends _m{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=nu,this.builtinContributions=[Bm,Lm,Rm],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||T>Ct)&&(O=n*It(y),I=n*jt(y),D=r*It(x),F=r*jt(x),uCt){const t=Ft(S,C),r=Ft(A,C),a=Wu(D,F,P,B,n,t,Number(p)),o=Wu(O,I,R,L,n,r,Number(p));if(C0&&e.arc(i+o.cx,s+o.cy,r,Ot(o.y11,o.x11),Ot(o.y01,o.x01),!p)}}else e.moveTo(i+P,s+B);if(!(r>Ct)||v<.001)e.lineTo(i+R,s+L),g=!0;else if(E>Ct){const t=Ft(M,E),n=Ft(k,E),a=Wu(R,L,O,I,r,-n,Number(p)),o=Wu(P,B,D,F,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),E0&&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(x),s+r*jt(x));return g}drawShape(t,e,i,s,n,r,a,o){const l=Xh(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++)Mc[s]=t,i&&(i=!(null!==(e=Mc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Mc[e]=!!t[e],i&&(i=!!Mc[e]);else Mc[0]=!1,Mc[1]=!1,Mc[2]=!1,Mc[3]=!1;return{isFullStroke:i,stroke:Mc}})(d);if((v||C)&&(e.beginPath(),Uu(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(),Uu(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),dd(o.color,l.color,h,!1)}(0,0,h,n);a||zu&&(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=Xh(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}};ef=Jm([Oa(),tf(0,Ra(qa)),tf(0,Ia($u)),Qm("design:paramtypes",[Object])],ef);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 _m{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=ou,this.builtinContributions=[Om,Dm,Im],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Xh(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=Xh(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function of(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 lf(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),of(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 cf=class extends _m{constructor(){super(...arguments),this.numberType=du}draw(t,e,i,s){const n=Xh(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;lf(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(),lf(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"===f)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=hl(t.points,f,{startPoint:e});return s=n,n})).filter((t=>!!t)),"linearClosed"===f){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===v){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],v,_,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=v*r;let g=0,m=!1;t.cache.forEach(((r,f)=>{if(m)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(m=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[f],[l,t.attribute],Ft(y,1),_,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,v,_,i,s,t,a,o)}};function df(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 uf(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),of(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),of(t,l,1,s),o=!1):o=!0}t.closePath()}cf=hf([Oa()],cf);const pf=new class extends Em{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:Oc(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Oc(l,"textureColor")),textureSize:b=(null!==(m=t.attribute.textureSize)&&void 0!==m?m:Oc(l,"textureSize")),texturePadding:x=(null!==(f=t.attribute.texturePadding)&&void 0!==f?f:Oc(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},gf=wm;var mf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ff=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)}};function _f(t,e,i){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"linearClosed":return ll(t,i)}}let yf=class extends _m{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=au,this.builtinContributions=[pf,gf],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=Xh(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}=t.attribute,b=this.valid(t,g,a,o);if(!b)return;const{doFill:x,doStroke:S}=b,{clipRange:A=g.clipRange,closePath:k,points:M,segments:T}=t.attribute;let{curveType:w=g.curveType}=t.attribute;if(k&&"linear"===w&&(w="linearClosed"),1===A&&!T&&!M.some((t=>!1===t.defined))&&"linear"===w)return this.drawLinearAreaHighPerformance(t,e,!!m,S,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(T&&T.length){let e,i;const s=T.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=_f(t.points,w,{startPoint:e});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=T.length-1;t>=0;t--){const e=T[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=T[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=_f(i,"stepBefore"===w?"stepAfter":"stepAfter"===w?"stepBefore":w),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!M||!M.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=M,i=[];for(let t=M.length-1;t>=0;t--)i.push({x:null!==(u=M[t].x1)&&void 0!==u?u:M[t].x,y:null!==(p=M[t].y1)&&void 0!==p?p:M[t].y});const s=_f(e,w),n=_f(i,"stepBefore"===w?"stepAfter":"stepAfter"===w?"stepBefore":w);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===A){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,x,v,S,y,r[c],[g,t.attribute],A,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=A*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,x,v,S,y,r[u],[g,t.attribute],Ft(m,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,x,v,S,y,t.attribute,g,A,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Xh(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=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),df(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),df(t,e,i,s),e.length=0,i.length=0)}n=o})),df(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},Af=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kf=function(t,e){return function(i,s){e(i,s,t)}};let Mf=class extends _m{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=uu,this.builtinContributions=[xf,bf],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:Xh(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=Xh(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Mf=Sf([Oa(),kf(0,Ra(qa)),kf(0,Ia(tp)),Af("design:paramtypes",[Object])],Mf);var Tf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 _m{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=gu,this.builtinContributions=[Wm,Ym,Um],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Xh(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=Hu(g,m,k,M,c),w=Nu(g,v,k,M),C=Fu(c,d),E=ju(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(),zm(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=Xh(t,null==s?void 0:s.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Ef=Tf([Oa(),Cf(0,Ra(qa)),Cf(0,Ia(ip)),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 _m{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=fu,this.builtinContributions=[$m,Zm,qm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=Xh(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=Xh(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Lf=Pf([Oa(),Rf(0,Ra(qa)),Rf(0,Ia(sp)),Bf("design:paramtypes",[Object])],Lf);const Of=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 If=new class extends Tm{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=Of.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=fm(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?(zm(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&&Of.free(C),w()}};var Df=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ff=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jf=function(t,e){return function(i,s){e(i,s,t)}};let zf=class extends _m{constructor(t){super(),this.textRenderContribitions=t,this.numberType=vu,this.builtinContributions=[If],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Xh(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=Fc(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=sm.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),sm.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=Xh(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=cp(l,f),_=dp(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=dp("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 Hf(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},Yf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kf=function(t,e){return function(i,s){e(i,s,t)}};let Xf=class extends _m{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=pu,this.builtinContributions=[Wf,Gf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Xh(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))?Hf(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 Hf(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=Vf(d,u),b=Vf(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*f);const S=Nf(h,_,y,d,u),A=Nf(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Vf(k,M),w=Nf(h,Vf(_,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=Xh(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Xf=Uf([Oa(),Kf(0,Ra(qa)),Kf(0,Ia(ep)),Yf("design:paramtypes",[Object])],Xf);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},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)}};const Jf=["","repeat-x","repeat-y","repeat"];let Qf=class extends _m{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=cu,this.builtinContributions=[Km,Xm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Xh(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(),zm(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,Jf[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 Cd.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Xh(t).image;this._draw(t,a,!1,i)}};Qf=$f([Oa(),Zf(0,Ra(qa)),Zf(0,Ia(Qu)),qf("design:paramtypes",[Object])],Qf);const tv=Symbol.for("IncrementalDrawContribution"),ev=Symbol.for("ArcRender"),iv=Symbol.for("AreaRender"),sv=Symbol.for("CircleRender"),nv=Symbol.for("GraphicRender"),rv=Symbol.for("GroupRender"),av=Symbol.for("LineRender"),ov=Symbol.for("PathRender"),lv=Symbol.for("PolygonRender"),hv=Symbol.for("RectRender"),cv=Symbol.for("SymbolRender"),dv=Symbol.for("TextRender"),uv=Symbol.for("RichTextRender"),pv=Symbol.for("GlyphRender"),gv=Symbol.for("ImageRender"),mv=Symbol.for("DrawContribution");var fv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)};const _v=Symbol.for("DrawItemInterceptor"),yv=new Qt,bv=new Qt;class xv{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return t.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){yv.copy(s.dirtyBounds),bv.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(yv),s.backupDirtyBounds.copy(bv)),!0}}class Sv{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 Av=class{constructor(){this.order=1,this.interceptors=[new xv,new Mv,new kv,new Sv]}afterDrawItem(t,e,i,s,n){for(let r=0;r(e=t.numberType===ru,!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&&nm.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Tv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},Cv=function(t,e){return function(i,s){e(i,s,t)}};const Ev=Symbol.for("RenderService");let Pv=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}};Pv=Tv([Oa(),Cv(0,Ra(mv)),wv("design:paramtypes",[Object])],Pv);var Bv=new xa((t=>{t(Ev).to(Pv)}));const Rv=Symbol.for("PickerService"),Lv=Symbol.for("GlobalPickerService");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};const Iv=Symbol.for("PickItemInterceptor");let Dv=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){if(!t.shadowRoot)return null;const{parentMatrix:r}=n||{};if(!r)return null;const a=e.pickContext;a.highPerformanceSave();const o=t.shadowRoot,l=sm.allocateByObj(r),h=new $t(l.a*i.x+l.c*i.y+l.e,l.b*i.x+l.d*i.y+l.f),c=e.pickGroup(o,h,l,s);return a.highPerformanceRestore(),c}};Dv=Ov([Oa()],Dv);let Fv=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}};Fv=Ov([Oa()],Fv);let jv=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===ru,!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()}};jv=Ov([Oa()],jv);var zv=new xa(((t,e,i)=>{i(Rv)||(t(Lv).toSelf(),t(Rv).toService(Lv)),t(jv).toSelf().inSingletonScope(),t(Iv).toService(jv),t(Dv).toSelf().inSingletonScope(),t(Iv).toService(Dv),t(Fv).toSelf().inSingletonScope(),t(Iv).toService(Fv),Ja(t,Iv)})),Hv=new xa((t=>{t(_u).to(um).inSingletonScope(),t(yu).toConstantValue(pm)}));const Vv=Symbol.for("AutoEnablePlugins"),Nv=Symbol.for("PluginService");var Gv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},Uv=function(t,e){return function(i,s){e(i,s,t)}};let Yv=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(Vv)&&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=[]}};Yv=Gv([Oa(),Uv(0,Ra(qa)),Uv(0,Ia(Vv)),Wv("design:paramtypes",[Object])],Yv);var Kv=new xa((t=>{t(Nv).to(Yv),function(t,e){t(qa).toDynamicValue((t=>{let{container:i}=t;return new Za(e,i)})).whenTargetNamed(e)}(t,Vv)})),Xv=new xa((t=>{Ja(t,eo)})),$v=new xa((t=>{t(Xl).to($l).inSingletonScope(),Ja(t,Xl)})),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)};let Jv=class{constructor(){this.type="static",this.offscreen=!1,this.global=Il.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=Ql({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()}};Jv=qv([Oa(),Zv("design:paramtypes",[])],Jv);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},t_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let e_=class{constructor(){this.offscreen=!1,this.type="virtual",this.global=Il.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(){}};e_=Qv([Oa(),t_("design:paramtypes",[])],e_);var i_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},s_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let n_=class{constructor(){this.offscreen=!0,this.type="dynamic",this.global=Il.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;const s=Ql({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){}};n_=i_([Oa(),s_("design:paramtypes",[])],n_);var r_=new xa((t=>{t(Jv).toSelf(),t(n_).toSelf(),t(e_).toSelf(),t(Eu).toService(Jv),t(Pu).toService(n_),t(Bu).toService(e_)}));var a_=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 o_(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 a_(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,s)}))}function h_(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 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)},u_=function(t,e){return function(i,s){e(i,s,t)}};let p_=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=Il.global,this.layerService=Il.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:bl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:bl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,sm.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=h_(e,i,bl.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=Of.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=sm.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))})):o_(t,bl.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),Of.free(n),sm.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(tv);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},m_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},f_=function(t,e){return function(i,s){e(i,s,t)}};let v_=class{constructor(t){this.groupRenderContribitions=t,this.numberType=hu}drawShape(t,e,i,s,n,r,a,o){const l=Xh(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=Hu(u,f,p,g,h),k=Nu(u,v,p,g),M=Fu(h,c),T=ju(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(),zm(e,i,s,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Fm));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=Xh(t,null==s?void 0:s.theme).group,l=n.modelMatrix;if(n.camera){const e=nm.allocate(),i=nm.allocate();dm(i,t,o),cm(e,l||e,i),n.modelMatrix=e,nm.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&&nm.free(n.modelMatrix),n.modelMatrix=l,n.baseGlobalAlpha/=a,d&&d.then?d.then((()=>{r?n.restore():n.highPerformanceRestore()})):r?n.restore():n.highPerformanceRestore()}};v_=g_([Oa(),f_(0,Ra(qa)),f_(0,Ia(Ju)),m_("design:paramtypes",[Object])],v_);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};let y_=class extends cf{constructor(){super(...arguments),this.numberType=du}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=Xh(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=zu(u,p,c),_=Vu(u,g),y=Fu(c),b=ju(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())}};y_=__([Oa()],y_);var b_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 x_=class extends yf{constructor(){super(...arguments),this.numberType=au}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=Xh(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=zu(u,d,c),m=Fu(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())}};x_=b_([Oa()],x_);var S_,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},k_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},M_=function(t,e){return function(i,s){e(i,s,t)}},T_=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"}(S_||(S_={}));let w_=class extends p_{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=S_.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 T_(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:bl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:bl.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 T_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return T_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>T_(this,void 0,void 0,(function*(){if(2!==t.count)yield l_(t,bl.zIndex,((i,s)=>{if(this.status===S_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return T_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return T_(this,void 0,void 0,(function*(){this.rendering&&(this.status=S_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=S_.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 T_(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:()=>T_(this,void 0,void 0,(function*(){yield l_(t,bl.zIndex,(t=>T_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};w_=A_([Oa(),M_(0,La(nv)),M_(1,Ra(y_)),M_(2,Ra(x_)),M_(3,Ra(qa)),M_(3,Ia(_v)),k_("design:paramtypes",[Array,Object,Object,Object])],w_);var C_=new xa((t=>{t(Tm).toSelf().inSingletonScope(),t(Em).toSelf().inSingletonScope(),t(mv).to(p_),t(tv).to(w_),t(rv).to(v_).inSingletonScope(),t(nv).toService(rv),Ja(t,Ju),t(Cm).toSelf().inSingletonScope(),Ja(t,rp),Ja(t,nv),t(Av).toSelf().inSingletonScope(),t(_v).toService(Av),Ja(t,_v)}));function E_(){E_.__loaded||(E_.__loaded=!0,ql.load(Du),ql.load(Hv),ql.load(Bv),ql.load(zv),ql.load(Kv),function(t){t.load(Xv),t.load($v),t.load(r_)}(ql),function(t){t.load(C_)}(ql))}E_.__loaded=!1,E_();const P_=ql.get(io);Il.global=P_;const B_=ql.get(wu);Il.graphicUtil=B_;const R_=ql.get(Tu);Il.transformUtil=R_;const L_=ql.get(_u);Il.graphicService=L_;const O_=ql.get(Cu);Il.layerService=O_;class I_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Il.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),Il.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){Il.graphicService.hooks.onAttributeUpdate.taps=Il.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onSetStage.taps=Il.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class D_{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 F_{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,Il.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))})),Il.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){Il.graphicService.hooks.onAddIncremental.taps=Il.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onClearIncremental.taps=Il.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Il.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 j_{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)),Il.graphicService.hooks.onRemove.unTap(this.key),Il.graphicService.hooks.onRelease.unTap(this.key),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?Il.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:Il.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return function(t){const e={};return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[ni(i)]=t[i])})),["fontSize","lineHeight"].forEach((i=>{const s=ni(i);u(t[i])||(e[s]=/^[0-9]*$/.test(`${t[i]}`)?`${t[i]}px`:`${t[i]}`)})),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:Xh(t).text)}getTransformOfText(t){const e=Xh(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=Il.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),f=o+m.left-p.left,v=l+m.top-p.top;if(a.left=`${f}px`,a.top=`${v}px`,"text"===t.type&&"position"===c&&(a=Object.assign(Object.assign({},a),this.getTransformOfText(t))),d(n.style)){const e=n.style({top:v,left:f,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)));Il.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"===Il.global.env&&(t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:bl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:bl.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&&Il.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"===Il.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 z_=new Qt;class H_{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()})),Il.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&&(z_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(z_,t.parent&&t.parent.globalTransMatrix)))})),Il.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))})),Il.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){Il.graphicService.hooks.beforeUpdateAABBBounds.taps=Il.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.afterUpdateAABBBounds.taps=Il.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)),Il.graphicService.hooks.onRemove.taps=Il.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const V_=new Qt;class N_{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=Xh(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,Il.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),Il.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&V_.copy(s)})),Il.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(V_.equals(i)||this.tryLayout(t,!1))})),Il.graphicService.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1)}))}deactivate(t){Il.graphicService.hooks.onAttributeUpdate.taps=Il.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.beforeUpdateAABBBounds.taps=Il.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.afterUpdateAABBBounds.taps=Il.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onSetStage.taps=Il.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const G_=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===dc.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=dc.INITIAL,Il.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),Il.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:cc},{mode:"timeout",cons:hc},{mode:"manual",cons:lc}];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!==dc.INITIAL&&(this.status=dc.PAUSE,!0)}resume(){return this.status!==dc.INITIAL&&(this.status=dc.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===dc.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===dc.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=dc.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=dc.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};G_.addTimeline(gc),G_.setFPS(60);class W_{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=hd.Get(e,ld.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)?hd.Get(e,ld.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}function U_(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 Y_(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 K_{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=nm.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=nm.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()})),i&&Il.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))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])this.htmlMap[o].root.render(r);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t){const i=n.createRoot(t);i.render(r),this.htmlMap||(this.htmlMap={}),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}}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 Z_="white";class J_ extends Au{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:Z_}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 Yh,this.hooks={beforeRender:new to(["stage"]),afterRender:new to(["stage"])},this.global=Il.global,!this.global.env&&$_()&&this.global.setEnv("browser"),this.window=ql.get(Rh),this.renderService=ql.get(Ev),this.pluginService=ql.get(Nv),this.layerService=ql.get(Cu),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:Z_,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||G_,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new pc,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 oc(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 W_(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 K_(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 D_))}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 I_))}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 F_))}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 H_,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 N_))}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 j_))}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){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(){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){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(){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];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];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){this.pickerService||(this.pickerService=ql.get(Rv));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){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){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;const e=ql.get(Rh),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;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 Q_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ty=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ey=new oe(1,0,0,1,0,0),iy={x:0,y:0};let sy=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 cl,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 sm.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(sm.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(sm.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},iy),function(t,e,i){return Ch(t,0,!1,e,i)}(this.path.commandList,iy.x,iy.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},iy);const i=xm(this,this.lineWidth,this.dpr);return function(t,e,i,s){return Ch(t,e,!0,i,s)}(this.path.commandList,i,iy.x,iy.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(ey,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=>sm.free(t))),this.stack.length=0}};sy=Q_([Oa(),ty("design:paramtypes",[Object,Number])],sy);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},ry=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ay={WIDTH:500,HEIGHT:500,DPR:1};let oy=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=ay.WIDTH,height:n=ay.HEIGHT,dpr:r=ay.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)}};oy.env="browser",oy=ny([Oa(),ry("design:paramtypes",[Object])],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};let hy=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}}};hy=ly([Oa()],hy);var cy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let uy=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}};uy=cy([Oa(),dy("design:paramtypes",[])],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)},my=function(t,e){return function(i,s){e(i,s,t)}};let fy=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=Il.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=nm.allocate();if(hm(i,e),a){if(i){const t=nm.allocate();r.modelMatrix=cm(t,a,i),nm.free(i)}}else hm(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=Xh(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=Xh(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&&nm.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),sm.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function vy(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&&vy(t,e,a,s,n),n.push(t[a],t[a+1]),i-a>2&&vy(t,a,i,s,n))}function _y(t,e){const i=t.length-1,s=[t[0]];return vy(t,0,i,e,s),s.push(t[i]),s}fy=py([Oa(),my(0,Ra(qa)),my(0,Ia(Iv)),gy("design:paramtypes",[Object])],fy);let yy=!1;const by=new xa((t=>{yy||(yy=!0,t(ef).toSelf().inSingletonScope(),t(ev).to(ef).inSingletonScope(),t(nv).toService(ev),t($u).toService(Cm),Ja(t,$u))}));let xy=!1;const Sy=new xa((t=>{xy||(xy=!0,t(Ef).toSelf().inSingletonScope(),t(hv).to(Ef).inSingletonScope(),t(nv).toService(hv),t(Gm).toSelf(),t(Nm).toSelf(),t(ip).toService(Gm),t(ip).toService(Nm),t(ip).toService(Cm),Ja(t,ip))}));let Ay=!1;const ky=new xa((t=>{Ay||(Ay=!0,t(cf).toSelf().inSingletonScope(),t(y_).toSelf().inSingletonScope(),t(av).to(cf).inSingletonScope(),t(nv).toService(av))}));let My=!1;const Ty=new xa((t=>{My||(My=!0,t(yf).toSelf().inSingletonScope(),t(iv).to(yf).inSingletonScope(),t(nv).toService(iv),t(qu).toService(Cm),Ja(t,qu),t(x_).toSelf().inSingletonScope())}));let wy=!1;const Cy=new xa((t=>{wy||(wy=!0,t(Lf).toSelf().inSingletonScope(),t(cv).to(Lf).inSingletonScope(),t(nv).toService(cv),t(sp).toService(Cm),Ja(t,sp))}));let Ey=!1;const Py=new xa((t=>{Ey||(Ey=!0,t(af).toSelf().inSingletonScope(),t(sv).to(af).inSingletonScope(),t(nv).toService(sv),t(Zu).toService(Cm),Ja(t,Zu))}));let By=!1;const Ry=new xa((t=>{By||(By=!0,t(dv).to(zf).inSingletonScope(),t(nv).toService(dv),t(np).toService(Cm),Ja(t,np))}));let Ly=!1;const Oy=new xa((t=>{Ly||(Ly=!0,t(Mf).toSelf().inSingletonScope(),t(ov).to(Mf).inSingletonScope(),t(nv).toService(ov),t(tp).toService(Cm),Ja(t,tp))}));let Iy=!1;const Dy=new xa((t=>{Iy||(Iy=!0,t(lv).to(Xf).inSingletonScope(),t(nv).toService(lv),t(ep).toService(Cm),Ja(t,ep))}));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};let jy=class{constructor(){this.numberType=lu}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=Xh(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};jy=Fy([Oa()],jy);let zy=!1;const Hy=new xa((t=>{zy||(zy=!0,t(pv).to(jy).inSingletonScope(),t(nv).toService(pv))}));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},Ny=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Gy=class extends _m{constructor(){super(),this.numberType=mu,this.builtinContributions=[If],this.init()}drawShape(t,e,i,s,n){const r=Xh(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=zu(o,l,!0),d=zu(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=Xh(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(),zm(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=Xh(t).richtext;this._draw(t,s,!1,i)}};Gy=Vy([Oa(),Ny("design:paramtypes",[])],Gy);let Wy=!1;const Uy=new xa((t=>{Wy||(Wy=!0,t(uv).to(Gy).inSingletonScope(),t(nv).toService(uv))}));let Yy=!1;const Ky=new xa((t=>{Yy||(Yy=!0,t(gv).to(Qf).inSingletonScope(),t(nv).toService(gv),t(Qu).toService(Cm),Ja(t,Qu))}));const Xy=(t,e)=>(d(qy.warnHandler)&&qy.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),$y=(t,e,i)=>{if(!d(qy.errorHandler))throw new Error(t);qy.errorHandler.call(null,t,e)},qy={silent:!1,warnHandler:!1,errorHandler:!1},Zy=$_(),Jy=Zy&&globalThis?globalThis.document:void 0;function Qy(t){return("desktop-browser"===t||"mobile-browser"===t)&&Zy}function tb(t){return eb(t)||"mobile-browser"===t}function eb(t){return t.includes("miniApp")||"lynx"===t||"wx"===t}let ib=0;function sb(){return ib>=9999999&&(ib=0),ib++}function nb(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function rb(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const ab=(t,e,i)=>(t.fields=e||[],t.fname=i,t),ob=t=>e=>R(e,t),lb=t=>{at.getInstance().error(t)},hb=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||lb("Access path missing open bracket: "+t),o>0&&h(),o=0,s=n+1):n>s?h():s=n+1}return o&&lb("Access path missing closing bracket: "+t),a&&lb("Access path missing closing quote: "+t),n>s&&(n+=1,h()),e})(t),n=1===s.length?s[0]:t;return ab((i&&i.get||ob)(s),[n],e||n)},cb=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(y(t)){const s=t.map((t=>hb(t,e,i)));return t=>s.map((e=>e(t)))}return hb(t,e,i)};cb("id");const db=ab((function(t){return t}),[],"identity"),ub=ab((function(){return 0}),[],"zero");ab((function(){return 1}),[],"one"),ab((function(){return!0}),[],"true"),ab((function(){return!1}),[],"false"),ab((function(){return{}}),[],"emptyObject");const pb=(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=>gb(t,r,n)))))},mb=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t;function fb(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 vb(t,e,i,s,n){let r=0,a=0;return fb(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function _b(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;fb(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:vb(t,e,i,n,h)}}function yb(t){return"horizontal"===t}function bb(t){return"vertical"===t}const xb=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Sb extends Au{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,xb.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=>xb.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"},Zb=(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 Jb 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=ic.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=ic.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=Zb(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=ic.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=Zb(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=ic.now()-i>this.config.press.time&&Zb(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},tx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ex=[0,0,0];let ix=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({},gl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},fl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},vl),{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 sm.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&&(sm.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(sm.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&&Xu.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&&(Y_(ex,[t,e,i],this.modelMatrix),t=ex[0],e=ex[1],i=ex[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&&(Y_(ex,[t,e,i],this.modelMatrix),t=ex[0],e=ex[1],i=ex[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Y_(ex,[e,i,s],this.modelMatrix),e=ex[0],i=ex[1],s=ex[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]:Il.global.measureTextMethod;var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Il.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:vl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:vl.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&&(Y_(ex,[e,i,s],this.modelMatrix),e=ex[0],i=ex[1],s=ex[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=Sm(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=xm(this,l,this.dpr),r.strokeStyle=Sm(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=hp(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=hp(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=>sm.free(t))),this.stack.length=0}};ix.env="browser",ix=Qb([Oa(),tx("design:paramtypes",[Object,Number])],ix);var 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},nx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let rx=class extends oy{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Il.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new ix(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 ax(t,e){return new xa((i=>{i(Zl).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Jl).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}rx.env="browser",rx=sx([Oa(),nx("design:paramtypes",[Object])],rx);const ox=ax(rx,ix);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},hx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cx=function(t,e){return function(i,s){e(i,s,t)}};let dx=class extends fy{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=Eh.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 px=class{constructor(){this.type="group",this.numberType=hu}contains(t,e,i){return!1}};px=ux([Oa()],px);const gx=new xa(((t,e,i,s)=>{gx.__vloaded||(gx.__vloaded=!0,t(Kb).to(px).inSingletonScope(),t(Xb).toService(Kb),Ja(t,Xb))}));gx.__vloaded=!1;var mx=gx;const fx=new xa(((t,e,i,s)=>{i(dx)||t(dx).toSelf().inSingletonScope(),i(Rv)?s(Rv).toService(dx):t(Rv).toService(dx)}));var vx,_x=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let bx=vx=class extends uy{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${vx.idprefix}_${vx.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Il.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:vx.GenerateCanvasId(),canvasControled:!0};this.canvas=new rx(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 rx({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)}};bx.env="browser",bx.idprefix="visactor_window",bx.prefix_count=0,bx=vx=_x([Oa(),yx("design:paramtypes",[])],bx);const xx=new xa((t=>{t(bx).toSelf(),t(Lh).toDynamicValue((t=>t.container.get(bx))).whenTargetNamed(bx.env)}));var 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)};class kx{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 Mx(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 Tx=class extends hy{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 kx(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 Mx(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Mx(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}}};Tx=Sx([Oa(),Ax("design:paramtypes",[])],Tx);const wx=new xa((t=>{wx.isBrowserBound||(wx.isBrowserBound=!0,t(Tx).toSelf().inSingletonScope(),t(eo).toService(Tx))}));function Cx(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Cx.__loaded||(Cx.__loaded=!0,t.load(wx),t.load(ox),t.load(xx),e&&function(t){t.load(mx),t.load(fx)}(t))}wx.isBrowserBound=!1,Cx.__loaded=!1;var Ex=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Px=class extends ix{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}};Px.env="feishu",Px=Ex([Oa()],Px);var Bx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Rx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Lx=class extends oy{constructor(t){super(t)}init(){this._context=new Px(this,this._dpr)}release(){}};Lx.env="feishu",Lx=Bx([Oa(),Rx("design:paramtypes",[Object])],Lx);const Ox=ax(Lx,Px);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)},Fx=function(t,e){return function(i,s){e(i,s,t)}};class jx{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 zx=class extends uy{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new jx}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 Lx(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 Lx({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()}};zx.env="feishu",zx=Ix([Oa(),Fx(0,Ra(io)),Dx("design:paramtypes",[Object])],zx);const Hx=new xa((t=>{t(zx).toSelf(),t(Lh).toDynamicValue((t=>t.container.get(zx))).whenTargetNamed(zx.env)}));var Vx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Gx=function(t,e){return function(i,s){e(i,s,t)}};let Wx=class extends fy{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 sy(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}};Wx=Vx([Oa(),Gx(0,Ra(qa)),Gx(0,Ia(Ab)),Gx(1,Ra(qa)),Gx(1,Ia(Iv)),Nx("design:paramtypes",[Object,Object])],Wx);const Ux=new xa((t=>{Ux.__vloaded||(Ux.__vloaded=!0,Ja(t,Ab))}));Ux.__vloaded=!1;var Yx=Ux,Kx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$x=function(t,e){return function(i,s){e(i,s,t)}};let qx=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=nu}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=Xh(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}};qx=Kx([Oa(),$x(0,Ra(ev)),Xx("design:paramtypes",[Object])],qx);let Zx=!1;const Jx=new xa(((t,e,i,s)=>{Zx||(Zx=!0,t(kb).to(qx).inSingletonScope(),t(Ab).toService(kb))}));var Qx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},eS=function(t,e){return function(i,s){e(i,s,t)}};let iS=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=au}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=Xh(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}};iS=Qx([Oa(),eS(0,Ra(iv)),tS("design:paramtypes",[Object])],iS);let sS=!1;const nS=new xa(((t,e,i,s)=>{sS||(sS=!0,t(Mb).to(iS).inSingletonScope(),t(Ab).toService(Mb))}));var rS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oS=function(t,e){return function(i,s){e(i,s,t)}};let lS=class{constructor(t){this.canvasRenderer=t,this.type="circle",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=Xh(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}};lS=rS([Oa(),oS(0,Ra(sv)),aS("design:paramtypes",[Object])],lS);let hS=!1;const cS=new xa(((t,e,i,s)=>{hS||(hS=!0,t(Tb).to(lS).inSingletonScope(),t(Ab).toService(Tb))}));var dS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pS=function(t,e){return function(i,s){e(i,s,t)}};let gS=class{constructor(t){this.canvasRenderer=t,this.type="glyph",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=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}};gS=dS([Oa(),pS(0,Ra(pv)),uS("design:paramtypes",[Object])],gS);let mS=!1;const fS=new xa(((t,e,i,s)=>{mS||(mS=!0,t(Ob).to(gS).inSingletonScope(),t(gS).toService(Ob))}));var vS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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{constructor(){this.type="image",this.numberType=cu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};_S=vS([Oa()],_S);let yS=!1;const bS=new xa(((t,e,i,s)=>{yS||(yS=!0,t(wb).to(_S).inSingletonScope(),t(_S).toService(wb))}));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},SS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},AS=function(t,e){return function(i,s){e(i,s,t)}};let kS=class{constructor(t){this.canvasRenderer=t,this.type="line",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=Xh(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}};kS=xS([Oa(),AS(0,Ra(av)),SS("design:paramtypes",[Object])],kS);let MS=!1;const TS=new xa(((t,e,i,s)=>{MS||(MS=!0,t(Cb).to(kS).inSingletonScope(),t(Ab).toService(Cb))}));var wS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ES=function(t,e){return function(i,s){e(i,s,t)}};let PS=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=pu}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=Xh(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}};PS=wS([Oa(),ES(0,Ra(lv)),CS("design:paramtypes",[Object])],PS);let BS=!1;const RS=new xa(((t,e,i,s)=>{BS||(BS=!0,t(Lb).to(PS).inSingletonScope(),t(Ab).toService(Lb))}));var LS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},OS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IS=function(t,e){return function(i,s){e(i,s,t)}};let DS=class{constructor(t){this.canvasRenderer=t,this.type="path",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=Xh(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}};DS=LS([Oa(),IS(0,Ra(ov)),OS("design:paramtypes",[Object])],DS);let FS=!1;const jS=new xa(((t,e,i,s)=>{FS||(FS=!0,t(Eb).to(DS).inSingletonScope(),t(Ab).toService(Eb))}));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},HS=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)}};const NS=new Qt;let GS=class{constructor(t){this.canvasRenderer=t,this.type="rect",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=Xh(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;NS.setValue(i.x1,i.y1,i.x2,i.y2),NS.expand(-r/2),h=!NS.containsPoint(e)}}return s.highPerformanceRestore(),h}};GS=zS([Oa(),VS(0,Ra(hv)),HS("design:paramtypes",[Object])],GS);let WS=!1;const US=new xa(((t,e,i,s)=>{WS||(WS=!0,t(Pb).to(GS).inSingletonScope(),t(Ab).toService(Pb))}));let YS=!1;const KS=new xa(((t,e,i,s)=>{YS||(YS=!0,t(wb).to(_S).inSingletonScope(),t(_S).toService(wb))}));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},$S=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qS=function(t,e){return function(i,s){e(i,s,t)}};let ZS=class{constructor(t){this.canvasRenderer=t,this.type="symbol",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=Xh(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}};ZS=XS([Oa(),qS(0,Ra(cv)),$S("design:paramtypes",[Object])],ZS);let JS=!1;const QS=new xa(((t,e,i,s)=>{JS||(JS=!0,t(Bb).to(ZS).inSingletonScope(),t(Ab).toService(Bb))}));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};let eA=class{constructor(){this.type="text",this.numberType=vu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};eA=tA([Oa()],eA);let iA=!1;const sA=new xa(((t,e,i,s)=>{iA||(iA=!0,t(Rb).to(eA).inSingletonScope(),t(Ab).toService(Rb))})),nA=new xa(((t,e,i,s)=>{i(Wx)||t(Wx).toSelf().inSingletonScope(),i(Rv)?s(Rv).toService(Wx):t(Rv).toService(Wx)}));class rA{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 aA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let lA=class extends hy{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 rA(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 Dc.call(t)}}getCancelAnimationFrame(){return t=>{Dc.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}};lA=aA([Oa(),oA("design:paramtypes",[])],lA);const hA=new xa((t=>{hA.isFeishuBound||(hA.isFeishuBound=!0,t(lA).toSelf().inSingletonScope(),t(eo).toService(lA))}));function cA(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];cA.__loaded||(cA.__loaded=!0,t.load(hA),t.load(Ox),t.load(Hx),e&&function(t){t.load(Yx),t.load(nA),t.load(Jx),t.load(nS),t.load(cS),t.load(fS),t.load(bS),t.load(TS),t.load(RS),t.load(jS),t.load(US),t.load(KS),t.load(QS),t.load(sA)}(t))}hA.isFeishuBound=!1,cA.__loaded=!1;var dA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let pA=class extends ix{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(){}};pA.env="node",pA=dA([Oa(),uA("design:paramtypes",[Object,Number])],pA);var gA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let fA=class extends oy{constructor(t){super(t)}init(){this._context=new pA(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};fA.env="node",fA=gA([Oa(),mA("design:paramtypes",[Object])],fA);const vA=ax(fA,pA);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)},bA=function(t,e){return function(i,s){e(i,s,t)}};let xA=class extends uy{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 fA(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 fA({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){}};xA.env="node",xA=_A([Oa(),bA(0,Ra(io)),yA("design:paramtypes",[Object])],xA);const SA=new xa((t=>{t(xA).toSelf(),t(Lh).toDynamicValue((t=>t.container.get(xA))).whenTargetNamed(xA.env)}));var AA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 kA=class extends hy{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 Dc.call(t)}}getCancelAnimationFrame(){return t=>{Dc.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};kA=AA([Oa()],kA);const MA=new xa((t=>{MA.isNodeBound||(MA.isNodeBound=!0,t(kA).toSelf().inSingletonScope(),t(eo).toService(kA))}));function TA(t){TA.__loaded||(TA.__loaded=!0,t.load(MA),t.load(vA),t.load(SA))}MA.isNodeBound=!1,TA.__loaded=!1;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},CA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},EA=function(t,e){return function(i,s){e(i,s,t)}};let PA=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=nu}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=Xh(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=xm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};PA=wA([Oa(),EA(0,Ra(ev)),CA("design:paramtypes",[Object])],PA);let BA=!1;const RA=new xa(((t,e,i,s)=>{BA||(BA=!0,t(Ib).to(PA).inSingletonScope(),t(Xb).toService(Ib))}));var LA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},OA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IA=function(t,e){return function(i,s){e(i,s,t)}};const DA=new Qt;let FA=class{constructor(t){this.canvasRenderer=t,this.type="rect",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=Xh(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=xm(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;DA.setValue(i.x1,i.y1,i.x2,i.y2),DA.expand(-r/2),h=!DA.containsPoint(e)}}return s.highPerformanceRestore(),h}};FA=LA([Oa(),IA(0,Ra(hv)),OA("design:paramtypes",[Object])],FA);let jA=!1;const zA=new xa(((t,e,i,s)=>{jA||(jA=!0,t(Vb).to(FA).inSingletonScope(),t(Xb).toService(Vb))}));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 VA=class extends _m{};VA=HA([Oa()],VA);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},GA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},WA=function(t,e){return function(i,s){e(i,s,t)}};let UA=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="line",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;s.highPerformanceSave();const n=Xh(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=xm(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&nm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};UA=NA([Oa(),WA(0,Ra(av)),GA("design:paramtypes",[Object])],UA);let YA=!1;const KA=new xa(((t,e,i,s)=>{YA||(YA=!0,t(zb).to(UA).inSingletonScope(),t(Xb).toService(zb))}));var XA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},qA=function(t,e){return function(i,s){e(i,s,t)}};let ZA=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=au}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=Xh(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=xm(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h})),s.highPerformanceRestore(),h}};ZA=XA([Oa(),qA(0,Ra(iv)),$A("design:paramtypes",[Object])],ZA);let JA=!1;const QA=new xa(((t,e,i,s)=>{JA||(JA=!0,t(Db).to(ZA).inSingletonScope(),t(Xb).toService(Db))}));var tk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ik=function(t,e){return function(i,s){e(i,s,t)}};let sk=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=fu}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=Xh(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=xm(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&nm.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};sk=tk([Oa(),ik(0,Ra(cv)),ek("design:paramtypes",[Object])],sk);let nk=!1;const rk=new xa(((t,e,i,s)=>{nk||(nk=!0,t(Nb).to(sk).inSingletonScope(),t(Xb).toService(Nb))}));var ak=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ok=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lk=function(t,e){return function(i,s){e(i,s,t)}};let hk=class{constructor(t){this.canvasRenderer=t,this.type="circle",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=Xh(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=xm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};hk=ak([Oa(),lk(0,Ra(sv)),ok("design:paramtypes",[Object])],hk);let ck=!1;const dk=new xa(((t,e,i,s)=>{ck||(ck=!0,t(Fb).to(hk).inSingletonScope(),t(Xb).toService(Fb))}));var uk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gk=function(t,e){return function(i,s){e(i,s,t)}};let mk=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=vu}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=Xh(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=dp(a,u,n),v=cp(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&&nm.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};mk=uk([Oa(),gk(0,Ra(dv)),pk("design:paramtypes",[Object])],mk);let fk=!1;const vk=new xa(((t,e,i,s)=>{fk||(fk=!0,t(Gb).to(mk).inSingletonScope(),t(Xb).toService(Gb))}));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},yk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bk=function(t,e){return function(i,s){e(i,s,t)}};let xk=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="path",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=Xh(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=xm(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&nm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};xk=_k([Oa(),bk(0,Ra(ov)),yk("design:paramtypes",[Object])],xk);let Sk=!1;const Ak=new xa(((t,e,i,s)=>{Sk||(Sk=!0,t(Hb).to(xk).inSingletonScope(),t(Xb).toService(Hb))}));var kk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mk=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 wk=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=pu}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=Xh(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=xm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};wk=kk([Oa(),Tk(0,Ra(lv)),Mk("design:paramtypes",[Object])],wk);let Ck=!1;const Ek=new xa(((t,e,i,s)=>{Ck||(Ck=!0,t(Wb).to(wk).inSingletonScope(),t(Xb).toService(Wb))}));var Pk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rk=function(t,e){return function(i,s){e(i,s,t)}};let Lk=class{constructor(t){this.canvasRenderer=t,this.type="glyph",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=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}};Lk=Pk([Oa(),Rk(0,Ra(pv)),Bk("design:paramtypes",[Object])],Lk);let Ok=!1;const Ik=new xa(((t,e,i,s)=>{Ok||(Ok=!0,t(Yb).to(Lk).inSingletonScope(),t(Xb).toService(Yb))}));var Dk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Fk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jk=function(t,e){return function(i,s){e(i,s,t)}};let zk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=mu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};zk=Dk([Oa(),jk(0,Ra(uv)),Fk("design:paramtypes",[Object])],zk);let Hk=!1;const Vk=new xa(((t,e,i,s)=>{Hk||(Hk=!0,t(Ub).to(zk).inSingletonScope(),t(Xb).toService(Ub))}));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};let Gk=class{constructor(){this.type="image",this.numberType=cu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Gk=Nk([Oa()],Gk);let Wk=!1;const Uk=new xa(((t,e,i,s)=>{Wk||(Wk=!0,t(jb).to(Gk).inSingletonScope(),t(Xb).toService(jb))})),Yk=$_();function Kk(){Kk.__loaded||(Kk.__loaded=!0,pm.RegisterGraphicCreator("arc",Xg),ql.load(by),ql.load(Yk?RA:Jx))}Kk.__loaded=!1;const Xk=Kk;function $k(){$k.__loaded||($k.__loaded=!0,pm.RegisterGraphicCreator("area",Ug),ql.load(Ty),ql.load(Yk?QA:nS))}$k.__loaded=!1;const qk=$k;function Zk(){Zk.__loaded||(Zk.__loaded=!0,pm.RegisterGraphicCreator("circle",lp),ql.load(Py),ql.load(Yk?dk:cS))}Zk.__loaded=!1;const Jk=Zk;function Qk(){Qk.__loaded||(Qk.__loaded=!0,pm.RegisterGraphicCreator("glyph",Cg),ql.load(Hy),ql.load(Yk?Ik:fS))}Qk.__loaded=!1;const tM=Qk;function eM(){eM.__loaded||(eM.__loaded=!0,pm.RegisterGraphicCreator("group",ku))}eM.__loaded=!1;const iM=eM;function sM(){sM.__loaded||(sM.__loaded=!0,pm.RegisterGraphicCreator("image",Lg),ql.load(Ky),ql.load(Yk?Uk:bS))}sM.__loaded=!1;const nM=sM;function rM(){rM.__loaded||(rM.__loaded=!0,pm.RegisterGraphicCreator("line",Ag),ql.load(ky),ql.load(Yk?KA:TS))}rM.__loaded=!1;const aM=rM;function oM(){oM.__loaded||(oM.__loaded=!0,pm.RegisterGraphicCreator("path",Ng),ql.load(Oy),ql.load(Yk?Ak:jS))}oM.__loaded=!1;const lM=oM;function hM(){hM.__loaded||(hM.__loaded=!0,pm.RegisterGraphicCreator("polygon",Zg),ql.load(Dy),ql.load(Yk?Ek:RS))}hM.__loaded=!1;const cM=hM;function dM(){dM.__loaded||(dM.__loaded=!0,pm.RegisterGraphicCreator("rect",Tg),ql.load(Sy),ql.load(Yk?zA:US))}dM.__loaded=!1;const uM=dM;function pM(){pM.__loaded||(pM.__loaded=!0,pm.RegisterGraphicCreator("richtext",zg),ql.load(Uy),ql.load(Yk?Vk:KS))}pM.__loaded=!1;const gM=pM;function mM(){mM.__loaded||(mM.__loaded=!0,pm.RegisterGraphicCreator("shadowRoot",Qg))}mM.__loaded=!1;const fM=mM;function vM(){vM.__loaded||(vM.__loaded=!0,pm.RegisterGraphicCreator("symbol",bg),ql.load(Cy),ql.load(Yk?rk:QS))}vM.__loaded=!1;const _M=vM;function yM(){yM.__loaded||(yM.__loaded=!0,pm.RegisterGraphicCreator("text",mp),ql.load(Ry),ql.load(Yk?vk:sA))}yM.__loaded=!1;const bM=yM;function xM(){iM(),uM()}const SM=-.5*Math.PI,AM=1.5*Math.PI,kM="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 MM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(MM||(MM={}));const TM={[MM.selectedReverse]:{},[MM.selected]:{},[MM.hover]:{},[MM.hoverReverse]:{}},wM={container:"",width:30,height:30,style:{}},CM={debounce:xt,throttle:St};xM();let EM=class t extends Sb{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"===P_.env?(P_.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),P_.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:CM[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"===P_.env?(P_.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),P_.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",CM[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 PM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&PM(t,e)}))}EM.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 BM=t=>!u(t)&&!1!==t.visible;function RM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function LM(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 IM=["#ffffff","#000000"];function DM(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 FM(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(...IM);for(const n of a)if(t!==n&&FM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function FM(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?jM(t,e)>s:"largeText"===i?jM(t,e)>3:jM(t,e)>4.5}function jM(t,e){const i=zM(t),s=zM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function zM(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 HM(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 VM(t,e){return[t[0]*e,t[1]*e]}function NM(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 GM=(t,e,i,s)=>new Qe(Object.assign({defaultFontParams:Object.assign({fontFamily:kM,fontSize:14},s),getTextBounds:i?void 0:fm,specialCharSet:"-/: .,@%'\"~"+Qe.ALPHABET_CHAR_SET+Qe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function WM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const s=fm({text:t,fontFamily:e.fontFamily||i.fontFamily||kM,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 UM(t){return"rich"===YM(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type")}function YM(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 KM(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 XM(t){const e=YM(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?pm.richtext(KM(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)),pm.text(t))}function $M(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 ZM(){iM(),uM(),_M(),gM(),bM()}var JM=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);nh&&(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,V=JM(a,["visible"]);if(m&&c(H)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},V),{visible:H&&!!s,x:I,y:D,width:k,height:M}),"rect");B(null==f?void 0:f.panel)||(t.states=f.panel),this._bgRect=t}}this._textShape=P}}QM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const tT={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}},eT={poptip:z({},tT)};var iT=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]]}}}}nT.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 rT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 aT=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,nT.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new nT(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,eT.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}))}};aT=rT([Oa()],aT);var oT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 lT=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)}};lT=oT([Oa()],lT);let hT=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)}};hT=oT([Oa()],hT);const cT=new xa(((t,e,i,s)=>{i(aT)||(t(aT).toSelf().inSingletonScope(),t(rp).toService(aT)),i(lT)||(t(lT).toSelf(),t(Vv).toService(lT)),i(hT)||(t(hT).toSelf(),t(Vv).toService(hT))}));class dT extends Sb{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}iM(),aM();class uT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},uT.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})}}uT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},iM(),uM();class pT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},pT.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})}}pT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},iM(),Xk();class gT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},gT.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)}}gT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},iM(),Xk();class mT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},mT.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=SM,endAngle:s=AM}=this.attribute,n=s-i,r=ee(ne(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}mT.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},iM(),lM();class fT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fT.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)}}fT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const vT=new Uint32Array(33),_T=new Uint32Array(33);_T[0]=0,vT[0]=~_T[0];for(let t=1;t<=32;++t)_T[t]=_T[t-1]<<1|1,vT[t]=~_T[t];function yT(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]&vT[31&l]&_T[1+(31&h)])return!0}else{if(i[c]&vT[31&l])return!0;if(i[d]&_T[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,vT[31&n]&_T[1+(31&r)]);else for(s(a,vT[31&n]),s(o,_T[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,_T[31&i]|vT[1+(31&s)]);else for(n(r,_T[31&i]),n(a,vT[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 bT(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 xT(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=bT(t,r),!(s&&e.outOfBounds(r)||e.getRange(r))}function ST(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 ST(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 ST(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 ST(t,e,n,s,h,c)}return!1}const kT=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],MT=["top","inside-top","inside"];function TT(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 wT={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 CT(t,e){var i,s;return null!==(s=null===(i=wT[e])||void 0===i?void 0:i.call(wT,t))&&void 0!==s?s:{from:{},to:{}}}const ET=(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 PT(t,e,i,s){t.attribute.text!==e.attribute.text&&k(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new jc({text:t.attribute.text},{text:e.attribute.text},i,s))}const BT={mode:"same-time",duration:300,easing:"linear"};function RT(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 LT(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 OT(t){return 3===t||4===t}function IT(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 DT=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)}},FT=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 jT(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 zT(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)}}iM(),bM(),gM(),aM();class HT extends Sb{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},HT.defaultAttributes,t)),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(MM.hover,!0),PM(this,(t=>{t===e||B(t.states)||t.addState(MM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(PM(this,(t=>{B(t.states)||(t.removeState(MM.hoverReverse),t.removeState(MM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void PM(this,(t=>{B(t.states)||(t.removeState(MM.selectedReverse),t.removeState(MM.selected))}));B(e.states)||(e.addState(MM.selected,!0),PM(this,(t=>{t===e||B(t.states)||t.addState(MM.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:[];(this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)]).forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(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[zT(g,m,c,d,a,o),zT(-g,-m,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds);if(i){const t=pm.line({points:i});return e&&e.attribute.fill&&t.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&t.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(t),t}}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)),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 XM(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&&y.setRange(bT(v,t.AABBBounds,!0))}))),m.length>0&&m.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&&y.setRange(bT(v,t.AABBBounds,!0))})):t.AABBBounds&&y.setRange(bT(v,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 i=new Map,s=this._graphicToText||new Map,n=[],r=[],{visible:a}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{const o=this.getRelatedGraphic(t.attribute),l=t.attribute.id,h=this._isCollectionBase?l:o,c=(null==s?void 0:s.get(h))?"update":"enter";let d;if(a&&(d=this._createLabelLine(t,o)),"enter"===c){if(n.push(t),i.set(h,d?{text:t,labelLine:d}:{text:t}),o){const{from:i,to:s}=CT(t.attribute,"fadeIn");this.add(t),d&&(r.push(d),this.add(d)),this._syncStateWithRelatedGraphic(o),this._animationConfig.enter.duration>0&&o.once("animate-bind",(a=>{t.setAttributes(i),d&&d.setAttributes(i);const l=this._afterRelatedGraphicAttributeUpdate(t,n,d,r,e,o,s,this._animationConfig.enter);o.on("afterAttributeUpdate",l)}))}}else if("update"===c){const e=s.get(h);s.delete(h),i.set(h,e);const n=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&&PT(t,e,s,n))}i.forEach(((i,s)=>{const{duration:n,easing:r,increaseEffect:a=!0,channel:o}=i,{from:l,to:h}=ET(t,e,o,i.options);B(h)||t.animate().to(h,n,r),"text"in l&&"text"in h&&a&&PT(t,e,n,r)}))})(n,t,this._animationConfig.update),e.labelLine&&d&&e.labelLine.animate().to(d.attribute,r,a)}})),s.forEach((t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(CT(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=i}_renderWithOutAnimation(t){var e;const i=new Map,s=this._graphicToText||new Map,{visible:n}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach((t=>{const e=this.getRelatedGraphic(t.attribute),r=(null==s?void 0:s.get(e))?"update":"enter",a=this._isCollectionBase?t.attribute.id:e;let o;if(n&&(o=this._createLabelLine(t,e)),"enter"===r)i.set(a,o?{text:t,labelLine:o}:{text:t}),this.add(t),o&&this.add(o),this._syncStateWithRelatedGraphic(e);else if("update"===r){const e=s.get(a);s.delete(a),i.set(a,e),e.text.setAttributes(t.attribute),e.labelLine&&o&&e.labelLine.setAttributes(o.attribute)}})),s.forEach((t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)})),this._graphicToText=i}_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)}}VT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};class NT extends HT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},NT.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}}}NT.tag="rect-label",NT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};let GT=class t extends HT{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 jT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};GT.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class WT{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 UT extends HT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UT.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:"…"}),n=this._createLabelText(s),r=this.getGraphicBounds(n),a=r.x2-r.x1,o=e.map((t=>t.attribute)),l=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),o,i,a);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=LT(l.endAngle-d/2),p=RT(h.x,h.y,l.outerRadius,o),g=RT(h.x,h.y,a+e.line.line1MinLength,o),m=new WT(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);m.pointA=RT(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):OT(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=RT(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=OT(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=OT(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=OT(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?OT(t.quadrant)?"left":"right":OT(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*(OT(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;e1&&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 jT(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 extends HT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},KT.defaultAttributes,t)),this.name="line-data-label"}labeling(t,e){return DT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}KT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const XT={rect:NT,symbol:VT,arc:UT,line:GT,area:YT,"line-data":KT};class $T extends Sb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},$T.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=yT(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(){iM(),aM(),cM(),_M()}function ZT(){iM(),aM(),Xk(),_M()}$T.defaultAttributes={pickable:!1},qT();class JT extends Sb{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({},JT.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=pm.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=pm.line;Y(i)[0].cornerRadius&&(t=pm.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=pm.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}}JT.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}}},ZT();class QT extends JT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JT.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=pm.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 tw,ew;!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"}(tw||(tw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(ew||(ew={}));const iw={[ew.selectedReverse]:{},[ew.selected]:{},[ew.hover]:{},[ew.hoverReverse]:{}},sw={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}}},nw=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 rw(t,e,i){return!mt(t,e,0,1e-6)&&!gt(t,i,0,1e-6)}function aw(t,e,i,s){const n=fm(Object.assign({text:i},s)),r=n.width(),a=n.height(),o=nw(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=rw(o,-l,-h)?((o+l)/c-.5)*r:rw(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=rw(o,-l,-h)?.5*-a:rw(o,h,l)?.5*a:Math.cos(o)>=0?(.5-(h-o)/c)*a:(.5-nw(o-l)/c)*a,{x:p,y:g-m}}function ow(t){const e={};return PM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function lw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function hw(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 VM(r,(s?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}const cw=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!B(s.states)?(s.addState(MM.hover,!0),PM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(MM.hoverReverse,!0)})),s):i},dw=(t,e,i)=>i?(PM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(MM.hoverReverse),t.removeState(MM.hover))})),null):i,uw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(MM.selected)?(PM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(MM.selectedReverse),t.removeState(MM.selected))})),null):s.name&&!B(s.states)?(s.addState(MM.selected,!0),PM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(MM.selectedReverse,!0)})),s):i};class pw extends Sb{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=cw(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=dw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=uw(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=pm.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&&ow(this._innerView),this.removeAllChild(!0),this._innerView=pm.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=pm.group({x:0,y:0,zIndex:1});if(a.name=tw.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=pm.group({x:0,y:0,pickable:!1});t.name=tw.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=pm.group({x:0,y:0,pickable:!1});i.name=tw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=pm.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=tw.tick,r.id=this._getNodeId(t.id),B(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=TM;else{const t=this.data[s],e=z({},TM,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=pm.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=tw.subTick,r.id=this._getNodeId(`${n}`),B(s.state))r.states=TM;else{const i=z({},TM,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=pm.group({x:0,y:0,pickable:!1});return r.name=`${tw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=XM(this._getLabelAttribute(t,e,n,i));if(a.name=tw.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=TM;else{const s=z({},TM,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 QM(Object.assign({},e));i.name=tw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return lw(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({},sw.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 gw(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 mw(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 fw={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&&vw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function vw(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 _w(t,e){for(let i,s=1,n=t.length,r=t[0];s1&&e.height()>1}function bw(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Aw(t,e.attribute.angle)),{angle:Sw(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({},kw(t,e.attribute.angle)),{angle:Sw(e.attribute.angle)}))}))}(t,e),gw(e)}function Sw(){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 Aw(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=Sw(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 kw(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=Sw(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 Mw{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 VM([s[1],-1*s[0]],t*(e?1:-1)*i)}}function Tw(){iM(),aM(),gM(),bM()}var ww=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=NM(_,[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({},iw,c.text),shape:z({},iw,c.shape),panel:z({},iw,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 Aw(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return kw(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)})),xw(i,t),!bw(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(yw);if(B(i))return;let s;s=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i),gw(s);const{method:n="parity",separation:r=0}=e,a=d(n)?n:fw[n]||fw.parity;if(s.length>=3&&_w(s,r)){do{s=a(s,r)}while(s.length>=3&&_w(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&&vw(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=pm.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=tw.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=WM(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}}Cw.defaultAttributes=sw,U(Cw,Mw);class Ew{isInValidValue(t){const{startAngle:e=SM,endAngle:i=AM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=SM,endAngle:i=AM,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 hw(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 Pw,Bw=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=pm.circle(c);d.name=tw.line,d.id=this._getNodeId("line"),B(a.state)||(d.states=z({},iw,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=Bw(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({},iw,d.text),shape:z({},iw,d.shape),panel:z({},iw,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 aw(t,e,i,s)}}Rw.defaultAttributes=sw,U(Rw,Ew);class Lw extends mc{constructor(){super(...arguments),this.mode=ko.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},PM(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{Iw[t]=!0}));const Hw=t=>-Math.log(-t),Vw=t=>-Math.exp(-t),Nw=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,Gw=t=>10===t?Nw:t===Math.E?Math.exp:e=>Math.pow(t,e),Ww=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Uw=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),Yw=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function Kw(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 Xw(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function $w(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),$w(t,i,s)*(e/(1-i))}function Zw(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function Jw(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 eC{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=Zw(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 iC=Symbol("implicit");class sC extends eC{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=Pw.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=iC}clone(){const t=(new sC).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!==iC)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 rC extends sC{constructor(t){super(),this.type=Pw.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:nC(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 nC(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 rC(!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:aC}=xe;function oC(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=aC(_e.parseColorString(t),s);return t=>e(t).formatRgb()}return At(Number(t),Number(e))}return e instanceof ye?aC(t,e):e instanceof _e?aC(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 lC extends eC{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:zw,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zw;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=zw,this._piecewise=Xw,this._interpolate=oC}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?Jw:Xw,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:zw),this.rescale(i)):this._clamp!==zw}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 hC=Math.sqrt(50),cC=Math.sqrt(10),dC=Math.sqrt(2),uC=[1,2,5,10],pC=(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=vC(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?mC(0,-(e-1)/s,s):mC((e-1)/s,0,s)},gC=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 pC(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return pC(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=mC(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=mC(t,e,l);return n&&r.reverse(),r})),vC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=uC[0];return i>=hC?s=uC[3]:i>=cC?s=uC[2]:i>=dC&&(s=uC[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function _C(t,e,i){const s=(e-t)/Math.max(0,i);return vC(s)}function yC(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=_C(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 xC(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 SC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),AC=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})),kC=ft(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=fC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?SC(t,e,n):SC(t,e,tC(n)),h=SC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),MC=ft(((t,e,i,s,n)=>yC(s(t),s(e),i).map((t=>tC(n(t))))));class TC extends lC{constructor(){super(...arguments),this.type=Pw.Linear}clone(){return(new TC).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 gC(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=fC(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 yC(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=xC(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=bC(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=bC(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=bC(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function wC(t){return e=>-t(-e)}function CC(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class EC extends lC{constructor(){super(Ww(10),Gw(10)),this.type=Pw.Log,this._limit=CC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new EC).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=Ww(this._base),s=Gw(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=wC(i),this._pows=wC(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=Hw,this.untransformer=Vw):(this._logs=i,this._pows=s,this._limit=CC(),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 zw}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 AC(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 kC(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 MC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return MC(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=xC(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=Qw(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 PC extends TC{constructor(){super(Uw(1),Yw(1)),this.type=Pw.Symlog,this._const=1}clone(){return(new PC).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=Uw(t),this.untransformer=Yw(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 AC(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 kC(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 MC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return MC(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=xC(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=Qw(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 BC{constructor(){this.type=Pw.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 BC).domain(this._domain).range(this._range).unknown(this._unknown)}}const RC=t=>t.map(((t,e)=>({index:e,value:t}))),LC=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 OC(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function IC(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=GM(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=DC(S,y,m[0],m[m.length-1]):a&&c&&s===e.length-1?T=DC(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=DC(A,b,m[0],m[m.length-1]):a&&d&&s===e.length-1?w=DC(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},jC=(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=GM(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=lw(o,hw(s,o,e,n));return aw(l,hw(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},zC={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&OC(i.AABBBounds,t.AABBBounds,e)||(i=t,0))))}},HC=(t,e,i,s)=>FC(t,e,i).map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),VC=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},NC=(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&&!VC(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?NC(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&&LC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},UC=(t,e)=>{if(Dw(t.type))return((t,e)=>{if(!Dw(t.type))return RC(t.domain());const i=t.range(),s=Math.abs(i[i.length-1]-i[0]);if(s<2)return RC([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=FC(t,h,e).map(((t,e)=>({AABBBounds:t,value:h[e]})));for(;n.length>=3&&IC(n,i);)n=zC.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 RC(h)})(t,e);if(jw(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?RC([s[s.length-1]]):RC([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=HC(t,s,e,c),l=Math.min(...n.map((t=>t[2]))),h=GC(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=HC(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 RC(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=jC(t,i,e),r=$(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=WC(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 RC(c)})(t,e)}return RC(t.domain())};function YC(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 KC(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 XC(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=YC(t,!!n),o=YC(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=KC(e,t,!1,!!n),o=KC(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=YC(t,!!n),o=YC(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class $C extends Sb{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&ow(this._innerView),this.removeAllChild(!0),this._innerView=pm.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 lw(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?`${tw.grid}-sub`:`${tw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=YC(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=KC(t,o,!1,!!a)}const u=pm.path(Object.assign({path:c,z:l},d(r)?z({},this.skipDefault?null:$C.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=YC(o,!!a),f=Lt(o[0].x-o[1].x),v=Lt(o[0].y-o[1].y),_=pm.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:$C.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,Mw);var ZC=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(JC,Ew);const QC="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",tE={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:QC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:QC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},eE={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 iE;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(iE||(iE={}));var sE=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=iE.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=iE.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=iE.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=iE.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=iE.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t),"browser"===P_.env&&(P_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),P_.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===iE.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===iE.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=iE.endHandler):h+=l:this._activeTag===iE.endHandler&&(c+l{t.preventDefault();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===iE.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"===P_.env&&(P_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),P_.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===iE.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===iE.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=sE(i,["formatMethod"]),{formatMethod:a}=s,o=sE(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:V={},brushSelect:N,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=V.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:N?"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),N&&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:N?"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:N?"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"},eE.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=V.symbolType)&&void 0!==y?y:"square"},eE.horizontal),V),{pickable:!G&&(null===(b=V.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},eE.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},eE.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"},eE.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=V.symbolType)&&void 0!==R?R:"square"},eE.vertical),V),{pickable:!G&&(null===(L=V.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},eE.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},eE.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 _y(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 QM(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 aE,oE,lE,hE;function cE(){iM(),ZM()}function dE(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 uE(t,e){const{dx:i,dy:s}=dE(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}rE.defaultAttributes=tE,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"}(aE||(aE={})),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"}(oE||(oE={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(lE||(lE={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(hE||(hE={}));class pE extends Sb{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=cw(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=dw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=uw(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=pm.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=pm.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=pm.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 gE(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 mE(t,e,i,s){t&&(gE(t.startSymbol,e,i,s),t.lines.forEach((t=>gE(t,e,i,s))),gE(t.line,e,i,s),gE(t.endSymbol,e,i,s))}function fE(t,e,i,s){t&&(gE(t.getTextShape(),e,i,s),gE(t.getBgRect(),e,i,s))}function vE(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 _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,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;gE(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)})),gE(t.endSymbol,s+r+a,o,n),gE(e.getTextShape(),s+r+a+o,l,n),gE(e.getBgRect(),s+r+a+o,l,n)}function xE(t,e,i,s,n){mE(t,s,i,n),fE(e,s,i,n)}function SE(t,e,i,s,n){gE(t,s,i,n),fE(e,s,i,n)}function AE(t,e,i,s,n){gE(t,s,i,n),fE(e,s,i,n)}function kE(t,e,i,s,n,r){var a;mE(t,n,s,r),gE(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?fE(i,n,s,r):gE(i,n,s,r)}function ME(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;gE(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)})),gE(e,n+o+l,h,r),gE(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(gE(i.getTextShape(),n+o+l+h+c,d,r),gE(i.getBgRect(),n+o+l+c,d,r)):gE(i,n+o+l+c,d,r)}function TE(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?bE(t,e,s,r,a):"fadeIn"===i&&xE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?bE(t,e,s,n,a):"fadeIn"===i&&xE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){_E(t,s,i,n),yE(e,s,i,n)}(t,e,i,s,n)}}function wE(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&&SE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&SE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){vE(t,s,i,n),yE(e,s,i,n)}(t,e,i,s,n)}}function CE(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&&AE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&AE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){vE(t,s,i,n),yE(e,s,i,n)}(t,e,i,s,n)}}function EE(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?kE(n,r,e,i,s,o):"callIn"===t&&ME(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?kE(n,r,e,i,s,a):"callIn"===t&&ME(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;_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)}(n,r,e,t,i,s)}}const PE={type:"clipIn",duration:500,easing:"linear",delay:0},BE={type:"fadeIn",duration:500,easing:"linear",delay:0},RE={type:"callIn",duration:500,easing:"linear",delay:0},LE={type:"fadeOut",duration:500,easing:"linear",delay:0};class OE extends pE{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=PE,this.defaultExitAnimation=LE}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;uE(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 QM(Object.assign(Object.assign({},e),{state:{panel:z({},TM,null==i?void 0:i.labelBackground),text:z({},TM,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({},TM,null==e?void 0:e.labelBackground),text:z({},TM,null==e?void 0:e.label)}})),this.setLabelPos())}}const IE=.001,DE={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:aE.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]}},FE={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"}}},jE={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:lE.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]}},zE={interactive:!0,label:{position:oE.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}},HE={interactive:!0,label:{position:lE.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}},VE={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"}},NE={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"}},GE={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 WE(){UE._animate=TE}cE(),qT();class UE extends OE{markerAnimate(t){UE._animate&&this._animationConfig&&UE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UE.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(RM(t)?t:t-Math.PI)+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}getTextStyle(t,e,i){return LM(Math.abs(e),Math.PI/2,IE)||LM(Math.abs(e),3*Math.PI/2,IE)?OM(i,e,t):RM(e)?FE.postiveXAxis[t]:FE.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new JT({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},TM,null==a?void 0:a.line),startSymbol:z({},TM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},TM,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({},TM,null==a?void 0:a.line),startSymbol:z({},TM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},TM,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 YE(){KE._animate=wE}UE.defaultAttributes=DE,cE(),cM();class KE extends pE{markerAnimate(t){KE._animate&&this._animationConfig&&KE._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({},KE.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=BE,this.defaultExitAnimation=LE}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({},NE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;uE(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=pm.polygon(Object.assign({points:e},s));r.states=z({},TM,null==n?void 0:n.area),r.name="mark-area-polygon",this._area=r,t.add(r);const a=new QM(Object.assign(Object.assign({},i),{state:{panel:z({},TM,null==n?void 0:n.labelBackground),text:z({},TM,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({},TM,null==s?void 0:s.area)),this._label&&this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},e),{state:{panel:z({},TM,null==s?void 0:s.labelBackground),text:z({},TM,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}}KE.defaultAttributes=zE,cE(),ZT();class XE extends OE{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,{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 lE.arcInnerStart:l=s;case lE.arcOuterStart:l=s;break;case lE.arcInnerEnd:l=n;case lE.arcOuterEnd:l=n;break;case lE.center:case lE.arcInnerMiddle:case lE.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 VE[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 QT({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},TM,null==o?void 0:o.line),startSymbol:z({},TM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},TM,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({},TM,null==o?void 0:o.line),startSymbol:z({},TM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},TM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}}XE.defaultAttributes=jE,cE(),Xk();class $E extends pE{markerAnimate(t){$E._animate&&this._animationConfig&&$E._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({},$E.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcArea",this.defaultUpdateAnimation=BE,this.defaultExitAnimation=LE}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 lE.center:h=(i+s)/2,c=(n+r)/2;break;case lE.arcInnerStart:h=i,c=n;break;case lE.arcOuterStart:h=s,c=n;break;case lE.arcInnerEnd:h=i,c=r;break;case lE.arcOuterEnd:h=s,c=r;break;case lE.arcInnerMiddle:h=i,c=(n+r)/2;break;case lE.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({},VE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;uE(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=pm.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));h.states=z({},TM,null==l?void 0:l.area),h.name="polar-mark-area-area",this._area=h,t.add(h);const c=new QM(Object.assign(Object.assign({},o),{state:{panel:z({},TM,null==l?void 0:l.labelBackground),text:z({},TM,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({},TM,null==o?void 0:o.area)),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},a),{state:{panel:z({},TM,null==o?void 0:o.labelBackground),text:z({},TM,null==o?void 0:o.label)}})),this.setLabelPos())}isValidPoints(){return!0}}function qE(){ZE._animate=EE}$E.defaultAttributes=HE,cE(),qT(),ZT(),_M(),nM(),aM();class ZE extends pE{markerAnimate(t){ZE._animate&&this._animationConfig&&ZE._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ZE.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=RE,this.defaultExitAnimation=LE,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return LM(Math.abs(s),Math.PI/2,IE)||LM(Math.abs(s),3*Math.PI/2,IE)?OM(t,s,n):RM(s)?GE.postiveXAxis[n]:GE.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=hE.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({},TM,null==m?void 0:m.textBackground),text:z({},TM,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({},TM,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({},TM,null==m?void 0:m.image));const y=RM(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=pm.symbol(Object.assign(Object.assign({},i),r)),h.states=z({},TM,null==s?void 0:s.symbol)):"text"===n?h=new QM(Object.assign(Object.assign({},i),{state:{panel:z({},TM,null==s?void 0:s.textBackground),text:z({},TM,null==s?void 0:s.text)}})):"richText"===n?(h=pm.richtext(Object.assign(Object.assign({},i),a)),h.states=z({},TM,null==s?void 0:s.richText)):"image"===n?(h=pm.image(Object.assign(Object.assign({},i),o)),h.states=z({},TM,null==s?void 0:s.image)):"custom"===n&&l&&(h=l(),h.states=z({},TM,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=LM(c,0,IE)||LM(d,0,IE),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(aP.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(aP.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===aP.focus||"focus"===o){const s=a.hasState(nP.focus);a.toggleState(nP.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[nP.unSelected,nP.unSelectedHover,nP.focus],t),this._setLegendItemState(e,nP.selected,t)})):(this._setLegendItemState(a,nP.selected,t),this._removeLegendItemState(a,[nP.unSelected,nP.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[nP.selected,nP.selectedHover,nP.focus],t),this._setLegendItemState(e,nP.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(nP.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(nP.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(rP.legendItemClick,a,t);i?(this._removeLegendItemState(a,[nP.selected,nP.selectedHover],t),this._setLegendItemState(a,nP.unSelected,t)):(this._setLegendItemState(a,nP.selected,t),this._removeLegendItemState(a,[nP.unSelected,nP.unSelectedHover],t))}else this._setLegendItemState(a,nP.selected,t),this._removeLegendItemState(a,[nP.unSelected,nP.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[nP.selected,nP.selectedHover],t),this._setLegendItemState(e,nP.unSelected,t))}))}this._dispatchLegendEvent(rP.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,nP.selected),this._removeLegendItemState(e,[nP.unSelected,nP.unSelectedHover])):(this._removeLegendItemState(e,[nP.selected,nP.selectedHover]),this._setLegendItemState(e,nP.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=eP,spaceRow:h=iP}=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;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):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=pm.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,aP.item,t,w)):(w=pm.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,aP.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?nP.selected:nP.unSelected);const C=pm.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=pm.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,aP.itemShape,t,w,S.state),s.addState(e?nP.selected:nP.unSelected),C.add(s)}let O=0;if(d){const e=R(g,"size",10);E=pm.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},g),{visible:!0,pickMode:"imprecise",boundsPadding:T})),this._appendDataToShape(E,aP.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=XM(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,aP.itemLabel,t,w,A.state),D.addState(e?nP.selected:nP.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=XM(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,aP.itemValue,t,w,k.state),r.addState(e?nP.selected:nP.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(),V=p(this.attribute.item.width)?this.attribute.item.width:z+T[1]+T[3],N=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=V,w.attribute.height=N,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 tP(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 tP(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 EM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:12},t),{width:e})):new EM(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=pm.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=eP,spaceRow:a=iP}=s,o=this._itemsContainer,{space:l=sP,defaultCurrent:h=1}=n,c=cP(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 _=pm.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(nP.selected)?this._setLegendItemState(t,nP.selectedHover,e):this._setLegendItemState(t,nP.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===aP.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(rP.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(nP.unSelectedHover)||t.hasState(nP.selectedHover))&&(i=!0),t.removeState(nP.unSelectedHover),t.removeState(nP.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(nP.unSelectedHover)&&!t.hasState(nP.selectedHover)||(i=!0),t.removeState(nP.unSelectedHover),t.removeState(nP.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===aP.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(rP.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(rP.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!==aP.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(rP.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!==aP.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(rP.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(nP.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({},dP,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(nP.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 pP;function gP(t){return y(t)?t:[t,t]}function mP(t){return t?"ew-resize":"ns-resize"}uP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:eP,spaceRow:iP,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:sP,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"}(pP||(pP={})),lP();class fP extends Sb{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({},fP.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"===P_.env?(P_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),P_.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"===P_.env?(P_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),P_.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"===P_.env?(P_.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),P_.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"===P_.env?(P_.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),P_.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:gP(d)[0],endValue:gP(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const m=pm.group({x:0,y:0});m.name=pP.innerView,this.add(m),this._innerView=m;let f,v=0;if(r&&r.visible){f=pm.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=pP.startText,m.add(f);const e=p(r.space)?r.space:0;v+=(g?f.AABBBounds.width():f.AABBBounds.height())+e}const _=pm.group({x:g?v:0,y:g?0:v});m.add(_);const y=pm.group({x:0,y:0});let b;if(y.name=pP.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=pm.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=pP.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=pm.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=pP.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]=gP(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":mP(p)},r));if(v.name=pP.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=f,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=pP.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":mP(p)},r));if(i.name=pP.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(m,"end");e.name=pP.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=pm.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=pP.trackContainer;const f=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===f?"pointer":mP(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=pm.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=pP.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return pm.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":mP(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),pm.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=pm.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=pm.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===pP.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===pP.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===pP.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===pP.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}}}fP.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}}},hP(),lP();class vP extends oP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},vP.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 _P(){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`}vP.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"}}},hP(),lP(),lM();class yP extends oP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},yP.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=pm.group({x:0,y:0});this._innerView.add(x);const S=new fP({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:_P(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=pm.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))}}yP.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)"}},iM(),bM(),gM();let bP=class t extends Sb{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,V,N,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},wM),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},wM),$),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!==(V=K.width)&&void 0!==V?V: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!==(N=$.width)&&void 0!==N?N: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"))}}}};bP.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 xP={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"}}};iM(),bM(),gM();let SP=class extends Sb{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==e)return void(o&&o.hideAll());if(p(i))if(!1!==i.visible){const t=z({},R(xP,"title.style"),i.style);UM(t)?this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},KM(t)),{visible:i.visible,x:0,y:0}),"richtext"):this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},t),{lineHeight:p(t.lineHeight)?t.lineHeight:t.fontSize,visible:i.visible,x:0,y:0}),"text"),i.autoFit&&k(a)&&this._setLocalAutoFit(a,this._title,i),i.autoLimit&&k(r)&&this._title.setAttribute("maxLineWidth",a)}else{const t=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}if(p(s)){const t=Y(s),e=[];t.forEach(((t,s)=>{if(!1!==t.visible){const n=z({},R(xP,"content.style"),t.style);let l;l=UM(n)?o.createOrUpdateChild("indicator-content-"+s,Object.assign(Object.assign({},KM(n)),{visible:i.visible,x:0,y:0}),"richtext"):o.createOrUpdateChild("indicator-content-"+s,Object.assign(Object.assign({},n),{lineHeight:p(n.lineHeight)?n.lineHeight:n.fontSize,visible:t.visible,x:0,y:0}),"text"),t.autoFit&&k(a)&&this._setLocalAutoFit(a,l,t),t.autoLimit&&k(r)&&l.setAttribute("maxLineWidth",a),e.push(l)}else{const t=o.find((t=>t.name==="indicator-content-"+s),!1);t&&o.removeChild(t)}})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.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=WM(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 AP extends yg{constructor(t){super(t)}}var kP,MP;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(kP||(kP={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(MP||(MP={}));class TP extends Sb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},TP.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"},TP.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"},TP.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},TP.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},TP.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 AP(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new AP(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new AP(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(kP.OnPlay)},this.pause=()=>{this._dispatchEvent(kP.OnPause)},this.forward=()=>{this._dispatchEvent(kP.OnForward)},this.backward=()=>{this._dispatchEvent(kP.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()}}TP.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},TP.defaultAttributes={[MP.Start]:{},[MP.Pause]:{},[MP.Backward]:{},[MP.Forward]:{}};const wP={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},CP=[200,10];var EP,PP;!function(t){t.Default="default",t.Reverse="reverse"}(EP||(EP={})),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"}(PP||(PP={}));const BP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===EP.Default&&s===i})({direction:e,maxIndex:i,dataIndex:n})||(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===EP.Reverse&&s===i})({direction:e,minIndex:s,dataIndex:n})},RP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===EP.Default&&s===i})({direction:e,minIndex:s,dataIndex:n})||(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===EP.Reverse&&s===i})({direction:e,maxIndex:i,dataIndex:n})},LP=t=>"top"===t||"bottom"===t;class OP extends Sb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},OP.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(LP(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:CP[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:CP[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 fP(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 LP(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 TP(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=LP(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:CP[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?(LP(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:LP(this._orient)?t+s:(this._size.width-r)/2,y:LP(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:LP(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:LP(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:LP(this._orient)?t+s:(this._size.width-r)/2,y:LP(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 IP(){lP(),iM(),_M()}OP.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({},wP),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},wP),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},wP),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},wP),{key:"backward",position:"start"})}},IP();class DP extends OP{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:EP.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(kP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(kP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(kP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(kP.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(PP.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(BP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||RP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===EP.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(PP.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=P_.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(PP.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(PP.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=P_.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(),P_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(PP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,P_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(PP.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(PP.change),this.dispatchCustomEvent(PP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var FP,jP=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())}))};IP();class zP extends OP{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(kP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(kP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(kP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(kP.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(PP.change))},this.play=()=>jP(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(PP.play),this._rafId=P_.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=P_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,P_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(PP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,P_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(PP.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(PP.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(PP.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"}(FP||(FP={}));const HP={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}},VP=5;const NP={debounce:xt,throttle:St};iM(),cM();let GP=class t extends Sb{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:NP[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(FP.brushClear,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._container.incrementalClearChild(),this._brushMaskAABBBoundsDict={}):(this._activeDrawState&&this._dispatchEvent(FP.drawEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._activeMoveState&&this._dispatchEvent(FP.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=HP.trigger,updateTrigger:e=HP.updateTrigger,endTrigger:i=HP.endTrigger,resetTrigger:s=HP.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(FP.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(FP.moveStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_drawing(t){var e,i;const s=this.eventPosToStagePos(t),{sizeThreshold:n=VP,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(FP.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(FP.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=pm.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)})},UP=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}},YP={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:kM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:kM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:kM,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},KP=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];iM(),uM(),_M(),bM(),gM();let XP=class t extends Sb{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:BM(u)&&BM(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:BM(u)&&BM(u.value)},UP(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:BM(u)&&BM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:BM(u)&&BM(u.value)},UP(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},wM),u.value),visible:BM(u)&&BM(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=BM(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 _=BM(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(!BM(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)+(BM(n.key)?r+n.key.spacing:0)+(BM(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&&($M(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:BM(n.key)||"right"===c||(t="left"),m.setAttribute("textAlign",t),$M(c,m,t,u,a),m.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(BM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Fc(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(BM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},UP(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},UP(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},wM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(BM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},UP(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},UP(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=>KP.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)&&BM(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=BM(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=GM(u),y=GM(p);let b=0;if(BM(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(BM(p)){const{width:t,height:e}=y.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}f&&mg[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 WP({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return WP({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};XP.defaultAttributes=YP;const $P=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 ZP(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function JP(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function QP(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 tB(t,e){const i=QP(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 eB(t,e){const i=iB(t),s=iB(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 iB(t,e={x:0,y:0}){return qt.distancePP(t,e)}function sB(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 nB(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const rB=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var oB,lB;!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"}(oB||(oB={})),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.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(lB||(lB={}));const hB="__VCHART",cB=500,dB=500,uB=`${hB}_LABEL_LIMIT`,pB=`${hB}_LABEL_ALIGN`,gB=`${hB}_LABEL_TEXT`,mB=`${hB}_LABEL_VISIBLE`,fB=`${hB}_LABEL_X`,vB=`${hB}_LABEL_Y`,_B=`${hB}_ARC_TRANSFORM_VALUE`,yB=`${hB}_ARC_RATIO`,bB=`${hB}_ARC_START_ANGLE`,xB=`${hB}_ARC_END_ANGLE`,SB=`${hB}_ARC_K`,AB=`${hB}_ARC_MIDDLE_ANGLE`,kB=`${hB}_ARC_QUADRANT`,MB=`${hB}_ARC_RADIAN`,TB=-Math.PI/2,wB=3*Math.PI/2,CB=-90,EB=.6;var PB,BB,RB,LB,OB,IB,DB,FB,jB,zB,HB,VB,NB,GB,WB;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(PB||(PB={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(BB||(BB={})),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"}(RB||(RB={})),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"}(LB||(LB={})),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"}(OB||(OB={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(IB||(IB={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(DB||(DB={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(FB||(FB={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(jB||(jB={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(zB||(zB={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(HB||(HB={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(VB||(VB={})),t.VGRAMMAR_HOOK_EVENT=void 0,(NB=t.VGRAMMAR_HOOK_EVENT||(t.VGRAMMAR_HOOK_EVENT={})).BEFORE_EVALUATE_DATA="beforeEvaluateData",NB.AFTER_EVALUATE_DATA="afterEvaluateData",NB.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",NB.AFTER_EVALUATE_SCALE="afterEvaluateScale",NB.BEFORE_PARSE_VIEW="beforeParseView",NB.AFTER_PARSE_VIEW="afterParseView",NB.BEFORE_TRANSFORM="beforeTransform",NB.AFTER_TRANSFORM="afterTransform",NB.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",NB.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",NB.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",NB.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",NB.BEFORE_STAGE_RESIZE="beforeStageResize",NB.AFTER_STAGE_RESIZE="afterStageResize",NB.BEFORE_VRENDER_DRAW="beforeVRenderDraw",NB.AFTER_VRENDER_DRAW="afterVRenderDraw",NB.BEFORE_MARK_JOIN="beforeMarkJoin",NB.AFTER_MARK_JOIN="afterMarkJoin",NB.BEFORE_MARK_UPDATE="beforeMarkUpdate",NB.AFTER_MARK_UPDATE="afterMarkUpdate",NB.BEFORE_MARK_STATE="beforeMarkState",NB.AFTER_MARK_STATE="afterMarkState",NB.BEFORE_MARK_ENCODE="beforeMarkEncode",NB.AFTER_MARK_ENCODE="afterMarkEncode",NB.BEFORE_DO_LAYOUT="beforeDoLayout",NB.AFTER_DO_LAYOUT="afterDoLayout",NB.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",NB.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",NB.BEFORE_DO_RENDER="beforeDoRender",NB.AFTER_DO_RENDER="afterDoRender",NB.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",NB.AFTER_MARK_RENDER_END="afterMarkRenderEnd",NB.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",NB.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",NB.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",NB.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",NB.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",NB.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",NB.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",NB.BEFORE_ELEMENT_STATE="beforeElementState",NB.AFTER_ELEMENT_STATE="afterElementState",NB.BEFORE_ELEMENT_ENCODE="beforeElementEncode",NB.AFTER_ELEMENT_ENCODE="afterElementEncode",NB.ANIMATION_START="animationStart",NB.ANIMATION_END="animationEnd",NB.ELEMENT_ANIMATION_START="elementAnimationStart",NB.ELEMENT_ANIMATION_END="elementAnimationEnd",NB.ALL_ANIMATION_START="allAnimationStart",NB.ALL_ANIMATION_END="allAnimationEnd",function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(GB||(GB={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(WB||(WB={}));const UB="__vgrammar_scene_item__",YB=[RB.line,RB.area],KB=[RB.arc3d,RB.rect3d,RB.pyramid3d],XB="key",$B=[{}],qB=["key"],ZB=!0,JB=!0,QB=!1,tR=!0,eR="VGRAMMAR_IMMEDIATE_ANIMATION",iR=0,sR=1e3,nR=0,rR=0,aR=!1,oR=!1,lR="quintInOut",hR={stopWhenStateChange:!1,immediatelyApply:!0};function cR(t,e){return Y(t).reduce(((t,i)=>{const s=_(i)?e.getGrammarById(i):i;return s&&t.push(s),t}),[])}function dR(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 cR(t.dependency,e);var i;return[]}function uR(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function pR(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 gR(t,e){return mR(t)?t.output():e[t]}const mR=t=>t&&!u(t.grammarType),fR=t=>d(t)?t:e=>e[t];function vR(t){return!!(null==t?void 0:t.scale)}function _R(t){return!!(null==t?void 0:t.field)}function yR(t,e){if(!t)return[];let i=[];return t.scale&&(i=mR(t.scale)?[t.scale]:Y(e.getScaleById(t.scale))),i.concat(dR(t,e))}function bR(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 xR(t,e,i,s,n){i&&(uR(i)?e.forEach((e=>{const n=pR(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 RB.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case RB.group:case RB.rect:case RB.image:return["width","height","y1"].includes(e);case RB.path:case RB.shape:return["path","customPath"].includes(e);case RB.line:return"defined"===e;case RB.area:return["x1","y1","defined"].includes(e);case RB.rule:return["x1","y1"].includes(e);case RB.symbol:return"size"===e;case RB.polygon:return"points"===e;case RB.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(vR(l)){const t=gR(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?cb(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(_R(l)){const t=cb(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=pR(l,s,e.datum,t)}))})))}function SR(t,e,i,s){if(!t)return null;if(uR(t))return pR(t,s,e,i);const n={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(vR(h)){const t=gR(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?cb(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(_R(h)){const t=cb(h.field);n[r]=t(e)}else n[r]=pR(h,s,e,i)})),n}class AR{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 kR=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]}};kR._plotMarks={},kR._marks={},kR._components={},kR._graphicComponents={},kR._transforms={},kR._grammars={},kR._glyphs={},kR._animations={},kR._interactions={},kR._graphics={},kR.registerGlyph=(t,e,i,s,n)=>(kR._glyphs[t]=new AR(e,i,s,n),kR._glyphs[t]),kR.registerAnimationType=(t,e)=>{kR._animations[t]=e},kR.getAnimationType=t=>kR._animations[t],kR.registerInteraction=(t,e)=>{kR._interactions[t]=e},kR.registerGraphic=(t,e)=>{kR._graphics[t]=e},kR.getGraphicType=t=>kR._graphics[t],kR.createGraphic=(t,e)=>{const i=kR._graphics[t];return i?i(e):null};const MR=t=>!!RB[t];function TR(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var s;const n=kR.getGraphicType(e)?kR.createGraphic(e,i):kR.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 wR=t=>{t&&(t[UB]=null,t.release(),t.parent&&t.parent.removeChild(t))},CR=["fillOpacity"],ER=(t,e,i)=>{var s;return"fillOpacity"===e?(t.fillOpacity=null!==(s=i.fillOpacity)&&void 0!==s?s:1,["fillOpacity"]):[]};const PR={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"}],[RB.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"}],[RB.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"}],[RB.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 BR=(t,e,i,s)=>{const n={},r=e?Object.keys(e):[],a=_(t)?PR[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||(CR.includes(r)?ER(n,r,e):n[r]=e[r])}))}else r.forEach((t=>{CR.includes(t)?ER(n,t,e):n[t]=e[t]}));return n},RR=(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),LR=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],OR=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(LR);function IR(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)?OR:LR,r=[];let a=null;return t.forEach(((t,e)=>{a&&n.every((e=>RR(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=DR(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function DR(t){const e={};return t?(Object.keys(t).forEach((i=>{"x"!==i&&"y"!==i&&"x1"!==i&&"y1"!==i&&"defined"!==i&&"size"!==i&&"width"!==i&&"height"!==i&&"context"!==i&&(e[i]=t[i])})),e):e}let FR=class{constructor(t){this.data=null,this.states=[],this.diffState=BB.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:{}})));xR(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?BR(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[UB]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?BR(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t)))}updateGraphicItem(){if(!this.graphicItem)return;this.diffState===BB.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&&(wR(this.graphicItem),this.graphicItem[UB]=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=fR(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(pR(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===BB.unChange&&(this.diffState=BB.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&(this.mark.isCollectionMark()&&delete t.defined,Object.assign(e,t)),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==BB.enter&&this.diffState!==BB.update||!this.states.length||this.useStates(this.states),this.mark.markType===RB.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 cl))}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[PB.update],a=e[PB.enter],o=e[PB.exit],l=this.mark.isLargeMode()||n&&!this.mark.getSpec().enableSegments;this.diffState===BB.enter?(a&&xR(this,t,a,s,l),r&&xR(this,t,r,s,l)):this.diffState===BB.update?((n&&a||i)&&xR(this,t,a,s,l),r&&xR(this,t,r,s,l)):this.diffState===BB.exit&&o&&(i&&xR(this,t,a,s,l),xR(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)gb(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[RB.line,RB.area,RB.largeRects,RB.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(s=l.nextAttrs)||void 0===s?void 0:s.points)&&(!0===i||bR(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[PB.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=DR(h),e===RB.line||e===RB.area){const i=function(t,e,i,s){return t&&t.length&&(1!==t.length||e)?t.some((t=>bR(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===RB.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=IR(e.items,e.points,i);if(s)return void s.forEach((e=>{t.push(e)}))}const n=DR(e.items[0]);n.points=e.points,t.push(n)})),t}return s?IR(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=SR(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=IR(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t)}else h.points=i,h.segments=null}else e===RB.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===RB.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}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&&(wR(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 jR{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 zR=(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 HR extends jR{constructor(t,e){super(t,e),this.type=HR.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({},HR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=zR(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()}}HR.type="element-select",HR.defaultOptions={state:WB.selected,trigger:"click"};class VR extends jR{constructor(t,e){super(t,e),this.type=VR.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},VR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=zR(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 NR(t){if(t)return t.type===Pw.Band?t.bandwidth():t.type===Pw.Point?t.step():void 0}VR.type="element-highlight",VR.defaultOptions={highlightState:WB.highlight,blurState:WB.blur,trigger:"pointerover",triggerOff:"pointerout"};class GR{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 WR=()=>{U(HR,GR),kR.registerInteraction(HR.type,HR)},UR=()=>{U(VR,GR),kR.registerInteraction(VR.type,VR)},YR=(t,e)=>mR(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,KR=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,s)=>{const n=t[s];return i[s]=YR(n,e),i}),{}):t.map((t=>YR(t,e))):t;let XR=-1;class $R extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++XR}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(dR(this.spec[e],this.view)),this.spec[e]=t,this.attach(dR(t,this.view)),this.commit(),this}}const qR=(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=dR(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}},ZR=(t,e)=>{const i=kR.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(cR(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(y(e)){const s=e.map((e=>qR(t,e,i)));return{references:s.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:s.map((t=>t.value))}}return qR(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}},JR=(t,e)=>{if(null==t?void 0:t.length){const i=[];let s=[];return t.forEach((t=>{var n;const r=ZR(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},QR={csv:Yr,dsv:Ur,tsv:Kr,json:function(t){if(!_(t))return Y(t);try{return Y(JSON.parse(t))}catch(t){return[]}}};class tL extends $R{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||!QR[e.type])return Y(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return QR[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?dR(t.format,this.view)[0]:null;if(s&&e.push(s),t.values){const s=dR(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=dR(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=mR(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=JR(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=JR(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 eL="window",iL="view",sL={trap:!1},nL="width",rL="height",aL="viewWidth",oL="viewHeight",lL="padding",hL="viewBox",cL="autoFit";function dL(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 uL(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,dL(t,e,n,s)}class pL{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 dL(this.nodes,e,0,this.compare),uL(this.nodes,e,null,this.compare)}return this.nodes.push(t),dL(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)),dL(this.nodes,e,0,this.compare),uL(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,uL(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class gL{constructor(t){this.list=[],this.ids={},this.idFunc=t||db}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 mL{constructor(){this.grammars=[],this.logger=at.getInstance(),this._curRank=0,this._committed=new gL((t=>t.uid)),this._heap=new pL(((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 gL((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 fL=(t,e,i,s,n)=>{const r=t=>{if(n||!t||s&&!s(t)||i.call(null,t),t.markType===RB.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}n&&(!t||s&&!s(t)||i.call(null,t))};r(t)};class vL{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 $d(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Il.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 J_(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 $b(o)),null===(r=this._eventConfig)||void 0===r?void 0:r.gesture){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new Jb(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 _L(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 yL(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 bL(t,e,i,s,n){if(n===eL){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{yL(t,_L(t),!1)}))}));const e=_L(t);yL(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e}class xL extends $R{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?pR(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}},ML=(t,e)=>e&&e.debounce?xt(t,e.debounce):e&&e.throttle?St(t,e.throttle):t;class TL extends FR{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 xR(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[UB]=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?BR(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);this.graphicItem||this.initGraphicItem(),this.diffState===BB.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==BB.enter&&this.diffState!==BB.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.diffState===BB.enter&&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=BR(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=PR[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===RB.shape&&(o.datum=d[0].datum)})),s}}_generateGlyphItems(t,e,i){const s=e.map((t=>Object.assign({},t,{nextAttrs:i})));return YB.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)gb(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[UB]=null})),this.glyphGraphicItems=null),super.release()}}const wL=t=>t.markType===RB.glyph?new TL(t):new FR(t);function CL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(XB,i?t.slice().sort(i):t.slice()),{keys:qB,data:s};const n=fR(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 EL{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?CL(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 PL=(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=bR(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=bR(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 BL=(t,e,i,s,n)=>d(i)?i(t.getDatum(),t,n):i;class RL extends mc{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 LL extends mc{getEndProps(){return this.to}onBind(){var t;const e=null!==(t=this.target.constructor.NOWORK_ANIMATE_ATTR)&&void 0!==t?t:Fd,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)}}vc.mode|=ko.SET_ATTR_IMMEDIATELY;let OL=0;const IL=t=>!u(t)&&(t.prototype instanceof mc||"onBind"in t.prototype&&"onStart"in t.prototype&&"onEnd"in t.prototype&&"onUpdate"in t.prototype);class DL{constructor(t,e,i){this.id=OL++,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||!kR.getAnimationType(e.type))return null;const r=kR.getAnimationType(e.type)(t,n,i);return PL(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?BL(t,0,n[i].from,0,s):void 0,e.to[i]=l?BL(t,0,n[i].to,0,s):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),PL(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=IL(o);return u(o)||IL(o)?h?new o(r.from,r.to,a,t.easing,l):r.to?new LL(r.from,r.to,a,t.easing):void 0:new RL(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 Uc(a,e))}r>0&&t.wait(r)}}function FL(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(jL(i,t[i]))})),e}function jL(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:iR,totalTime:h.totalTime,oneByOne:null!==(i=h.oneByOne)&&void 0!==i?i:oR,loop:null!==(s=h.loop)&&void 0!==s?s:aR,controlOptions:z({},hR,null!==(n=h.controlOptions)&&void 0!==n?n:{}),timeSlices:[{duration:null!==(r=h.duration)&&void 0!==r?r:sR,delay:null!==(a=h.delay)&&void 0!==a?a:nR,delayAfter:null!==(o=h.delayAfter)&&void 0!==o?o:rR,effects:[{type:h.type,channel:h.channel,custom:h.custom,easing:null!==(l=h.easing)&&void 0!==l?l:lR,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:iR,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:oR,loop:null!==(d=t.loop)&&void 0!==d?d:aR,controlOptions:z({},hR,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:nR,delayAfter:null!==(i=t.delayAfter)&&void 0!==i?i:rR,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:lR,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 zL(t,e,i){return d(t)?t.call(null,e.getDatum(),e,i):t}class HL{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 VL{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=FL(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=FL(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!==BB.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 HL(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=jL(eR,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 HL(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===BB.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 DL(s,i,e);if(l.animate(n,r),!l.isAnimating)return;s.diffState===BB.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=pR(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,s,n){const r=[],a=zL(t.startTime,e,n),o=zL(t.totalTime,e,n),l=zL(t.oneByOne,e,n),h=zL(t.loop,e,n);let c=0;t.timeSlices.forEach((t=>{var i;const a=zL(t.delay,e,n),l=zL(t.delayAfter,e,n),h=null!==(i=zL(t.duration,e,n))&&void 0!==i?i:o/s,d=Y(t.effects).map((t=>Object.assign({},t,{customParameters:zL(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===BB.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===BB.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===eR,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===BB.exit&&0===o[BB.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 NL extends $R{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new VL(this,{}),this.differ=new EL([]),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===BB.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(e,i){var s;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===VB.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:$B,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===RB.group)return;const e=CL(null!=t?t:$B,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(BB.update,t,e,i)}encodeState(t,e,i,s){if(t===BB.enter&&(this._isReentered=!0),this.spec.encode[t]){const n=this.spec.encode[t];if(uR(n))this.detach(yR(n,this.view));else{const r=_(e);r&&s||!r&&i?(Object.keys(n).forEach((t=>{this.detach(yR(n[t],this.view))})),this.spec.encode[t]={}):r?this.detach(yR(n[e],this.view)):Object.keys(e).forEach((t=>{this.detach(yR(n[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),_(e)?(this.spec.encode[t][e]=i,this.attach(yR(i,this.view))):uR(e)?(this.spec.encode[t]=e,this.attach(yR(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(yR(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=JR(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=JR(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 YB.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!==BB.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===GB.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&&!uR(n)&&Object.keys(n).forEach((t=>{vR(n[t])&&(e[t]=gR(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];uR(s)||Object.keys(s).forEach((t=>{_R(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[UB];if((null==s?void 0:s.mark)===this){const i=bL(this.view,t,s,0,iL);this.emitGrammarEvent(e,i,s)}},this.initEvent()),this.animate||(this.animate=new VL(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=gR(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!==RB.group){if(!this.graphicItem){const t=TR(this,RB.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||KB.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||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==RB.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=fR(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:()=>XB),a=fR(null!==(n=this.spec.groupBy)&&void 0!==n?n:()=>XB),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===BB.enter))),c=[];this.differ.setCallback(((t,e,i)=>{const s=t;let n;if(u(e))n=this.elementMap.get(s),n&&(n.diffState=BB.exit);else if(u(i)){n=this.elementMap.has(s)?this.elementMap.get(s):wL(this),n.diffState===BB.exit&&(n.diffState=BB.enter,this.animate.getElementAnimators(n,BB.exit).forEach((t=>t.stop("start")))),n.diffState=BB.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=BB.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:$B;l||this.differ.setCurrentData(CL(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]=SR(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[PB.group],s);e.forEach((t=>{this.markType===RB.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._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:TR(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!==RB.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=fR(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:()=>XB),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=wL(this);e.diffState=BB.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=wL(this);i.diffState=BB.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!==RB.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=TR(this,RB.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!==BB.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:PR[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=BB.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&&wR(this.graphicItem),this.detachAll(),super.release()}}let GL=class extends NL{constructor(t,e){super(t,RB.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===RB.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 PR.rect}evaluateJoin(t){if(!this.elements.length){const t=wL(this);t.updateData(XB,$B,(()=>""),this.view),this.elements=[t],this.elementMap.set(XB,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 xR(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[PB.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:TR(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 WL(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 UL(t,e){return Math.min(t<0?t+e:t-1,e)}function YL(t,e,i){let s=UL(t,i),n=UL(e,i);if(k(t)||k(e)?k(t)?k(e)||(s=UL(Math.max(0,n-1),i)):n=UL(s+1,i):(s=1,n=2),s>n){const t=n;n=s,s=t}return{start:s,end:n}}const KL=(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=>WL(t,i))),u=l.map((t=>WL(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}=YL(e,i,r),{start:h,end:c}=YL(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()}))},XL={[LB.axis]:0,[LB.legend]:1,[LB.slider]:2,[LB.player]:3,[LB.datazoom]:4},$L=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=XL[t.componentType])&&void 0!==s?s:1/0},qL=(t,e,i,s)=>{const n=i.clone(),r=t.getSpec().layout,a=mb(r.maxChildWidth,n.width()),o=mb(r.maxChildHeight,n.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=kL(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&&d$L(t)-$L(e)));for(let t=0,e=f.length;t{null==t||t.forEach((t=>{var s;if(t.markType!==RB.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=qL(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(aL,o),i.updateSignal(oL,l),i.updateSignal(lL,h)}else qL(t,n,a,e);else"grid"===r.display&&KL(t,n,a);ZL(n,e,i)}}))};class JL extends NL{constructor(t,e,i){super(t,RB.glyph,i),this.glyphType=e,this.glyphMeta=kR.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(!kR.getGraphicType(RB.glyph))return;const s=kR.createGraphic(RB.glyph,i),n=e.getMarks(),r=Object.keys(n).map((t=>{if(kR.getGraphicType(n[t])){const e=kR.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 QL=Symbol.for("key");class tO{diffGrammar(t,e){return function(t,e,i){const s={enter:[],exit:[],update:[]},n=new EL(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(CL(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!==RB.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==RB.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=CL(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=CL(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=fR(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 EL(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(CL(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:QL})),r=CL(e,(t=>{var e;return null!==(e=s(t))&&void 0!==e?e:QL}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==QL){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=pR(i.animation.delay,n,o,l),d=pR(i.animation.duration,n,o,l),u=pR(i.animation.oneByOne,n,o,l),p=pR(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)?Td:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:wd)(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);Sd(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)?Td:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:wd)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>_d(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>bd(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 xd({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Sc,null!==(l=i.easing)&&void 0!==l?l:Ac))}))}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 Ad({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Sc,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Ac))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Sd(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 eO{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 iO extends eO{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===RB.group&&s.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===RB.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=>{const s=t.mark;s.markType===RB.group&&s.includesChild(e,!1)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===RB.group&&e.includesChild(s,!1)&&(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 sO{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 nO extends NL{addGraphicItem(t,e){const i=t&&t.limitAttrs,s=TR(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?RB.richtext:RB.text,t);return super.addGraphicItem(t,e,s)}release(){super.release()}}nO.markType=RB.text;const rO={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)"}}},aO={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},oO=Object.assign({},rO);oO.axis=Object.assign({},oO.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),oO.circleAxis=Object.assign({},oO.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),oO.grid=Object.assign({},oO.grid,{style:{stroke:"#404349"}}),oO.circleGrid=Object.assign({},oO.circleGrid,{style:{stroke:"#404349"}}),oO.rectLabel=Object.assign({},oO.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),oO.lineLabel=Object.assign({},oO.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),oO.symbolLabel=Object.assign({},oO.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),oO.title=Object.assign({},oO.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const lO={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:aO,components:oO},hO={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:aO,components:rO};let cO=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")}};cO._themes=new Map,cO.registerTheme("default",hO),cO.registerTheme("dark",lO);class dO extends NL{constructor(t,e,i,s){super(t,RB.component,i),this._componentDatum={[XB]: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:kR.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,XB)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[XB]+=1}evaluateJoin(t){return this.spec.key=XB,t?(t[XB]=this._componentDatum[XB],this._componentDatum=t):this._componentDatum={[XB]:this._componentDatum[XB]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}class uO 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[UB],n=bL(0,t,s,0,iL);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(mR(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)):MR(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 xL(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 tL(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=kR.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=kR.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 RB.group:n=new GL(this,s);break;case RB.glyph:n=new JL(this,null==i?void 0:i.glyphType,s);break;case RB.component:n=kR.hasComponent(null==i?void 0:i.componentType)?kR.createComponent(null==i?void 0:i.componentType,this,s,null==i?void 0:i.mode):new dO(this,null==i?void 0:i.componentType,s,null==i?void 0:i.mode);break;case RB.text:n=new nO(this,t,s);break;default:n=kR.hasMark(t)?kR.createMark(t,this,s):new NL(this,t,s)}return this.grammars.record(n),this._dataflow.add(n),n}group(t){return this.mark(RB.group,t)}glyph(t,e){return this.mark(RB.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(RB.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(RB.component,t,{componentType:LB.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(RB.component,t,{componentType:LB.grid,mode:e})}legend(t){return this.mark(RB.component,t,{componentType:LB.legend})}slider(t){return this.mark(RB.component,t,{componentType:LB.slider})}label(t){return this.mark(RB.component,t,{componentType:LB.label})}datazoom(t){return this.mark(RB.component,t,{componentType:LB.datazoom})}player(t){return this.mark(RB.component,t,{componentType:LB.player})}title(t){return this.mark(RB.component,t,{componentType:LB.title})}scrollbar(t){return this.mark(RB.component,t,{componentType:LB.scrollbar})}customized(t,e){const i=kR.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&&AL.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&(wR(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_"+ ++SL;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(cO.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(nL,t.width),this.updateSignal(rL,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=kR.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=VB.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var s,n,r,a,o;return[{id:nL,value:null!==(s=t[nL])&&void 0!==s?s:0},{id:rL,value:null!==(n=t[rL])&&void 0!==n?n:0},{id:lL,value:kL(null!==(a=null!==(r=t[lL])&&void 0!==r?r:e[lL])&&void 0!==a?a:null==i?void 0:i.padding)},{id:aL,update:{callback:(t,e)=>{const i=kL(e[lL]);return e[nL]-i.left-i.right},dependency:[nL,lL]}},{id:oL,update:{callback:(t,e)=>{const i=kL(e[lL]);return e[rL]-i.top-i.bottom},dependency:[rL,lL]}},{id:hL,update:{callback:(t,e)=>{const i=kL(e[lL]);return(t||new Jt).setValue(i.left,i.top,i.left+e[aL],i.top+e[oL])},dependency:[aL,oL,lL]}},{id:cL,value:null!==(o=t[cL])&&void 0!==o?o:e[cL]}]})(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===RB.glyph?{glyphType:t.glyphType}:t.type===RB.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=cO.getTheme(t))&&void 0!==e?e:cO.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(nL);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(rL);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(aL);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(oL);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(lL);if(arguments.length){const i=kL(t);return this.updateSignal(e,i),i}return kL(e.output())}autoFit(t){const e=this.getSignalById(cL);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(hL);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=VB.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===RB.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var e;const i=this._options.doLayout||ZL;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=>{fL(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),fL(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=ZB,morph:o=JB,morphAll:l=QB,animation:h={},enableExitAnimation:c=tR}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:lR,delay:null!==(i=h.delay)&&void 0!==i?i:nR,duration:null!==(s=h.duration)&&void 0!==s?s:sR,oneByOne:null!==(n=h.oneByOne)&&void 0!==n?n:oR,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=VB.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=VB.reevaluate,this._dataflow.evaluate()),this._layoutState=VB.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=>!AL.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 fL(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(nL,t)),e!==this.height()&&(s=!0,this.updateSignal(rL,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]:iL;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):MR(t)?(i.markType=t,i.source=e):i.source=t===eL?eL: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=cR(l,this),v=ML(((t,e)=>{const s=c===iL&&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===eL&&(t=bL(0,t,e,0,eL));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===iL){if(function(t,e,i){const s=null==t?void 0:t[e];return!(!1===s||g(s)&&!s[i])}(this._eventConfig,iL,d))return this.addEventListener(d,v,sL),()=>{this.removeEventListener(d,v)}}else if(c===eL)return P_.addEventListener(d,v),this._eventListeners.push({type:d,source:P_,handler:v}),()=>{P_.removeEventListener(d,v);const t=this._eventListeners.findIndex((t=>t.type===d&&t.source===P_&&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=kR.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 vL(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e;this.grammars=new eO((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new iO((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 mL,this.animate=new sO(this),this._morph=new tO,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,[iL,eL]),e}(this._options.eventConfig),this._theme=this._options.disableTheme?null:cO.getDefaultTheme(),this.parseBuiltIn(),(e=this._options).mode&&P_.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=VB.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!==RB.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=P_.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&P_.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(),kR.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 pO=()=>{fM(),lM(),kR.registerGraphic(RB.path,Ng)},gO=()=>{fM(),uM(),kR.registerGraphic(RB.rect,Tg)},mO=()=>{fM(),aM(),kR.registerGraphic(RB.rule,Ag)},fO=()=>{fM(),_M(),kR.registerGraphic(RB.symbol,bg)},vO=()=>{fM(),bM(),gM(),kR.registerGraphic(RB.text,mp)},_O=()=>{fM(),tM(),kR.registerGraphic(RB.glyph,Cg)},yO=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},bO=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},xO=(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(yb(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},SO=(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&&yb(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},AO=yO(xO),kO=bO(xO);const MO=(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(yb(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},TO=(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&&yb(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},wO=yO(MO),CO=bO(MO);const EO=(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`},PO=(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`},BO=(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)?PO:EO,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)}}:{}},RO=(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}},LO=(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})}},OO=(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 IO extends dO{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 DO=(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 FO extends IO{constructor(t,e,i){super(t,LB.axis,e),this.spec.componentType=LB.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=kR.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=SR(n,e,i,s);const h=pR(this.spec.inside,s,e,i),c=pR(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(DO(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=pR(this.spec.tickCount,s,e,i);switch(this._getAxisComponentType()){case IB.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 IB.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?IB.circleAxis:IB.lineAxis,this._axisComponentType}}FO.componentType=LB.axis;let jO=class extends dO{constructor(t,e){super(t,LB.label,e),this.spec.componentType=LB.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=pR(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=pR(s,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case RB.line:case RB.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case RB.rect:case RB.rect3d:case RB.interval:g=p.rectLabel;break;case RB.symbol:case RB.circle:case RB.cell:g=p.symbolLabel;break;case RB.arc:case RB.arc3d:g=p.arcLabel;break;case RB.polygon:case RB.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=SR(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=SR(i,t,e,d);m.push(z({},f,s))}));else{const t=SR(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}};jO.componentType=LB.label;const zO=()=>{kR.registerGraphicComponent(LB.label,(t=>new $T(t))),kR.registerComponent(LB.label,jO)};class HO extends IO{constructor(t,e,i){super(t,LB.grid,e),this.spec.componentType=LB.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=kR.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=SR(s,t,e,i);const d=pR(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 DB.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 DB.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=pR(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(DO(h,n,s,d,this.spec.layout,!0),c))}this._getGridComponentType()===DB.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=pR(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case DB.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 DB.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=DB.circleAxisGrid:this._gridComponentType=DB.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case IB.circleAxis:this._gridComponentType=DB.circleAxisGrid;break;case IB.lineAxis:default:this._gridComponentType=DB.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()?DB.lineAxisGrid:DB.circleAxisGrid:DB.lineAxisGrid}else this._gridComponentType=DB.lineAxisGrid;return this._gridComponentType}}HO.componentType=LB.grid;const VO=(t,e,i)=>e.filter((e=>t.callback(e,i))),NO=(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 GO(t){return t.reduce(((t,e)=>t+e),0)}const WO={min:$,max:X,average:function(t){return 0===t.length?0:GO(t)/t.length},sum:GO};function UO(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 YO(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 KO(t,e,i,s){return YO(t,e,i,"min",s)}function XO(t,e,i,s){return YO(t,e,i,"max",s)}function $O(t,e,i,s){return YO(t,e,i,"average",s)}function qO(t,e,i,s){return YO(t,e,i,"sum",s)}const ZO=(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=UO;if("min"===n?l=KO:"max"===n?l=XO:"average"===n?l=$O:"sum"===n&&(l=qO),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[]},JO="_mo_hide_";const QO=(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(JO)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(JO,!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(JO,!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},tI=()=>{kR.registerTransform("filter",{transform:VO,markPhase:"beforeJoin"},!0)},eI=()=>{kR.registerTransform("map",{transform:NO,markPhase:"beforeJoin"},!0)},iI=()=>{kR.registerTransform("sampling",{transform:ZO,markPhase:"afterEncode"},!0)},sI=()=>{kR.registerTransform("markoverlap",{transform:QO,markPhase:"afterEncode"},!0)},nI=(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}}},rI=(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}}},aI=(t,e,i)=>{var s,n,r,a;const o=null!==(s=t.getFinalGraphicAttributes())&&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}}},oI=(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}}},lI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("y",!1),i=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1),n=t.getGraphicAttribute("y",!1),r=t.getGraphicAttribute("y1",!1),a=t.getGraphicAttribute("height",!1),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}}}}},hI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("y",!1),i=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("x1",!1),n=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicAttribute("height",!1),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 cI=(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.getGraphicAttribute("x",!1),r=t.getGraphicAttribute("x1",!1),a=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);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 dI=(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.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);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 uI=(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.getGraphicAttribute("y",!1),r=t.getGraphicAttribute("y1",!1),a=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("y",!1),n=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);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 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.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("y",!1),n=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);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)},gI=(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.getFinalGraphicAttributes();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.getFinalGraphicAttributes();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)},mI=(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.getFinalGraphicAttributes();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)},fI=(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.getFinalGraphicAttributes(),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.getFinalGraphicAttributes();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)},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=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.getFinalGraphicAttributes();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)},_I=(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((()=>Object.assign(n)))},yI=(t,e,i)=>({from:{points:_I(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),bI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:_I(t,e)}}),xI=(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),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}})),SI=(t,e,i)=>({from:{points:xI(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),AI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:xI(t,e,i)}}),kI=(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),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,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)=>{var s,n;const{offset:r=0,orient:a,direction:o,point:l}=null!=e?e:{};let h=0,c=0;"negative"===a&&(i.group?(h=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),c=null!==(n=i.groupHeight)&&void 0!==n?n:i.group.getBounds().height(),i.groupWidth=h,i.groupHeight=c):(h=i.width,c=i.height)),h+=r,c+=r;const u=d(l)?l.call(null,t.getDatum(),t,i):l,p=u&&k(u.x)?u.x:h,g=u&&k(u.y)?u.y:c,m=t.getFinalGraphicAttributes();switch(o){case"x":return{from:{x:p},to:{x:null==m?void 0:m.x}};case"y":return{from:{y:g},to:{y:null==m?void 0:m.y}};default:return{from:{x:p,y:g},to:{x:null==m?void 0:m.x,y:null==m?void 0:m.y}}}},CI=(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}}}},EI=(t,e,i)=>{var s,n,r,a;const o=t.getFinalGraphicAttributes();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}}}},PI=(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}}}},BI={symbol:["_mo_hide_","visible"]},RI=(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=BI[t.mark.markType])&&r.forEach((t=>{delete s[t],delete n[t]})),Object.keys(n).forEach((t=>{gb(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}},LI=(t,e,i)=>{var s,n;const r=null!==(n=null===(s=t.getFinalGraphicAttributes())||void 0===s?void 0:s.angle)&&void 0!==n?n:0;let a=0;return a=pt(r/(2*Math.PI),0)?Math.round(r/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(r/(2*Math.PI))*Math.PI*2:Math.floor(r/(2*Math.PI))*Math.PI*2,{from:{angle:a},to:{angle:r}}},OI=(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}}},II=()=>{kR.registerAnimationType("clipIn",nI)},DI=()=>{kR.registerAnimationType("clipOut",rI)},FI=()=>{kR.registerAnimationType("fadeIn",aI)},jI=()=>{kR.registerAnimationType("fadeOut",oI)},zI=()=>{kR.registerAnimationType("growCenterIn",lI)},HI=()=>{kR.registerAnimationType("growCenterOut",hI)},VI=()=>{kR.registerAnimationType("growHeightIn",uI)},NI=()=>{kR.registerAnimationType("growHeightOut",pI)},GI=()=>{kR.registerAnimationType("growWidthIn",cI)},WI=()=>{kR.registerAnimationType("growWidthOut",dI)},UI=()=>{kR.registerAnimationType("growPointsIn",yI)},YI=()=>{kR.registerAnimationType("growPointsOut",bI)},KI=()=>{kR.registerAnimationType("growPointsXIn",SI)},XI=()=>{kR.registerAnimationType("growPointsXOut",AI)},$I=()=>{kR.registerAnimationType("growPointsYIn",MI)},qI=()=>{kR.registerAnimationType("growPointsYOut",TI)},ZI=()=>{kR.registerAnimationType("growAngleIn",gI)},JI=()=>{kR.registerAnimationType("growAngleOut",mI)},QI=()=>{kR.registerAnimationType("growRadiusIn",fI)},tD=()=>{kR.registerAnimationType("growRadiusOut",vI)},eD=()=>{kR.registerAnimationType("moveIn",wI)},iD=()=>{kR.registerAnimationType("moveOut",CI)},sD=()=>{kR.registerAnimationType("scaleIn",EI)},nD=()=>{kR.registerAnimationType("scaleOut",PI)},rD=()=>{kR.registerAnimationType("rotateIn",LI)},aD=()=>{kR.registerAnimationType("rotateOut",OI)},oD=()=>{kR.registerAnimationType("update",RI)};class lD extends NL{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=uR(e)?null:Object.keys(e).reduce(((t,s)=>(vR(e[s])&&(t[s]=gR(e[s].scale,i)),t)),{});this._encoders[t]={callback:(t,i,n)=>{const r=SR(e,t,i,n);if(u(r.size)){const t=s.x?NR(s.x):void 0,e=s.y?NR(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(PR.symbol)}release(){super.release(),this._encoders=null}}lD.markType=RB.cell;const hD=["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 cD,dD,uD;t.ChartEvent=void 0,(cD=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",cD.rendered="rendered",cD.renderFinished="renderFinished",cD.animationFinished="animationFinished",cD.regionSeriesDataFilterOver="regionSeriesDataFilterOver",cD.afterInitData="afterInitData",cD.afterInitEvent="afterInitEvent",cD.afterInitMark="afterInitMark",cD.rawDataUpdate="rawDataUpdate",cD.viewDataFilterOver="viewDataFilterOver",cD.viewDataUpdate="viewDataUpdate",cD.viewDataStatisticsUpdate="viewDataStatisticsUpdate",cD.markDeltaYUpdate="markDeltaYUpdate",cD.viewDataLabelUpdate="viewDataLabelUpdate",cD.scaleDomainUpdate="scaleDomainUpdate",cD.scaleUpdate="scaleUpdate",cD.dataZoomChange="dataZoomChange",cD.drill="drill",cD.layoutStart="layoutStart",cD.layoutEnd="layoutEnd",cD.layoutRectUpdate="layoutRectUpdate",cD.playerPlay="playerPlay",cD.playerPause="playerPause",cD.playerEnd="playerEnd",cD.playerChange="playerChange",cD.playerForward="playerForward",cD.playerBackward="playerBackward",cD.scrollBarChange="scrollBarChange",cD.brushStart="brushStart",cD.brushChange="brushChange",cD.brushEnd="brushEnd",cD.brushClear="brushClear",cD.legendSelectedDataChange="legendSelectedDataChange",cD.legendFilter="legendFilter",cD.legendItemClick="legendItemClick",cD.legendItemHover="legendItemHover",cD.legendItemUnHover="legendItemUnHover",cD.tooltipShow="tooltipShow",cD.tooltipHide="tooltipHide",cD.tooltipRelease="tooltipRelease",cD.afterResize="afterResize",cD.afterRender="afterRender",cD.afterLayout="afterLayout",t.Event_Source_Type=void 0,(dD=t.Event_Source_Type||(t.Event_Source_Type={})).chart="chart",dD.window="window",dD.canvas="canvas",t.Event_Bubble_Level=void 0,(uD=t.Event_Bubble_Level||(t.Event_Bubble_Level={})).vchart="vchart",uD.chart="chart",uD.model="model",uD.mark="mark";const pD=`${hB}_waterfall_default_seriesField`,gD=`${hB}_CORRELATION_X`,mD=`${hB}_CORRELATION_Y`,fD=`${hB}_CORRELATION_SIZE`,vD=`${hB}_MEASURE_CANVAS_ID`,_D=`${hB}_DEFAULT_DATA_INDEX`,yD=`${hB}_DEFAULT_DATA_KEY`,bD=`${hB}_DEFAULT_DATA_SERIES_FIELD`,xD=`${hB}_DEFAULT_SERIES_STYLE_NAME`;var SD;t.AttributeLevel=void 0,(SD=t.AttributeLevel||(t.AttributeLevel={}))[SD.Default=0]="Default",SD[SD.Theme=1]="Theme",SD[SD.Chart=2]="Chart",SD[SD.Base_Series=3]="Base_Series",SD[SD.Series=4]="Series",SD[SD.Mark=5]="Mark",SD[SD.User_Chart=6]="User_Chart",SD[SD.User_Series=7]="User_Series",SD[SD.User_Mark=8]="User_Mark",SD[SD.Built_In=99]="Built_In";const AD=`${hB}_STACK_KEY`,kD=`${hB}_STACK_START`,MD=`${hB}_STACK_END`,TD=`${hB}_STACK_START_PERCENT`,wD=`${hB}_STACK_END_PERCENT`,CD=`${hB}_STACK_START_OffsetSilhouette`,ED=`${hB}_STACK_END_OffsetSilhouette`,PD=`${hB}_STACK_TOTAL`,BD=`${hB}_STACK_TOTAL_PERCENT`,RD=`${hB}_STACK_TOTAL_TOP`,LD=`${hB}_SEGMENT_START`,OD=`${hB}_SEGMENT_END`;var ID,DD;t.LayoutZIndex=void 0,(ID=t.LayoutZIndex||(t.LayoutZIndex={}))[ID.Axis_Grid=50]="Axis_Grid",ID[ID.CrossHair_Grid=100]="CrossHair_Grid",ID[ID.Region=450]="Region",ID[ID.Mark=300]="Mark",ID[ID.Node=400]="Node",ID[ID.Axis=100]="Axis",ID[ID.MarkLine=500]="MarkLine",ID[ID.MarkArea=100]="MarkArea",ID[ID.MarkPoint=500]="MarkPoint",ID[ID.DataZoom=500]="DataZoom",ID[ID.ScrollBar=500]="ScrollBar",ID[ID.Player=500]="Player",ID[ID.Legend=500]="Legend",ID[ID.CrossHair=500]="CrossHair",ID[ID.Indicator=500]="Indicator",ID[ID.Title=500]="Title",ID[ID.Label=500]="Label",ID[ID.Brush=500]="Brush",ID[ID.CustomMark=500]="CustomMark",ID[ID.Interaction=700]="Interaction",t.LayoutLevel=void 0,(DD=t.LayoutLevel||(t.LayoutLevel={}))[DD.Indicator=10]="Indicator",DD[DD.Region=20]="Region",DD[DD.Axis=30]="Axis",DD[DD.DataZoom=40]="DataZoom",DD[DD.Player=40]="Player",DD[DD.ScrollBar=40]="ScrollBar",DD[DD.Legend=50]="Legend",DD[DD.Title=70]="Title",DD[DD.CustomMark=70]="CustomMark";const FD=["linear","radial","conical"],jD={x0:0,y0:0,x1:1,y1:1},zD={x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},HD={x:.5,y:.5,startAngle:0,endAngle:2*Math.PI},VD={linear:jD,radial:zD,conical:HD},ND={label:{name:"label",type:"text"}},GD=`${hB}_rect_x`,WD=`${hB}_rect_x1`,UD=`${hB}_rect_y`,YD=`${hB}_rect_y1`,KD=Object.assign(Object.assign({},ND),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),XD=Object.assign(Object.assign({},ND),{bar3d:{name:"bar3d",type:"rect3d"}}),$D={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},qD=Object.assign(Object.assign({},ND),$D),ZD=Object.assign(Object.assign({},ND),{point:{name:"point",type:"symbol"}}),JD=Object.assign(Object.assign(Object.assign({},ND),$D),{area:{name:"area",type:"area"}}),QD=Object.assign(Object.assign(Object.assign({},ND),$D),{area:{name:"area",type:"area"}}),tF=Object.assign(Object.assign({},ND),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),eF=Object.assign(Object.assign({},ND),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}}),iF=Object.assign(Object.assign({},ND),{rose:{name:"rose",type:"arc"}}),sF=Object.assign(Object.assign({},ND),{area:{name:"area",type:"path"}}),nF=Object.assign(Object.assign({},ND),{group:{name:"group",type:"group"}}),rF=Object.assign(Object.assign({},nF),{track:{name:"track",type:"arc"},progress:{name:"progress",type:"arc"}}),aF=Object.assign(Object.assign({},ND),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),oF=Object.assign(Object.assign({},ND),{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"}}),lF=Object.assign(Object.assign({},ND),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"}}),hF=Object.assign(Object.assign({},ND),{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"}}),cF=Object.assign(Object.assign({},ND),{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"}}),dF=Object.assign(Object.assign({},ND),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),uF=Object.assign(Object.assign({},KD),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),pF=Object.assign(Object.assign({},ND),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),gF=Object.assign(Object.assign({},ND),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),mF=Object.assign(Object.assign({},ND),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}}),fF=Object.assign(Object.assign({},nF),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),vF=Object.assign(Object.assign({},ND),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),_F=Object.assign(Object.assign({},ND),{sunburst:{name:"sunburst",type:"arc"}}),yF=Object.assign(Object.assign({},KD),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),bF=Object.assign(Object.assign({},XD),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),xF=Object.assign(Object.assign({},ND),{circlePacking:{name:"circlePacking",type:"arc"}}),SF=Object.assign(Object.assign({},ND),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}}),AF=Object.assign(Object.assign({},ND),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),kF=Object.assign({},JD),MF=Object.assign(Object.assign({},ND),{liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"symbol"}}),TF=Object.assign(Object.assign({},ND),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});var wF;!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"}(wF||(wF={}));const CF={[oB.bar]:KD,[oB.bar3d]:XD,[oB.line]:qD,[oB.scatter]:ZD,[oB.area]:JD,[oB.radar]:QD,[oB.pie]:tF,[oB.pie3d]:eF,[oB.rose]:iF,[oB.geo]:ND,[oB.map]:sF,[oB.circularProgress]:rF,[oB.link]:aF,[oB.dot]:oF,[oB.wordCloud]:lF,[oB.wordCloud3d]:lF,[oB.funnel]:hF,[oB.funnel3d]:cF,[oB.linearProgress]:dF,[oB.waterfall]:uF,[oB.boxPlot]:pF,[oB.treemap]:gF,[oB.sankey]:mF,[oB.gauge]:fF,[oB.gaugePointer]:vF,[oB.sunburst]:_F,[oB.rangeColumn]:yF,[oB.rangeColumn3d]:bF,[oB.circlePacking]:xF,[oB.heatmap]:SF,[oB.correlation]:AF,[oB.rangeArea]:kF,[oB.liquid]:MF,[oB.venn]:TF};function EF(t){var e,i;const{type:s}=t;return s===oB.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}const PF={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},BF={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function RF(t,e){var i;if(!t)return[];const s=zF(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?FF(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>DF(i)?OF(t,i,e):i)).filter(p)}))):i.map((i=>DF(i)?OF(t,i,e):i)).filter(p):[]}return[]}function LF(t,e){var i,s;return FF(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 OF(t,e,i){var s;const n=zF(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=PF[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=BF[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 IF=(t,e,i)=>{if(e&&DF(t)){const s=OF(e,t,i);if(s)return s}return t};function DF(t){return t&&"palette"===t.type&&!!t.key}function FF(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function jF(t){return y(t)?{dataScheme:t}:t}function zF(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=EF(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 HF extends sC{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(!FF(this._range))return void super.range(this._range);const t=LF(this._range,this._domain);super.range(t)}}const VF={linear:TC,band:rC,point:class extends rC{constructor(t){super(!1),this.type=Pw.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:sC,threshold:BC,colorOrdinal:HF};function NF(t){const e=VF[t];return e?new e:null}function GF(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 WF(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function UF(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function YF(t){return!!_(t)&&(!!t.endsWith("%")&&nb(t.substring(0,t.length-1)))}function KF(t,e,i,s=0){var n,r;return S(t)?t:YF(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 XF(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]=KF(t[s],e.size,i)}))})),o}function $F(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)||YF(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 qF(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const ZF=(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},JF=[{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"]}],QF={default:{dataScheme:JF,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"}}},tj="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",ej={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:tj,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:tj,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:CB,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"}}}}},ij={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}}},sj=Object.assign(Object.assign({},ij),{label:{space:0}}),nj={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}}}}},rj="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;",aj={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:rj,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:rj,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}}}},oj={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}},lj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}},hj={horizontal:Object.assign(Object.assign({},oj),{rail:{width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:lj}),vertical:Object.assign(Object.assign({},oj),{rail:{width:8,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:lj})},cj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}},dj={horizontal:Object.assign(Object.assign({},oj),{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:cj}),vertical:Object.assign(Object.assign({},oj),{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:cj})},uj={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"}}}}},pj={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"}}}}},gj={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 mj(t,e){return t&&e.key in t?t[e.key]:e.default}function fj(t){return t&&"token"===t.type&&!!t.key}const vj={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%"},_j={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:QF,token:vj,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:ej,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},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:hj,sizeLegend:dj,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:ij,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:sj,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:pj,markArea:uj,markPoint:gj,polarMarkLine:pj,polarMarkArea:uj,polarMarkPoint:gj,geoMarkPoint:gj,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",textAlign:"left",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"},textAlign:"left",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:aj,crosshair:nj,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},yj={name:"dark",colorScheme:{default:{dataScheme:JF,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"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},bj=(t,e)=>t===e||!d(t)&&!d(e)&&(y(t)&&y(e)?e.every((e=>t.some((t=>bj(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>bj(t[i],e[i])))),xj=(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]={}),xj(t[s],e.slice(1),i))};function Sj(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]=Sj(n,e)}return s}function Aj(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])?kj(t,e,r,i):Mj(t,r,s[r])}}}}function kj(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?Tj({},t[n][e.index],i):i):t[n]=s?Tj({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?Tj({},t[n][r],i):i)}else t.id===e&&(t[n]=s?Tj({},t[n],i):i)}))}function Cj(t,...e){return Tj(Ej(t),...e.map(Ej))}function Ej(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]=jF(s),e}),{}));return t}(t.colorScheme),{series:s}=t,{mark:n,markByName:r}=t;let a;return(n||r)&&(a=Object.keys(CF).reduce(((t,e)=>{var i;const a=null!==(i=null==s?void 0:s[e])&&void 0!==i?i:{};return t[e]=Pj(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 Pj(t,e,i,s){if(!CF[e])return t;const n={};return Object.values(CF[e]).forEach((({type:e,name:r})=>{n[r]=Tj({},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 Bj=["animationThreshold","colorScheme","name","padding"];function Rj(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];Bj.includes(r)?n[r]=a:f(a)?DF(a)?n[r]=IF(a,e,s):fj(a)?n[r]=mj(i,a):n[r]=Rj(a,e,i,s):n[r]=a})),n}const Lj={[_j.name]:_j},Oj=_j.name,Ij=new Map(Object.keys(Lj).map((t=>[t,Lj[t]]))),Dj=new Map(Object.keys(Lj).map((t=>[t,Rj(Lj[t])]))),Fj=new Map(Object.keys(Lj).map((t=>[t,t===Oj]))),jj=(t,e)=>{if(!t)return;const i=Nj(e);Ij.set(t,i),Dj.set(t,Rj(i)),Fj.set(t,!0)},zj=(t=Oj,e=!1)=>(Fj.has(t)&&!Fj.get(t)&&jj(t,Ij.get(t)),e?Dj.get(t):Ij.get(t)),Hj=t=>Ij.delete(t)&&Dj.delete(t)&&Fj.delete(t),Vj=t=>!!_(t)&&Ij.has(t),Nj=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:Oj;return Cj({},zj(i),t)};class Gj{static registerInstance(t){Gj.instances.set(t.id,t)}static unregisterInstance(t){Gj.instances.delete(t.id)}static getInstance(t){return Gj.instances.get(t)}static instanceExist(t){return Gj.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return Gj.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}Gj.instances=new Map;class Wj{static registerTheme(t,e){jj(t,e)}static getTheme(t,e=!1){return zj(t,e)}static removeTheme(t){return Hj(t)}static themeExist(t){return Vj(t)}static getDefaultTheme(){return Wj.themes.get(Oj)}static setCurrentTheme(t){Wj.themeExist(t)&&(Wj._currentThemeName=t,Gj.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return Wj.getTheme(Wj._currentThemeName,t)}static getCurrentThemeName(){return Wj._currentThemeName}}function Uj(t,e){return _(t)?Wj.themeExist(t)?Wj.getTheme(t,e):{}:g(t)?t:{}}function Yj(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]=Yj(t[s],e)}return i}return y(t)?t.map((t=>Yj(t,e))):t}function Kj(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]=Kj(t[s],e)}return i}return y(t)?t.map((t=>Kj(t,e))):t}Wj.themes=Ij,Wj._currentThemeName=Oj;function Xj(t,e){for(let i=0;it.key===e))}function qj(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 Zj(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:{}},iz(t,a,n[o],l,e,r))})),s?Jj(n):n}function Jj(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))):Jj(t[e].nodes);return t}function Qj(t,e){if("values"in t&&t.values.length){const i=JP(t.values,e),s=ZP(t.values,wD);t.values.forEach((t=>{t[PD]=i,t[BD]=s,delete t[RD]}));const n=t.values.reduce(((t,e)=>e[MD]>t[MD]?e:t));n[RD]=!0}else for(const i in t.nodes)Qj(t.nodes[i],e)}function tz(t){if(!t.values.length)return;const e=t.values[t.values.length-1][MD]/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[kD]=s,s+=r[MD],r[MD]=s):(r[kD]=n,n+=r[MD],r[MD]=n),r[AD]=t.key}if(i)for(let i=0;i=0?s:n;r=a>=0?1:-1,l[TD]=0===h?0:Math.min(1,l[kD]/h)*r,l[wD]=0===h?0:Math.min(1,l[MD]/h)*r}}for(const s in t.nodes)ez(t.nodes[s],e,i)}function iz(t,e,i,s,n,r,a){if("values"in e)if(n&&e.values.forEach((t=>t[MD]=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}),iz(t,e.nodes[o],i.nodes[o],s,n,r,l)}}const sz=(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]=rz(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function az(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>lz(t.style(e,i,s,n)):B(t.style)||(e.style=lz(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>lz(t.state[e](i,s,n,r)):B(t.state[e])||(i[e]=lz(t.state[e]))})),e.state=i}return e}function oz(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>lz(t[i](e,s,n,r)):B(t[i])||(e[i]=lz(t[i]))})),e}function lz(t){return(null==t?void 0:t.angle)&&(t.angle=te(t.angle)),t}class hz{static registerChart(t,e){hz._charts[t]=e}static registerSeries(t,e){hz._series[t]=e}static registerComponent(t,e,i){hz._components[t]={cmp:e,alwaysCheck:i}}static registerMark(t,e){hz._marks[t]=e}static registerRegion(t,e){hz._regions[t]=e}static registerTransform(t,e){hz.transforms[t]=e}static registerLayout(t,e){hz._layout[t]=e}static registerAnimation(t,e){hz._animations[t]=e}static registerImplement(t,e){hz._implements[t]=e}static registerChartPlugin(t,e){hz._chartPlugin[t]=e}static registerComponentPlugin(t,e){hz._componentPlugin[t]=e}static createChart(t,e,i){if(!hz._charts[t])return null;return new(0,hz._charts[t])(e,i)}static createChartSpecTransformer(t,e){if(!hz._charts[t])return null;const i=hz._charts[t];return new(0,i.transformerConstructor)(Object.assign({seriesType:i.seriesType},e))}static createRegion(t,e,i){if(!hz._regions[t])return null;return new(0,hz._regions[t])(e,i)}static createRegionSpecTransformer(t,e){if(!hz._regions[t])return null;return new(0,hz._regions[t].transformerConstructor)(e)}static createSeries(t,e,i){if(!hz._series[t])return null;return new(0,hz._series[t])(e,i)}static createSeriesSpecTransformer(t,e){if(!hz._series[t])return null;return new(0,hz._series[t].transformerConstructor)(e)}static createMark(t,e,i){if(!hz._marks[t])return null;const s=new(0,hz._marks[t])(e,i);return"group"===s.type&&s.setInteractive(!1),s}static getComponents(){return Object.values(hz._components)}static getComponentInKey(t){return hz._components[t].cmp}static getLayout(){return Object.values(hz._layout)}static getLayoutInKey(t){return hz._layout[t]}static getSeries(){return Object.values(hz._series)}static getSeriesInType(t){return hz._series[t]}static getRegionInType(t){return hz._regions[t]}static getAnimationInKey(t){return hz._animations[t]}static getImplementInKey(t){return hz._implements[t]}static getSeriesMarkMap(t){return hz._series[t]?hz._series[t].mark:{}}static getChartPlugins(){return Object.values(hz._chartPlugin)}static getComponentPlugins(){return Object.values(hz._componentPlugin)}static getComponentPluginInType(t){return hz._componentPlugin[t]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}}hz._charts={},hz._series={},hz._components={},hz._marks={},hz._regions={},hz._animations={},hz._implements={},hz._chartPlugin={},hz._componentPlugin={},hz.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}},hz.dataParser={csv:Yr,dsv:Ur,tsv:Kr},hz._layout={};const cz=(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))},dz=(t,e,i,s)=>{var n;const r=jw(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:uz(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("_")}`,pz=(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},gz=(t,e)=>{if(!t)return null;if(!rB(t.getRegionsInIndex(),"polar"))return null;const{x:i,y:s}=e,n=pz(t,(t=>"angle"===t.getOrient()),e),r=pz(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&&jw(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=eB({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=iB(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=dz(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&&jw(r.type)){const h=t.getCenter(),c={x:i-t.getLayoutStartPoint().x-h.x,y:s-t.getLayoutStartPoint().y-h.y};let d=eB({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=iB(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 _=dz(f,t,"polar",o);a.push({index:v,value:f,position:r.scale(f),axis:t,data:_})}})),a.length?a:null};function mz(t){return"bottom"===t||"top"===t}function fz(t){return"left"===t||"right"===t}function vz(t){return"z"===t}function _z(t,e){return UF(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function yz(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function bz(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?mz(t)?"linear":"band":mz(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const xz=t=>t.fieldX[0],Sz=t=>t.fieldY[0],Az=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},kz=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},Mz=(t,e)=>t?e?xz:Az:e?Sz:kz,Tz=(t,e,i)=>{var s,n;if(!t)return null;if(!rB(t.getRegionsInIndex(),"cartesian"))return null;const{x:r,y:a}=e,o=null!==(s=pz(t,(t=>mz(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=pz(t,(t=>fz(t.getOrient())),e))&&void 0!==n?n:[],h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{jw(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=wz(s,i,t,Mz(e,jw(s.getScale().type)));n&&u.push(n)}}else{const n=h.size>0;if((n?h:c).has(s)){const r=wz(s,i,t,Mz(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},wz=(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 Cz(t,a,s)},Cz=(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=dz(e,t,"cartesian",null!=i?i:mz(t.getOrient())?xz:Sz);return{index:n,value:e,position:s.scale(e),axis:t,data:r}};class Ez{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:$y)("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:$y)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s;const n=null!==(i=Tz(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(s=gz(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=>jw(t.getScale().type))),r=n.length?n:s.filter((t=>{const e=t.getOrient();return mz(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=Cz(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var Pz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Pz||(Pz={}));const Bz={[Pz.dimensionHover]:class extends Ez{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)=>!cz(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}),tb(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}),tb(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[Pz.dimensionClick]:class extends Ez{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 Rz=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(Bz[t]){const e=new Bz[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(Bz[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}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class Lz{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}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const Oz={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 Iz{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 Lz);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}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 Oz[a]&&(a=Oz[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.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 hD.includes(e)||Object.values(t.VGRAMMAR_HOOK_EVENT).includes(e)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&kR.hasInteraction(e)}}function Dz(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function Fz(t,e,i){t.getParser(e)||t.registerParser(e,i)}const jz=new Map;let zz;function Hz(){zz||(zz=new va,Fz(zz,"geojson",da),Fz(zz,"topojson",pa),Dz(zz,"simplify",Rr))}function Vz(t,e,i={type:"geojson",centroid:!0}){jz.has(t)&&Xy(`map type of '${t}' already exists, will be overwritten.`),Hz();const s=new ya(zz),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}),jz.set(t,s)}function Nz(t){jz.has(t)?jz.delete(t):Xy(`map type of '${t}' does not exists.`)}function Gz(t,e=!1){let i=e;return t.latestData instanceof ya&&(i=!1),i?I(t.latestData):t.latestData.slice()}const Wz=(t,e)=>0===t.length?[]:1===t.length?Gz(t[0],null==e?void 0:e.deep):t.map((t=>Gz(t,null==e?void 0:e.deep)));function Uz(t,e,i){Dz(e=e instanceof va?e:t.dataSet,"copyDataView",Wz);const s=new ya(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:Xz.copyDataView}),s}function Yz(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:$y)(`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:$y)(`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([]),Xy("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 Kz(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var Xz;!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"}(Xz||(Xz={}));const $z=(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 uO(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:tH(this._option.mode),autoFit:!1,eventConfig:{gesture:tb(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())}clear(t,e=!1){const{chart:i}=t;i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=P_.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this._nextRafId&&(P_.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null),this._isRunning||(this.initView(),this._view&&(this._isRunning=!0,null===(e=this._view)||void 0===e||e.run(t),this._isRunning=!1,this._nextRafId&&(P_.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,this._isRunning=!0,null===(i=this._view)||void 0===i||i.run(t),this._isRunning=!1))))}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.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 Qy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function iH(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:$y)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function sH(t){t.crosshair=Y(t.crosshair||{}).map((e=>Tj({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function nH(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&&Qy(e.mode)){let t;t=_(h)?null===document||void 0===document?void 0:document.getElementById(h):h;const{width:e,height:s}=ii(t,i.width,i.height);a=e,o=s}else if(eb(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 rH(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")}),t}function aH(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"}(Jz||(Jz={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(Qz||(Qz={}));class oH{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({},oH.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]))))}}oH.defaultMarkInfo={};class lH{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new oH,this._markReverse=new oH,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement(Jz.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement(Jz.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement(Jz.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement(Jz.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement(Jz.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(Jz.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[Jz.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[Jz.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(Pz.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 hH={};Object.values(Jz).forEach((t=>{hH[t]=!0}));const cH={[Jz.STATE_HOVER]:Jz.STATE_HOVER_REVERSE,[Jz.STATE_SELECTED]:Jz.STATE_SELECTED_REVERSE,[Jz.STATE_DIMENSION_HOVER]:Jz.STATE_DIMENSION_HOVER_REVERSE};function dH(t){return cH[t]}class uH{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=dH(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=dH(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=dH(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=dH(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 pH{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 gH extends pH{constructor(){super(...arguments),this.id=sb(),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 mH extends gH{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,s){super(t),this.grammarType=Zz.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 fH extends pH{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 mH(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 vH extends fH{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 _H extends vH{constructor(){super(...arguments),this.id=sb(),this.stateKeyToSignalName=t=>`${hB}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===qz.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===qz.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?qz.none:qz.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?qz.exit:qz.appear}}}}class yH{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=>Tj({},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 bH extends pH{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=yH,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new oH,this._lastLayoutRect=null,this.id=sb(),this.userId=t.id,this._spec=t,this.effect={},this.event=new Rz(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=`${hB}_${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=hz.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 xH{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=XF($F(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:KF(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:KF(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:KF(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:KF(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:KF(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:KF(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=KF(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=KF(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]=KF(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 SH extends bH{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 xH(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 AH extends yH{_initTheme(t,e){return{spec:t,theme:this._theme}}}class kH extends SH{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=AH,this.modelType="region",this.specKey="region",this.type=kH.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.interaction=new uH,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 _H({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 lH(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 Qz)B(t.stateStyle[Qz[e]])||this.interaction.registerMark(Qz[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 MH(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 TH(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 wH(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 CH(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),wH(c,!0,u,o),s&&TH(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function EH(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),wH(c,!1,u,a),s&&TH(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function BH(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}=MH(t);s.length&&CH(s,e,i,!1,"left"),n.length&&CH(n,e,i,!0,"left"),r.length&&EH(r,e,0,"left")}(e,this,a),s.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=MH(t);s.length&&PH(s,e,i,!1,"top"),n.length&&PH(n,e,i,!0,"top"),r.length&&BH(r,e,0,"top")}(s,this,r),i.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=MH(t);s.length&&CH(s,e,i,!1,"right"),n.length&&CH(n,e,i,!0,"right"),r.length&&EH(r,e,0,"right")}(i,this,a),n.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=MH(t);s.length&&PH(s,e,i,!1,"bottom"),n.length&&PH(n,e,i,!0,"bottom"),r.length&&BH(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:$y)("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}}}RH.type="base";const LH=["line","area","trail"];function OH(t){return LH.includes(t)}class IH extends vH{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(OH)?s:!t.mark||OH(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=>!!hH[t])).map((t=>[t,10])),s=!t.mark||OH(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(hB)));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(hB)));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(Dw(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 DH extends gH{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=Zz.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 FH extends DH{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${hB}_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 jH extends gH{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=Zz.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 IH(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 Rz(s.getOption().eventDispatcher,s.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new FH(t)}stateKeyToSignalName(t){return`${hB}_${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=Jz.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=Jz.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===qz.appear&&this.runAnimationByState(qz.normal)})):this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,(()=>{this.runAnimationByState(qz.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),this._morph&&this._morphKey&&(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 zH extends jH{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].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))}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&&Tj(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(Fw(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=NF(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()):FD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Fw(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=LF(RF(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({},VD[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)FD.includes(null===(o=n.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(n.stroke)(t,e));else{const e=LF(RF(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 HH extends zH{constructor(){super(...arguments),this.type=HH.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)?(Xy("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?(Xy("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})}))}}HH.type="group";const VH=()=>{fM(),iM(),kR.registerGraphic(RB.group,ku),hz.registerMark(HH.type,HH)},NH={type:"clipIn"},GH={type:"fadeIn"};function WH(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 GH;default:return NH}}const UH={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"}},YH={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},KH={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},XH=()=>{hz.registerAnimation("scaleInOut",(()=>YH))},$H=()=>{hz.registerAnimation("fadeInOut",(()=>KH))},qH=(t,e)=>({appear:WH(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:Hc,duration:UH.update.duration,easing:UH.update.easing}],disappear:{type:"clipOut"}}),ZH=()=>{hz.registerAnimation("line",qH)},JH=()=>{uO.useRegisters([UI,YI,KI,XI,$I,qI,II,DI])},QH={measureText:(t,e,i,s)=>((t,e,i)=>GM(t,e,i,{fontFamily:vj.fontFamily,fontSize:vj.fontSize}))(e,i,s).measure(t)};class tV{static instance(){return tV.instance_||(tV.instance_=new tV),tV.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 eV{constructor(){this.id=sb(),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))?Xy("不要重复添加相同的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 iV extends eV{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 sV{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>hz.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>hz.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>hz.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return hz.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>hz.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){hz.registerTransform(t,e)}static registerFunction(t,e){t&&e&&tV.instance().registerFunction(t,e)}static unregisterFunction(t){t&&tV.instance().unregisterFunction(t)}static getFunction(t){return t?tV.instance().getFunction(t):null}static getFunctionList(){return tV.instance().getFunctionNameList()}static registerMap(t,e,i){const s=hz.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=hz.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,jz.get(e);var e}static hideTooltip(t=[]){Gj.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,c;this.id=sb(),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 d=this._option,{dom:u,renderCanvas:p,mode:g,stage:m,poptip:f}=d,v=e(d,["dom","renderCanvas","mode","stage","poptip"]),y=Qy(g);y&&u&&(this._container=_(u)?null===document||void 0===document?void 0:document.getElementById(u):u),p&&(this._canvas=p),m&&(this._stage=m),"node"===g||this._container||this._canvas||this._stage?(y?Cx(ql):"node"===g&&TA(ql),this._viewBox=this._option.viewBox,this._currentThemeName=Wj.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new eH({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:p},Object.assign(Object.assign({mode:this._option.mode,stage:m,pluginList:!1!==f?["poptipForText"]:[]},v),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new Iz(this,this._compiler),this._event=new Rz(this._eventDispatcher,g),this._compiler.initView(),null===(o=this.getStage())||void 0===o||o.setTheme({text:{fontFamily:null===(l=this._currentTheme)||void 0===l?void 0:l.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!y&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),Gj.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=Tj({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=Yj(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;sV.getFunctionList()&&sV.getFunctionList().length&&(t=Kj(t,sV)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=hz.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=hz.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=hz.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 nH(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:cB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:dB})}_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,Fz(this._dataSet,"dataview",ga),Fz(this._dataSet,"array",s),Dz(this._dataSet,"stackSplit",$z),Dz(this._dataSet,"copyDataView",Wz);for(const t in hz.transforms)Dz(this._dataSet,t,hz.transforms[t]);for(const t in hz.dataParser)Fz(this._dataSet,t,hz.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),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;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,null===(s=this._compiler)||void 0===s||s.releaseGrammar(!1===(null===(n=this._option)||void 0===n?void 0:n.animation)||!1===(null===(r=this._spec)||void 0===r?void 0:r.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.reCompile&&(null===(a=this._compiler)||void 0===a||a.clear({chart:this._chart,vChart:this},!this._option.animation||!this._spec.animation),null===(o=this._compiler)||void 0===o||o.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(){var t,e;this._option.animation&&(null===(t=this._chart)||void 0===t||t.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(qz.update,!0)})),null===(e=this._chart)||void 0===e||e.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(qz.update,!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,Gj.unregisterInstance(this)}updateData(t,e,s){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s)}))}_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){return u(this._dataSet)?this:this._chart?(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){if(this._chart)return this._chart.updateFullData(t),e&&this._compiler.render(),this;const i=Y(this._spec.data);return Y(t).forEach((t=>{var e;const{id:s,values:n,parser:r,fields:a}=t,o=i.find((t=>t.name===s));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 s=Yz(t,this._dataSet,i,{onError:null===(e=this._option)||void 0===e?void 0:e.onError});y(this._spec.data)&&this._spec.data.push(s)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i){const s=this._updateSpec(t,e);return s?(this.updateCustomConfigAndRerender(s,!0,{morphConfig:i,transformSpec:s.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){var i,s;const n=this._spec;if(!this._setNewSpec(t,e))return;G(n.theme,this._spec.theme)||this._setCurrentTheme();const r=this._shouldChartResize(n);return null===(s=null===(i=this._compiler)||void 0===i?void 0:i.getVGrammarView())||void 0===s||s.updateLayoutTag(),this._spec.type!==n.type?{reTransformSpec:!0,change:!0,reMake:!0,reCompile:!1,reSize:r}:(this._initChartSpec(this._spec,"render"),rH(this._chart.updateSpec(this._spec),{reTransformSpec:!1,change:r,reMake:!1,reCompile:!1,reSize:r}))}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)||wj(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)||wj(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=Tj({},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=Uj(this._currentThemeName,!0);else if(_(s)&&(!n||_(n))||_(n)&&(!s||_(s))){const t=Cj({},Uj(this._currentThemeName,!0),Uj(s,!0),Uj(n,!0));this._currentTheme=t}else{const t=Cj({},Uj(this._currentThemeName),Uj(s),Uj(n));this._currentTheme=Rj(t)}var r;r=R(this._currentTheme,"component.poptip"),z(eT.poptip,tT,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=!!Qy(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?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return Uj(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){if(!Wj.themeExist(t))return this;const e=this._setCurrentTheme(t);return yield this.updateCustomConfigAndRerender(e,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){if(!Wj.themeExist(t))return this;const e=this._setCurrentTheme(t);return this.updateCustomConfigAndRerender(e,!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}}_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 iH(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(!Qy(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)?null===document||void 0===document?void 0:document.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?qF(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 Xy("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?qF(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Xy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return tV.instance().getFunction(t)}registerFunction(t,e){t&&e&&tV.instance().registerFunction(t,e)}unregisterFunction(t){t&&tV.instance().unregisterFunction(t)}getFunctionList(){return tV.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}_initChartPlugin(){const t=hz.getChartPlugins();t.length>0&&(this._chartPlugin=new iV(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}}}sV.InstanceManager=Gj,sV.ThemeManager=Wj,sV.globalConfig={uniqueTooltip:!0},sV.Utils=QH,sV.vglobal=P_;hz.registerRegion("region",kH),hz.registerLayout("base",RH),VH(),uO.useRegisters([tI,eI]),uO.useRegisters([sD,nD,FI,jI,eD,iD,rD,aD,oD]),UR(),WR(),jj(yj.name,yj),at.getInstance(rt.Error);const nV=(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(oB).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=hz.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=hz.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},rV=(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=nV(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):bj(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const m=Tj({},i),f=d(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:Tj(m,f),hasChanged:!0};const i=Tj({},t,f);xj(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 aV{constructor(t){this.id=sb(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}const oV=t=>{hz.registerChartPlugin(t.type,t)};class lV extends aV{constructor(){super(lV.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[lV.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[lV.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=Sj(this._option.globalInstance.getSpec(),["data",lV.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=Sj(this._baseChartSpec,["data",lV.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=rV(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=Sj(i,["data",lV.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()}}lV.pluginType="chart",lV.specKey="media",lV.type="MediaQueryPlugin";const hV=/\{([^}]+)\}/,cV=/\{([^}]+)\}/g,dV=/:/;class uV extends aV{constructor(){super(uV.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[uV.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)),hz.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=hV.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(cV,((t,i)=>{if(!dV.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}}uV.pluginType="chart",uV.specKey="formatter",uV.type="formatterPlugin";const pV=()=>{oV(uV)};function gV(t){return 2===t.length&&k(t[0])&&k(t[1])&&t[1]>=t[0]}function mV(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 fV(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 vV(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 _V(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 yV(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 bV=(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 RC(v)};class xV extends aV{constructor(){super(xV.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!Dw(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&&gV(c)&&gV(d)))return;const u=mV(t,c),p=mV(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(!vV(u,p))return}else if(0===y&&0===b){if(!vV(p,u))return}else if(_||A)if(_&&!A){if(!fV(u,p))return}else if(A&&!_){if(!fV(p,u))return}else{if(m===b)return;if(m>b){if(!_V(u,p))return}else if(!_V(p,u))return}else{if(0===m&&0===y){if(!yV(u,p))return}else if(0===b&&0===g&&!yV(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){Dz(e.getOption().dataSet,"tickAlign",bV);const t={targetAxis:()=>s,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}xV.pluginType="component",xV.type="AxisSyncPlugin";const SV=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,AV=(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},mm||(mm=pm.CreateGraphic("richtext",{})),mm.setAttributes(a),mm.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}},kV="vchart-tooltip-container",MV={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}};function TV(t,e){return R(e,`component.${t}`)}function wV(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=hz.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const CV={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function EV(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 PV(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 BV(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function RV(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}const LV=(t,e,i)=>{var s;const n=null!==(s="band"===e?TV("axisBand",i):["linear","log","symlog"].includes(e)?TV("axisLinear",i):{})&&void 0!==s?s:{},r=mz(t)?TV("axisX",i):fz(t)?TV("axisY",i):TV("axisZ",i);return Tj({},TV("axis",i),n,r)},OV=(t,e,i)=>{var s;const n=null!==(s="band"===e?TV("axisBand",i):"linear"===e?TV("axisLinear",i):{})&&void 0!==s?s:{},r=TV("angle"===t?"axisAngle":"axisRadius",i);return Tj({},TV("axis",i),n,r)},IV=t=>"band"===t||"ordinal"===t||"point"===t;function DV(t,e){return{id:t,label:t,value:e,rawValue:t}}function FV(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 jV(t,e,i,s){let n=0,r=t.length-1;for(;n<=r;){const a=Math.floor((n+r)/2),o=t[a];if(o[i]<=e&&o[s||i]>=e)return o;o[i]>e?r=a-1:n=a+1}return null}const zV=(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(jw(a.type))A=a.bandwidth(),0===A&&a.step&&(M=a.step());else if(Dw(a.type)){const s=e.fieldX[0],r=e.fieldX2,a=jV(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=EV(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(jw(r.type))k=r.bandwidth(),0===k&&r.step&&(T=r.step());else if(Dw(r.type)){const s=e.fieldY[0],r=e.fieldY2,a=jV(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=EV(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(VV(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&&HV(t,"top",r.label),e.visible&&HV(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(VV(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&&HV(t,"left",a.label),e.visible&&HV(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}},HV=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=wV(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},VV=(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)}))}))},NV=(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=WV(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},GV=(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=WV(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},WV=(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},UV=(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},YV={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"]},KV=(t,e)=>{var i,s;return null!==(s=null===(i=YV[t])||void 0===i?void 0:i[0])&&void 0!==s?s:e},XV=(t,e)=>{var i,s;return null!==(s=null===(i=YV[t])||void 0===i?void 0:i[1])&&void 0!==s?s:e},$V=(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}=zV(3,e,i,s,n,r,a);return o?NV(r,o,d,h):l?GV(a,l,u,c):void 0},qV={fontFamily:vj.fontFamily,spacing:10,wordBreak:"break-word"};function ZV(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:qV),{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 JV=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},QV=(t,e)=>p(e)?t.map((t=>e[t])):void 0,tN=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),eN=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function iN(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=sN(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=>tN(i,s)(t)&&tN(n,r)(t)&&(u(a)||tN([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 sV.globalConfig.uniqueTooltip&&sV.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 sV.globalConfig.uniqueTooltip&&sV.hideTooltip(u.id),d}return"none"}const sN=(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=QV(c,t);let _=QV(d,t);const y=eN(_),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(tN(c,v));if(!y&&(_=QV(d,i),!eN(_)))return;const n=e.type===oB.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=jw(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(tN(c,n));f.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=QV(d,o),!eN(_))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(tN(c,n));if(!y&&(_=QV(d,r),!eN(_)))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===oB.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(tN(c,v))).find((t=>t[g]===m));f.forEach((n=>{if(_=QV(d,i),!eN(_))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},nN=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 rN=(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 aN{constructor(){this.activeTriggerSet={mark:new Set,dimension:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set,dimension:new Set,group:new Set}}}class oN extends aN{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:hN(e.title,{seriesId:this.series.id},!0),content:cN(e.content,{seriesId:this.series.id},!0)}))})),this.spec=a,this.activeType=nN(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 lN=(t,e,i)=>{const s=d(e)?e(t):e;return i?Object.assign(Object.assign({},t),s):Object.assign(Object.assign({},s),t)},hN=(t,e,i)=>p(t)?d(t)?(...s)=>lN(t(...s),e,i):lN(t,e,i):void 0,cN=(t,e,i)=>{const s=p(t)?Y(t).map((t=>d(t)?(...s)=>Y(t(...s)).map((t=>lN(t,e,i))):lN(t,e,i))):void 0;return s},dN=(t,e,i)=>{var s;let n={};switch(t){case"mark":case"group":e&&(n=null!==(s=rN(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=rN(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},uN=(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=pN(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)&&nN(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},pN=ft((t=>t.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(p))),[]))),gN=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},mN=(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}=wV(void 0,s,t,e);i&&r&&(n=i(...r))}return n},vN=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;class _N{}_N.dom=`${hB}_TOOLTIP_HANDLER_DOM`,_N.canvas=`${hB}_TOOLTIP_HANDLER_CANVAS`;const yN=20,bN={key:"其他",value:"..."},xN=(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)},SN=(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=vN(t.title,e,i),{visible:h,value:c,valueTimeFormat:p,valueTimeFormatMode:g,valueStyle:m,hasShape:f,valueFormatter:v}=null!=l?l:{},_=!1!==fN(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:xN(fN(c,t,i,v),p,g),valueStyle:fN(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=yN}=t,x=t.othersLine?Object.assign(Object.assign({},bN),t.othersLine):bN,S=t=>{if(null==t?void 0:t.length)for(const e of t)for(const t of null!=y?y:[]){const s=AN(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=AN(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},AN=(t,e,i)=>{const s=xN(fN(e.key,t,i,e.keyFormatter),e.keyTimeFormat,e.keyTimeFormatMode),n=xN(fN(e.value,t,i,e.valueFormatter),e.valueTimeFormat,e.valueTimeFormatMode),r=!1!==fN(e.visible,t,i)&&(p(s)||p(n)),a=fN(e.isKeyAdaptive,t,i),o=fN(e.spaceRow,t,i),l=fN(e.shapeType,t,i),h=fN(e.shapeColor,t,i),c=fN(e.shapeFill,t,i),d=fN(e.shapeStroke,t,i),u=fN(e.shapeLineWidth,t,i),g=fN(e.shapeHollow,t,i),m=fN(e.keyStyle,t,i),f=fN(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 kN extends aV{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=vN(x.position,b,e),M=null!==(n=vN(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:cB,R=null!==(o=null==P?void 0:P.height)&&void 0!==o?o:dB;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(Qy(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=SV(t,e),j=SV(T,D)}}else O.width=B,O.height=R;const z=j/F;let H,V,N,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=$V(e.dimensionInfo,rB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.x,a=t.end.x)}else W=t;if(L)switch(KV(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=$V(e.dimensionInfo,rB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.y,a=t.end.y)}else U=t;if(L)switch(XV(t)){case"top":V=r-C*z-_;break;case"bottom":V=a+_;break;case"center":V=(r+a)/2-C*z/2;break;case"centerTop":V=(r+a)/2-C*z-_;break;case"centerBottom":V=(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=UV(t,c),V=UV(i,c),N=UV(e,c),G=UV(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=UV(t,c):Y(t),S(e)||d(e)?V=UV(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(N))$=B-w*z-N;else{const t=Z;switch(KV(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(V))q=V;else if(k(G))q=R-C*z-G;else{const t=J;switch(XV(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,Qy(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"===KV(A,"right")?$+=v+w/2:$+=2*v+w)},at=()=>{et()&&($=-D.x/j)},ot=()=>{it()&&(L?$=(Q-D.x)/j-w:"center"===KV(A,"right")?$-=v+w/2:$-=2*v+w)},lt=()=>{it()&&($=(Q-D.x)/j-w)},ht=()=>{st()&&(L?q=-D.y/j:"center"===XV(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"===XV(A,"bottom")?q-=_+C/2:q-=2*_+C)},ut=()=>{nt()&&(q=(tt-D.y)/j-C)};switch(KV(A,"right")){case"center":case"centerLeft":case"centerRight":et()?(rt(),lt()):(ot(),at());break;case"left":rt(),lt();break;case"right":ot(),at()}switch(XV(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({},MV),{offsetX:null!==(t=null==i?void 0:i.x)&&void 0!==t?t:MV.offsetX,offsetY:null!==(e=null==i?void 0:i.y)&&void 0!==e?e:MV.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:_}=l,y=ei(d.padding),b=$F(d.padding),x=ZV(u,i),S=ZV(m,i),A=ZV(f,i),k={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},M={panel:JV(d),padding:y,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,maxContentHeight:_,enterable:h,transitionDuration:c},{title:T={},content:w=[]}=t;let C=b.left+b.right,E=b.top+b.bottom,P=b.top+b.bottom,B=0;const R=w.filter((t=>(t.key||t.value)&&!1!==t.visible)),L=!!R.length;let O=0,I=0,D=0,F=0;if(L){const t=[],e=[],i=[],s=[];let n=0;M.content=R.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:M,shapeColor:T}=r,w={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=Tj({},S,ZV(b,void 0,{})),{width:s,height:n,text:r}=AV(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=Tj({},A,ZV(x,void 0,{})),{width:e,height:s,text:n}=AV(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;M?t.stroke=e:t.fill=e,t.stroke=null!=u?u:e,t.lineWidth=g,w.shape=t;const i=null!=m?m:k.size;o=Math.max(i,o),s.push(i)}else w.shape={visible:!1};return w.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(V){U=Tj({},x,ZV(G,void 0,{})),Y()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:L?Math.ceil(B):void 0);const{text:t,width:e,height:i}=AV(N,U);M.title.value=Object.assign(Object.assign({width:Y()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),j=M.title.value.width,z=M.title.value.height,H=z+(L?M.title.spaceRow:0)}return E+=H,P+=H,M.title.width=j,M.title.height=z,Y()?C+=B||j:C+=Math.max(j,B),L&&M.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=C-b.left-b.right-F-O-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),M.valueWidth=Math.max(M.valueWidth,i.width))})),M.panel.width=C,M.panel.height=E,M.panelDomHeight=P,M})(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(Qy(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=SV(t,s),u=SV(l,c)}return s*=d,n*=d,Qy(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()}}kN.specKey="tooltip";const MN=(t,e)=>p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",TN=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 wN;const CN=(t=document.body)=>{if(u(wN)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),wN=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return wN};function EN(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}=null!=t?t:{},{fill:m,shadow:f,shadowBlur:v,shadowColor:_,shadowOffsetX:y,shadowOffsetY:b,shadowSpread:x,cornerRadius:S,stroke:A,lineWidth:k=0,width:M=0}=n,{value:T={}}=o,{shape:w={},key:C={},value:E={}}=l,P=function(t,e){if(!t)return;const{size:i}=Tj({},e,t),s={};return s.width=MN(i),s}(w),B=PN(C),R=PN(E),{bottom:L,left:O,right:I,top:D}=$F(h);return{panel:{width:MN(M+2*k),minHeight:MN(g+2*k),paddingBottom:MN(L),paddingLeft:MN(O),paddingRight:MN(I),paddingTop:MN(D),borderColor:A,borderWidth:MN(k),borderRadius:MN(S),backgroundColor:m?`${m}`:"transparent",boxShadow:f?`${y}px ${b}px ${v}px ${x}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)?MN(null==r?void 0:r.spaceRow):"0px"},PN(Tj({},T,null==r?void 0:r.value))),content:{},shapeColumn:{common:P,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 BN.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=BN.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==Jy?void 0:Jy.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(BN.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}}BN.type="tooltipModel";const RN={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},LN={boxSizing:"border-box"},ON={display:"inline-block",verticalAlign:"top"},IN={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},DN={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},FN={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},jN={lineHeight:"normal",boxSizing:"border-box"};class zN extends BN{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,l;if(!(null==t?void 0:t.hasShape)||!t.symbolType)return"";const{symbolType:h,fill:c,stroke:d,hollow:u=!1}=t,p=t.size?e(t.size):"8px",m=t.lineWidth?e(t.lineWidth)+"px":"0px";let f="currentColor";const v=()=>d?e(d):f,y=TN(p),b=t=>new yg({symbolType:t,size:y,fill:!0});let x=b(null!==(i=HN[h])&&void 0!==i?i:h);const S=x.getParsedPath();S.path||(x=b(S.pathStr));const A=x.getParsedPath().path,k=A.toString(),M=A.bounds;let T=`${M.x1} ${M.y1} ${M.width()} ${M.height()}`;if("0px"!==m){const[t,e,i,s]=T.split(" ").map((t=>Number(t))),n=Number(m.slice(0,-2));T=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}if(!c||_(c)||u)return f=u?"none":c?e(c):"currentColor",`\n \n \n \n `;if(g(c)){f=null!==(s="gradientColor"+t.index)&&void 0!==s?s:"";let i="";const h=(null!==(n=c.stops)&&void 0!==n?n:[]).map((t=>``)).join("");return"radial"===c.gradient?i=`\n ${h}\n `:"linear"===c.gradient&&(i=`\n ${h}\n `),`\n \n ${i}\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=""}}const HN={star:"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"};class VN extends BN{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 NN={overflowWrap:"normal",wordWrap:"normal"};class GN extends BN{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(Tj({},ON,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=Tj({},o?DN:IN,Object.assign(Object.assign(Object.assign({height:MN(l)},NN),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 Tj({},FN,Object.assign(Object.assign(Object.assign({height:MN(s)},NN),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 Tj({},jN,Object.assign(Object.assign({height:MN(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 WN extends BN{init(){this.product||(this.product=this.createElement("div",["container-box"])),this.shapeBox||this._initShapeBox(),this.keyBox||this._initKeyBox(),this.valueBox||this._initValueBox()}_initShapeBox(){const t=new GN(this.product,this._option,"shape-box",0);t.init(),this.shapeBox=t,this.children[t.childIndex]=t}_initKeyBox(){const t=new GN(this.product,this._option,"key-box",1);t.init(),this.keyBox=t,this.children[t.childIndex]=t}_initValueBox(){const t=new GN(this.product,this._option,"value-box",2);t.init(),this.valueBox=t,this.children[t.childIndex]=t}setStyle(t){super.setStyle(Tj(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+TN(e)),0);return Object.assign(Object.assign({},t),{width:`${a+CN(this._option.getContainer())}px`,maxHeight:MN(s),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class UN extends BN{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{title:e}=t;(null==e?void 0:e.hasShape)&&(null==e?void 0:e.shapeType)?this.shape||this._initShape():this.shape&&this._releaseShape(),this.textSpan||this._initTextSpan()}_initShape(){const t=new zN(this.product,this._option,0);t.init(),this.shape=t,this.children[t.childIndex]=t}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(){const t=new VN(this.product,this._option,1);t.init(),this.textSpan=t,this.children[t.childIndex]=t}setStyle(t){var e,i,s,n;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),{title:o}=a;super.setStyle(Tj({},RN,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 YN="99999999999999";class KN extends BN{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:YN,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 UN(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 WN(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(Tj({},LN,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 XN=t=>{hz.registerComponentPlugin(t.type,t)};class $N extends kN{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($N.type),this.type=_N.dom,this._tooltipContainer=null==Jy?void 0:Jy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(Jy&&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=EN(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()}))}}$N.type=_N.dom;class qN extends kN{constructor(){super(qN.type),this.type=_N.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 XP({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()}}qN.type=_N.canvas;const ZN=()=>{XN(qN)},JN=(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},QN={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}},tG=(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=Xj([],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 eG(a,n,o)},eG=(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)=>{nb(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=>{nb(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]=QN[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},iG=(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=>{nb(t[e])||(t[e]=0)}))})),t};class sG extends DH{_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 nG=`${hB}_HIERARCHY_DEPTH`,rG=`${hB}_HIERARCHY_ROOT`,aG=`${hB}_HIERARCHY_ROOT_INDEX`;function oG(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function lG(t,e,i){t&&(i.needDefaultSeriesField&&(t[bD]=i.defaultSeriesField),t[_D]=e,t[yD]=i.getKey(t,e,i))}function hG(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function cG(t,e,i,s=0,n,r){void 0===r&&(r=e),lG(t,e,i),t[nG]=s,t[rG]=n||t[i.categoryField],t[aG]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>cG(e,s,i,t[nG]+1,t[rG],r)))}const dG=["appear","enter","update","exit","disappear","normal"];function uG(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 vG(n)&&delete n.type,n.oneByOne&&(n=gG(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:mG,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=Tj({},o[e],a);return vG(n)&&delete n.type,n.oneByOne&&(n=gG(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:mG,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s.state=s.update,s}function pG(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),_G(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 gG(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 mG(t,e){var i,s;return null!==(i=null==t?void 0:t[_D])&&void 0!==i?i:null===(s=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===s?void 0:s.elementIndex}function fG(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 vG(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function _G(t,e){if(y(t))t.forEach(((i,s)=>{t[s]=e(t[s],s),_G(t[s],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),_G(t[i],e)}class yG extends yH{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=EF(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=Pj(R(a,`series.${h}`),h,l,o),d=R(a,`series.${h}_${r}`);return Tj({},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),c(t.stackOffsetSilhouette)&&(this.stack=t.stackOffsetSilhouette||this.stack),p(t.stackValue)&&(this.stack=!0),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=Tj({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>Tj({},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 bG extends bH{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:`${hB}_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=yG,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=function(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)}(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)&&(Dz(this._rawData.dataSet,"invalidTravel",iG),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=Yz(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=Uz(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=Uz(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new sG(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;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){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];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):this._rawStatisticsCache[t]=eG(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t]}}return e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))&&(this._rawStatisticsCache[t].min=$(this._rawStatisticsCache[t].values),this._rawStatisticsCache[t].max=X(this._rawStatisticsCache[t].values)),this._rawStatisticsCache[t]}_statisticViewData(){Dz(this._dataSet,"dimensionStatistics",tG);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&&Xj(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){Dz(this._dataSet,"dimensionStatistics",tG);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=Xj(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&Xj(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)&&(Dz(this._rawData.dataSet,"addVChartProperty",JN),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:oG.bind(this),call:lG}},!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=uG({},pG(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"}}:tb(s)||eb(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=Tj(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=Tj(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:Jz.STATE_HOVER_REVERSE,highlightState:Jz.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:Jz.STATE_SELECTED_REVERSE,state:Jz.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 t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:bD;this.getMarksWithoutRoot().forEach((t=>{const s={},n={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(s[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{n[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:xD,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][i]]:!0===s[t[i]]});const a={};Object.keys(n).forEach((e=>{a[e]=s=>{var n,a;let o;if(Array.isArray(s)){if(0===s.length)return;o=null===(n=r[s[0][i]])||void 0===n?void 0:n[e]}return o=null===(a=r[s[i]])||void 0===a?void 0:a[e],o||t.getAttribute(e,s)}})),this.setMarkStyle(t,a,xD)}))}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 oN(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=null!=i?i:{data:!0}).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((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||Kz(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()}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:bD,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new HF).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return RF(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:bD}}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()}`),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,Tj({},h,d||a[T.name]))}return T}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:yD}_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!==MD&&t!==wD&&t!==kD&&t!==TD||(t=this.getStackValueField()),null!==(e=qj(this.getRawData(),t))&&void 0!==e?e:t}getMarkInfoList(){var t;const e=super.getMarkInfoList();return e.length?e:Object.values(null!==(t=CF[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=>nb(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:bD]}}function xG(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();Dw(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 SG(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}}}bG.mark=ND,bG.transformerConstructor=yG;class AG extends bG{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);Dw(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:`${hB}_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(MD),this.setFieldX2(kD)):(this.setFieldY(MD),this.setFieldY2(kD))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(wD),this.setFieldX2(TD)):(this.setFieldY(wD),this.setFieldY2(TD))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(ED),this.setFieldX2(CD)):(this.setFieldY(ED),this.setFieldY2(CD))}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)&&(xG("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 kG="monotone",MG="linear";class TG{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($D.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:MG,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===kG?"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($D.point,{morph:fG(this._spec,$D.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:`${hB}_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(Pz.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:Jz.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[$D.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(Pz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,Tj({},this._spec[$D.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:Jz.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 wG extends zH{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)&&(Fw(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);let c=this._styleConvert(h);a&&"angle"===l&&(c=this.convertAngleToRadian(c)),this.setAttribute(l,c,e,i,s)})),o&&this.setEnableSegments(o)}}class CG extends wG{constructor(){super(...arguments),this.type=CG.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)===oB.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}CG.type="line";const EG=()=>{hz.registerMark(CG.type,CG),fM(),aM(),kR.registerGraphic(RB.line,Ag),JH()};class PG extends zH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class BG extends PG{constructor(){super(...arguments),this.type=BG.type}}BG.type="symbol";const RG=()=>{hz.registerMark(BG.type,BG),fO()};class LG extends yG{_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 OG extends eV{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function IG(t,e,i,s){switch(t){case r.cartesianBandAxis:return LV(_z(i,["z"]),"band",e);case r.cartesianLinearAxis:return LV(_z(i,["z"]),"linear",e);case r.cartesianLogAxis:return LV(_z(i,["z"]),"log",e);case r.cartesianSymlogAxis:return LV(_z(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return LV(_z(i),void 0,e);case r.polarBandAxis:return OV(i.orient,"band",e);case r.polarLinearAxis:return OV(i.orient,"linear",e);case r.polarAxis:return OV(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=TV(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>mz(t.orient)));let d;d=p(c)?Tj({},IV(c.type)?a:o,l):l;const u=n.find((t=>fz(t.orient)));let g;return g=p(u)?Tj({},jw(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=TV(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>"angle"===t.orient));let d;d=p(c)?Tj({},IV(c.type)?a:o,l):l;const u=n.find((t=>"radius"===t.orient));let g;return g=p(u)?Tj({},jw(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 DG(i,TV(t,e));default:return TV(t,e)}}const DG=(t,e)=>{var i;const s=Tj({},e,e[yz(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class FG extends yH{getTheme(t,e){return IG(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({},$F(e)),{[s]:0}))}}class jG extends SH{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 OG(this)}constructor(e,i){super(e,i),this.name="component",this.modelType="component",this.transformerConstructor=FG,this._delegateEvent=(e,i,s,n=null,r=null)=>{var a,o;i instanceof ec||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 _H({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}}}jG.transformerConstructor=FG;class zG extends zH{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(RB.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}zG.type="component";const HG=()=>{hz.registerMark(zG.type,zG)},VG=t=>t;class NG extends jG{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()?DB.circleAxisGrid:DB.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=uG(null===(o=hz.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 DH(this._option,t)]}collectData(t,e){const i=[];return sB(this._regions,(s=>{var n;let r=this.collectSeriesField(t,s);if(r=y(r)?Dw(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 sB(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=nB(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()})),sB(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(sB(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;tthis._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=az(s=t.domainLine)).startSymbol=az(s.startSymbol),s.endSymbol=az(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 lz(Tj({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:lz(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)=>lz(t[i](e.rawValue,s,e,n,r)):B(t[i])||(e[i]=lz(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 lz(Tj({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:lz(t.tick.style)),t.tick.state&&(i.tick.state=oz(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 lz(Tj({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:lz(t.subTick.style)),t.subTick.state&&(i.subTick.state=oz(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=CV[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?te(p):null,textStyle:Tj({},d,lz(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:lz(h.style)}),h.state&&(i.title.state.shape=oz(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:lz(o.style)}),o.state&&(i.title.state.background=oz(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=oz(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=lz(t.background.style)),t.background.state&&(i.panel.state=oz(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 lz(Tj({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:lz(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:lz(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=wV(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){Fz(this._option.dataSet,"scale",VG),Dz(this._option.dataSet,"ticks",UC);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)}}NG.specKey="axes";const GG=()=>{kR.registerGraphicComponent(IB.lineAxis,((t,e)=>new Cw(t,e))),kR.registerGraphicComponent(IB.circleAxis,(t=>new Rw(t))),kR.registerComponent(LB.axis,FO),kR.registerGraphicComponent(DB.lineAxisGrid,((t,e)=>new qC(t,e))),kR.registerGraphicComponent(DB.circleAxisGrid,((t,e)=>new JC(t,e))),kR.registerComponent(LB.grid,HO),HG(),hz.registerAnimation("axis",(()=>({appear:{custom:Ow},update:{custom:Lw},exit:{custom:Wc}})))},WG=[xV];class UG extends NG{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),sB(this._regions,(t=>{const e=this.getOrient();mz(e)?t.setXAxisHelper(this.axisHelper()):fz(e)?t.setYAxisHelper(this.axisHelper()):vz(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=Tj({x:t.x,y:t.y},this._axisStyle,n);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(Tj({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=mz(this.getOrient()),n=t=>{var e;return(s?!mz(t.getOrient()):mz(t.getOrient()))&&Dw(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=_z(i,["z"]),vz(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(!BV(e))return null;const{axisType:t,componentName:s}=bz(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=>fz(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(!BV(t))return;const{axisType:s,componentName:n}=bz(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=hz.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=[];mz(this.getOrient())?k(e)&&(o=this._inverse?[e-n,s]:[s,e-n]):vz(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(WG.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){mz(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&&!mz(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),!vz(this.getOrient())&&this._spec.innerOffset){const t=this._spec;fz(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=KF(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=KF(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=mz(this.getOrient())?t.fieldX:vz(this.getOrient())?t.fieldZ:t.fieldY,Dw(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:Dw(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&&(mz(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=mz(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 sB(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]:mz(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:vz(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();sB(this._regions,(e=>{mz(t)?(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):fz(t)?(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):vz(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=mz(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=mz(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=Tj(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 DV(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}=PV(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>=YG?10:n>=KG?5:n>=XG?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 qG extends UG{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new TC}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}}qG.type=r.cartesianLinearAxis,qG.specKey="axes",U(qG,$G);const ZG=()=>{GG(),hz.registerComponent(qG.type,qG)};class JG{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=DV(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=>DV(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 QG extends UG{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new rC}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{GG(),hz.registerComponent(QG.type,QG)};class eW extends qG{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),sB(this._regions,(t=>{mz(this.getOrient())?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=Tj({},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 DH(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=>DV(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=>DV(e.value,this._getNormalizedValue([e.value],t))))),s}transformScaleDomain(){}}eW.type=r.cartesianTimeAxis,eW.specKey="axes";class iW extends qG{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new EC}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(){}}iW.type=r.cartesianLogAxis,iW.specKey="axes",U(iW,$G);class sW extends qG{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new PC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}transformScaleDomain(){}}sW.type=r.cartesianSymlogAxis,sW.specKey="axes",U(sW,$G);class nW extends AG{constructor(){super(...arguments),this.type=oB.line,this.transformerConstructor=LG,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(uG(null===(i=hz.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),pG("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=SG(this);this._symbolMark.setAnimationConfig(uG(null===(s=hz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),pG("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]}}nW.type=oB.line,nW.mark=qD,nW.transformerConstructor=LG,U(nW,TG);class rW{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)=>{Kz(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 aW{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)=>{rb(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{Xj(e,[{key:t,operations:Dw(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&&Xj(e,[{key:i.field,operations:Dw(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?NF("colorOrdinal"):NF(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(rb(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),rb(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(!rb(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=Dw(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=Dw(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;Dw(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(Dw(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=Dw(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)));Dw(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 oW{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=Zj(t,!0);for(const e in a)for(const i in a[e].nodes)ez(a[e].nodes[i],t.getStackInverse(),n);if(r)for(const t in a)for(const e in a[t].nodes)tz(a[t].nodes[e]);s&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&Qj(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 lW extends pH{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=sb(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:cB,height:dB},this._viewRect={width:cB,height:dB},this._viewBox={x1:0,y1:0,x2:cB,y2:dB},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=$F(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new Rz(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new rW(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._spec.background&&"object"==typeof this._spec.background&&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 oW(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=function(t){if(!t)return null;if("string"==typeof t)return{fill:t,fillOpacity:1};if("object"!=typeof t)return null;const e=H(t,["x","y","width","height","x1","y1","image"]);return e.background=t.image,e}(this._spec.background);t&&(this._backgroundMark=hz.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({},t),{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=hz.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 bH)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 zH))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof zH)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&&Kz(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=nH(this._spec,this._option,{width:cB,height:dB})),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=RF(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new aW(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){rH(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=RF(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{rH(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{var s,n;const r=i.specKey||i.type,a=null!==(s=this._spec[r])&&void 0!==s?s:{};y(a)?(e[r]=e[r]||{specCount:a.length,componentCount:0},e[r].componentCount++,rH(t,i.updateSpec(null!==(n=a[i.getSpecIndex()])&&void 0!==n?n:{},a))):rH(t,i.updateSpec(a))}));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()];rH(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=XF(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(Jz.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(Jz.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(Jz.STATE_SELECTED)}clearHovered(){this.clearState(Jz.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===Pz.dimensionHover||s===Pz.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>jw(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=>{r?i[t.series.fieldY[0]]=s:i[t.series.fieldX[0]]=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 hW=(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 cW{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);xj(t,r,l.spec),xj(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}));xj(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=hW(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=hW(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(hz.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(hz.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=hz.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=hz.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=hz.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 dW extends cW{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")&&Tj(i,aH(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 uW extends dW{_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),sH(t)}}class pW extends lW{constructor(){super(...arguments),this.transformerConstructor=uW,this.type="line",this.seriesType=oB.line,this._canStack=!0}}pW.type="line",pW.seriesType=oB.line,pW.transformerConstructor=uW;class gW extends wG{constructor(){super(...arguments),this.type=gW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}gW.type="area";const mW=()=>{hz.registerMark(gW.type,gW),fM(),qk(),kR.registerGraphic(RB.area,Ug),JH()};class fW extends oN{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 vW=()=>{hz.registerAnimation("area",qH),ZH(),XH()};class _W extends LG{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=Tj({},m.style,g.style),l.state=Tj({},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 yW extends AG{constructor(){super(...arguments),this.type=oB.area,this.transformerConstructor=_W,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(yW.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===kG?"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 GF(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 GF(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(uG(null===(e=hz.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),pG("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(uG(null===(i=hz.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),pG("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=SG(this);this._symbolMark.setAnimationConfig(uG(null===(s=hz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),pG("point",this._spec,this._markAttributeContext),t))}}initTooltip(){this._tooltipHelper=new fW(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}}}yW.type=oB.area,yW.mark=JD,yW.transformerConstructor=_W,U(yW,TG);class bW extends dW{_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),sH(t)}}class xW extends lW{constructor(){super(...arguments),this.transformerConstructor=bW,this.type="area",this.seriesType=oB.area,this._canStack=!0}}xW.type="area",xW.seriesType=oB.area,xW.transformerConstructor=bW;function SW(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 AW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:SW(t,e)}),kW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:SW(t,e)}),MW={type:"fadeIn"},TW={type:"growCenterIn"};function wW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return MW;case"scaleIn":return TW;default:return AW(t)}}class CW extends zH{constructor(){super(...arguments),this.type=CW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}CW.type="rect";const EW=()=>{hz.registerMark(CW.type,CW),gO(),uO.useRegisters([VI,NI,GI,WI,zI,HI])};function PW(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[GD]):this._spec.barMinHeight?this._calculateRectPosition(t,!1):GF(this._dataToPosX(t),e),this._getBarXEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[WD]):GF(this._dataToPosX1(t),e),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[UD]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):GF(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[YD]):GF(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({},LW.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{morph:fG(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(LW.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(Dz(this._option.dataSet,"addVChartProperty",JN),s){const t=([t],{scaleDepth:e})=>{var i;let s=[{}];const n=this.getDimensionField(),r=u(e)?n.length:Math.min(n.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};Dz(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:oG.bind(this),call:lG}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new sG(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=YD,s=UD,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=WD,s=GD,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=Zj(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)PW(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=GF(this[n](t),o),d=GF(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[kD],n=t[MD],r=t[TD],h=t[wD];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]),{[kD]:i,[MD]:s}),a?{[TD]:o,[wD]:l}:void 0);t.push(Tg(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=>GF(this._dataToPosY(t),a),y1:t=>GF(this._dataToPosY1(t),a)}:{y:t=>GF(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=>GF(this._dataToPosX(t),r),x1:t=>GF(this._dataToPosX1(t),r)}:{x:t=>GF(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=SG(this);this._barMark.setAnimationConfig(uG(null===(e=hz.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),pG(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;if(void 0!==this._spec.barWidth&&r===n)return ZF(this._spec.barWidth,a);const o=void 0!==this._spec.barMinWidth,l=void 0!==this._spec.barMaxWidth;let h=a;return o&&(h=Math.max(h,ZF(this._spec.barMinWidth,a))),l&&(h=Math.min(h,ZF(this._spec.barMaxWidth,a))),h}_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=ZF(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=Dw(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}}LW.type=oB.bar,LW.mark=KD,LW.transformerConstructor=RW;const OW=()=>{iI(),EW(),hz.registerAnimation("bar",((t,e)=>({appear:wW(t,e),enter:AW(t,!1),exit:kW(t,!1),disappear:kW(t)}))),tW(),ZG(),hz.registerSeries(LW.type,LW)};class IW extends dW{_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),sH(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 DW extends lW{constructor(){super(...arguments),this.transformerConstructor=IW,this.type="bar",this.seriesType=oB.bar,this._canStack=!0}}DW.type="bar",DW.seriesType=oB.bar,DW.transformerConstructor=IW;class FW extends zH{constructor(){super(...arguments),this.type=FW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}FW.type="rect3d";class jW extends LW{constructor(){super(...arguments),this.type=oB.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d"}}jW.type=oB.bar3d,jW.mark=XD;class zW extends IW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}class HW extends DW{constructor(){super(...arguments),this.transformerConstructor=zW,this.type="bar3d",this.seriesType=oB.bar3d}}HW.type="bar3d",HW.seriesType=oB.bar3d,HW.transformerConstructor=zW;const VW=[10,20],NW=Pw.Linear,GW="circle",WW=Pw.Ordinal,UW=["circle","square","triangle","diamond","star"],YW=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class KW extends yG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class XW extends AG{constructor(){super(...arguments),this.type=oB.scatter,this.transformerConstructor=KW,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=`${hB}_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=`${hB}_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:NW,defaultRange:VW},"size")}getShapeAttribute(t,e){return u(e)?GW:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:WW,defaultRange:UW},"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(XW.mark.point,{morph:fG(this._spec,XW.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=SG(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(uG(null===(i=hz.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),pG("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:GW},Jz.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},Jz.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},Jz.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},Jz.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},Jz.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]}}XW.type=oB.scatter,XW.mark=ZD,XW.transformerConstructor=KW;const $W=()=>{RG(),hz.registerAnimation("scatter",((t,e)=>Object.assign({appear:YW(0,e)},YH))),tW(),ZG(),hz.registerSeries(XW.type,XW)};class qW extends dW{_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 ZW extends lW{constructor(){super(...arguments),this.transformerConstructor=qW,this.type="scatter",this.seriesType=oB.scatter,this._canStack=!0}}ZW.type="scatter",ZW.seriesType=oB.scatter,ZW.transformerConstructor=qW;Ln();const JW={},QW=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function tU(t,e){t&&_(t)||lb("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(JW[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 QW.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}(i,e)),JW[i]||null}const eU={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(eU).forEach((t=>{tU(t,eU[t])}));const iU="Feature",sU="FeatureCollection";function nU(t){const e=Y(t);return 1===e.length?e[0]:{type:sU,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===sU?t.features:Y(t).filter((t=>!u(t))).map((t=>t.type===iU?t:{type:iU,geometry:t}))}(e))),[])}}const rU=QW.concat(["pointRadius","fit","extent","size"]);function aU(t,e){let i=[];return t?(Object.keys(t).forEach((s=>{rU.includes(s)&&(i=i.concat(dR(t[s],e)))})),i):i}let oU=class extends $R{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(dR(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(dR(t,this.view)),this.commit(),this}size(t){return u(this.spec.size)||this.detach(dR(this.spec.size,this.view)),this.spec.size=t,this.attach(dR(t,this.view)),this.commit(),this}extent(t){return u(this.spec.extent)||this.detach(dR(this.spec.extent,this.view)),this.spec.extent=t,this.attach(dR(t,this.view)),this.commit(),this}fit(t){return u(this.spec.fit)||this.detach(dR(this.spec.fit,this.view)),this.spec.fit=t,this.attach(dR(t,this.view)),this.commit(),this}configure(t){return this.detach(aU(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(aU(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=tU((t||"mercator").toLowerCase());return e||lb("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),QW.forEach((t=>{u(this.spec[t])||function(t,e,i){d(t[e])&&t[e](i)}(this.projection,t,pR(this.spec[t],e,tU))})),u(this.spec.pointRadius)||this.projection.path.pointRadius(pR(this.spec.pointRadius,e,tU)),!(u(this.spec.fit)||u(this.spec.extent)&&u(this.spec.size))){const t=nU(pR(this.spec.fit,e,tU));this.spec.extent?this.projection.fitExtent(pR(this.spec.extent,e,tU),t):this.spec.size&&this.projection.fitSize(pR(this.spec.size,e,tU),t)}return this.projection}output(){return this.projection}};const lU=(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 hU extends bG{constructor(){super(...arguments),this.type=oB.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=`${hB}_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 cU=`${hB}_MAP_LOOK_UP_KEY`,dU=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[_D]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[cU]=e.nameMap[n]:t[cU]=n})),t.features);class uU extends oN{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 pU extends zH{constructor(){super(...arguments),this.type=pU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}pU.type="path";const gU=()=>{hz.registerMark(pU.type,pU),pO()};class mU{constructor(t){this.projection=tU(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 fU{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 vU{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 _U(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:fU}:tb(e)||eb(e)?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:vU}:null}const yU={debounce:xt,throttle:St};class bU{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=tb(this._renderMode)||eb(this._renderMode),_U(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return _U(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;u(n)||De({x:r,y:a},this._getRegionOrSeriesLayout(e),!1)&&(i&&i({zoomDelta:n,zoomX:r,zoomY:a},s),this._eventObj.emit("zoom",{scale:s.zoomDelta,scaleCenter:{x:s.zoomX,y:s.zoomY},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,yU[o]((t=>{this._zoomableTrigger.clearZoom()}),l)),h.on(...c,yU[o]((t=>{this._zoomEventDispatch(t,i,s)}),l))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||_U(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||_U(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,yU[o]((t=>{this._zoomableTrigger.clearScroll()}),l)),h.on(...c,yU[o]((t=>this._scrollEventDispatch(t,i,s)),l))}initScrollEventOfSeries(t,e,i){_U(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||_U(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||_U(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||_U(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=yU[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)}),l),_=yU[o]((t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1;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 xU(t,e){return`${hB}_${e}_${t}`}class SU extends jG{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:xU(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),e&&(e.zoomDelta=l),this.zoom(l,[t.zoomX,t.zoomY]),l},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=Tj(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},s=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,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 mU(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===oB.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),sB(this._regions,(t=>{var e;if(t.type===oB.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===oB.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[cU],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}}SU.type=r.geoCoordinate,U(SU,bU);const AU=()=>{hz.registerComponent(SU.type,SU)};class kU extends yG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class MU extends hU{constructor(){super(...arguments),this.type=oB.map,this.transformerConstructor=kU,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 !`),jz.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),Dz(this._dataSet,"copyDataView",Wz),Dz(this._dataSet,"map",dU),Dz(this._dataSet,"lookup",lU);const i=jz.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:Xz.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:cU,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 sG(this._option,s)}initMark(){this._pathMark=this._createMark(MU.mark.area,{morph:fG(this._spec,MU.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:bD])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:bD]):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(uG(null===(t=hz.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),pG("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new uU(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[_D]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[_D],{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 _D}getActiveMarks(){return[this._pathMark]}}MU.type=oB.map,MU.mark=sF,MU.transformerConstructor=kU;const TU=()=>{kR.registerGrammar("projection",oU,"projections"),AU(),gU(),hz.registerSeries(MU.type,MU),hz.registerImplement("registerMap",Vz),hz.registerImplement("unregisterMap",Nz),$H()},wU=(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,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},a=o[t];if(null==a||a.forEach(((t,e)=>{e===a.length-1?t[RD]=!0:delete t[RD]})),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=CU([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}=EU(m,i,s,n,u);i.start=f,i.end=v;let _=v-f;return p.forEach((t=>{t[c]=+f,t[d]=Kt(t[c],+t[h]),f=t[d],_=Xt(_,+t[h])})),g.forEach((t=>{t[c]=+f,t[d]=Kt(t[c],_),t[h]=_})),Object.assign(Object.assign({},i),{lastIndex:e})}(a,t,n,r,h,l,i,e,o),void r.push(n)}h=CU(a,t,n,r,h,l,i,e),r.push(n)})),r};function CU(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}=EU(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);e||(t[h]=+i.end,t[c]=Kt(t[h],+t[l]),i.end=t[c]),i.isTotal=e,(u(p)||p===pD)&&(t[pD]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function EU(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?Xy("total.collectCountField error"):n=e[a].start;o<0?Xy("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 PU=(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},BU={type:"fadeIn"},RU={type:"growCenterIn"};function LU(t,e){switch(e){case"fadeIn":return BU;case"scaleIn":return RU;default:return AW(t,!1)}}class OU extends zH{constructor(){super(...arguments),this.type=OU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}OU.type="rule";const IU=()=>{hz.registerMark(OU.type,OU),mO()},DU=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:FU(t.map((t=>t.latestData)).flat(),e.fields,i)}};function FU(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)=>FU(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class jU{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"}),Dz(e,"dimensionTree",DU),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 zU extends RW{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel")}}const HU={rect:UU,symbol:GU,arc:KU,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=GU(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1);return e},stackLabel:XU,line:$U,area:$U,rect3d:UU,arc3d:KU,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function VU(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}=wV(i,s,o.text,e);return h&&(o.text=h(...c,{series:a})),o}function NU(t){return d(t)?e=>t(e.data):t}function GU(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=NU(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:WU(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function WU(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function UU(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=NU(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:YU(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function YU(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 KU(t){var e;const{labelSpec:i}=t,s=null!==(e=NU(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 XU(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=VU(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),mp(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 $U(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 qU extends LW{constructor(){super(...arguments),this.type=oB.waterfall,this.transformerConstructor=zU,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 jU(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=pD)}getSeriesKeys(){return this._seriesField===pD?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),Dz(this._dataSet,"waterfallFillTotal",PU),Dz(this._dataSet,"waterfall",wU),(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=Uz(this.getViewData(),this._dataSet,{name:`${hB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new sG(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:kD,endAs:MD,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=SG(this);this._barMark.setAnimationConfig(uG(null===(i=hz.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),pG("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(uG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),pG("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(qU.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){if(!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible))return super.initLabelMarkStyle(t),void(this._labelMark=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 XU(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?GF(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):GF(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))}}qU.type=oB.waterfall,qU.mark=uF,qU.transformerConstructor=zU;const ZU=()=>{IU(),EW(),hz.registerAnimation("waterfall",((t,e)=>({appear:LU(t,e),enter:AW(t,!1),exit:kW(t,!1),disappear:kW(t,!1)}))),$H(),tW(),ZG(),hz.registerSeries(qU.type,qU)},JU=`${hB}_BOX_PLOT_OUTLIER_VALUE`;var QU;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(QU||(QU={}));const tY=(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={[JU]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class eY extends oN{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===QU.OUTLIER)return this.series.getOutliersField();if(t===QU.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case QU.MIN:return this.series.getMinField();case QU.MAX:return this.series.getMaxField();case QU.MEDIAN:return this.series.getMedianField();case QU.Q1:return this.series.getQ1Field();case QU.Q3:return this.series.getQ3Field();case QU.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===QU.OUTLIER)return e[JU];if(t===QU.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case QU.MIN:return e[this.series.getMinField()];case QU.MAX:return e[this.series.getMaxField()];case QU.MEDIAN:return e[this.series.getMedianField()];case QU.Q1:return e[this.series.getQ1Field()];case QU.Q3:return e[this.series.getQ3Field()];case QU.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[JU])}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.getContentKey(QU.OUTLIER),value:this.getContentValue(QU.OUTLIER),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(QU.MAX),value:this.getContentValue(QU.MAX),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(QU.Q3),value:this.getContentValue(QU.Q3),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(QU.MEDIAN),value:this.getContentValue(QU.MEDIAN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(QU.Q1),value:this.getContentValue(QU.Q1),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(QU.MIN),value:this.getContentValue(QU.MIN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(QU.SERIES_FIELD),value:this.getContentValue(QU.SERIES_FIELD),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]}}}class iY extends zH{constructor(){super(...arguments),this.type=iY.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}}iY.type="boxPlot";const sY=()=>{hz.registerMark(iY.type,iY),kR.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(SO).registerChannelEncoder("x",((t,e,i,s,n,r)=>r&&yb(r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,s,n,r)=>r&&yb(r.direction)?{shaft:{y:e,y1:e}}:null)).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&yb(r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&yb(r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&yb(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&&yb(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&&yb(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&&yb(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}}))),kR.registerAnimationType("boxplotScaleIn",AO),kR.registerAnimationType("boxplotScaleOut",kO),_O(),gO(),mO(),kR.registerGlyph("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(TO).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&yb(r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&yb(r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&yb(r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&yb(r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&yb(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}}))),kR.registerAnimationType("barBoxplotScaleIn",wO),kR.registerAnimationType("barBoxplotScaleOut",CO),_O(),gO(),mO()};class nY extends AG{constructor(){super(...arguments),this.type=oB.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(nY.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(nY.mark.outlier,{progressive:t,key:_D,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,Jz.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"},Jz.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=>GF(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>GF(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>GF(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>GF(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>GF(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},Jz.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=>GF(e(this.getDatumPositionValues(t,JU),{bandPosition:this._bandPosition}),s)}:{x:this.dataToPositionX.bind(this),y:t=>GF(e(this.getDatumPositionValues(t,JU),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,Jz.STATE_NORMAL,t.AttributeLevel.Series)}}initData(){if(super.initData(),!this._data)return;Dz(this._dataSet,"foldOutlierData",tY),Dz(this._dataSet,"addVChartProperty",JN);const t=new ya(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${hB}_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:oG.bind(this),call:lG}},!1),this._outlierDataView=new sG(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=SG(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=hz.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(pG("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(uG(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(uG(null===(a=hz.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new eY(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]}}nY.type=oB.boxPlot,nY.mark=pF;class rY extends zH{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=rY.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})}}rY.type="text";const aY=()=>{hz.registerMark(rY.type,rY),vO(),fM(),gM(),kR.registerGraphic(RB.richtext,zg)};function oY(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 lY extends oN{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 hY=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),cY={type:"fadeIn"},dY=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function uY(t,e){return"fadeIn"===e?cY:hY(t)}class pY extends RW{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 gY extends LW{constructor(){super(...arguments),this.type=oB.rangeColumn,this._barMarkType="rect",this._barName=oB.bar,this.transformerConstructor=pY}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(gY.mark.bar,{morph:fG(this._spec,gY.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(gY.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(gY.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}});oY(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}});oY(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=SG(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(uG(null===(i=hz.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),pG("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(uG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),pG("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(uG(null===(n=hz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),pG("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new lY(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)}}gY.type=oB.rangeColumn,gY.mark=yF,gY.transformerConstructor=pY;const mY=()=>{EW(),aY(),hz.registerAnimation("rangeColumn",((t,e)=>({appear:uY(t,e),enter:hY(t),exit:dY(t),disappear:dY(t)}))),$H(),tW(),ZG(),hz.registerSeries(gY.type,gY)};class fY extends gY{constructor(){super(...arguments),this.type=oB.rangeColumn3d,this._barMarkType="rect3d",this._barName=oB.bar3d}}fY.type=oB.rangeColumn3d,fY.mark=bF;class vY extends oN{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 _Y extends yW{constructor(){super(...arguments),this.type=oB.rangeArea}initMark(){var t;const{customShape:e,stateSort:i}=null!==(t=this._spec.area)&&void 0!==t?t:{};this._areaMark=this._createMark(_Y.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 vY(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))}}_Y.type=oB.rangeArea,_Y.mark=kF;class yY extends bG{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=EB,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:[]};Dw(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:[]};Dw(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)&&xG(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 bY=(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[_B],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[_B]*t;g(e,b,i),b+=i}))}return 0!==m&&(i[i.length-1][l]=r),i};function xY(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const SY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:xY(t,!0,qz.appear)}),AY={type:"fadeIn"},kY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:xY(t,!0,qz.enter)}),MY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:xY(t,!0,qz.exit)}),TY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:xY(t,!0,qz.exit)});function wY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return AY;case"growRadius":return SY(Object.assign(Object.assign({},t),{growField:"radius"}));default:return SY(Object.assign(Object.assign({},t),{growField:"angle"}))}}class CY extends zH{constructor(t,e){super(t,e),this.type=EY.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[AB])[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 EY extends CY{constructor(){super(...arguments),this.type=EY.type}}EY.type="arc";const PY=()=>{fM(),Xk(),kR.registerGraphic(RB.arc,Xg),uO.useRegisters([QI,tD,ZI,JI]),hz.registerMark(EY.type,EY)};class BY extends yG{_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=Tj({},this._theme,i,t);const n=(t,e)=>Tj({},"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 RY extends yY{constructor(){super(...arguments),this.transformerConstructor=BY,this._pieMarkName="pie",this._pieMarkType="arc",this._startAngle=TB,this._endAngle=wB,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this.dataToCentralPosition=t=>{const e=t[AB];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;Dz(this._dataSet,"pie",bY),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:bB,asEndAngle:xB,asRatio:yB,asMiddleAngle:AB,asRadian:MB,asQuadrant:kB,asK:SB}},!1);const e=new ya(this._dataSet,{name:`${hB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new sG(this._option,e)}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},RY.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{morph:fG(this._spec,this._pieMarkName),defaultMorphElementKey:this._seriesField,key:yD,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 aB(bB)(t)}endAngleScale(t){return aB(xB)(t)}initMarkStyle(){const e=this._pieMark;e&&this.setMarkStyle(e,{x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:WF(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:WF(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:aB(mB).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[AB];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===qz.appear)return this._startAngle;if(i===qz.disappear)return this._endAngle;const n=[qz.disappear,qz.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[_D];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[_D]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[_D])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[_D])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+se({x:0,y:0},a,e[AB]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+se({x:0,y:0},a,e[AB]).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[AB]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+se({x:0,y:0},a,e[AB]).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]}}RY.transformerConstructor=BY,RY.mark=tF;class LY extends RY{constructor(){super(...arguments),this.type=oB.pie}}LY.type=oB.pie;const OY=()=>{PY(),hz.registerAnimation("pie",((t,e)=>({appear:wY(t,e),enter:kY(t),exit:MY(t),disappear:TY(t)}))),hz.registerSeries(LY.type,LY)};class IY extends CY{constructor(){super(...arguments),this.type=IY.type,this._support3d=!0}}IY.type="arc3d";class DY extends BY{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class FY extends RY{constructor(){super(...arguments),this.type=oB.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=DY}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[AB];return"inside"===i.position?ee(e):0},this.setMarkStyle(e,Object.assign(Object.assign({},s),{z:100}),void 0,t.AttributeLevel.Mark)}}FY.type=oB.pie3d,FY.mark=eF,FY.transformerConstructor=DY;const jY=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)=>e.getGraphicAttribute("innerRadius")},outerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("outerRadius")}}}},zY={type:"fadeIn"},HY=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),VY=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),NY=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function GY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return zY;case"growAngle":return jY(Object.assign(Object.assign({},t),{growField:"angle"}));default:return jY(Object.assign(Object.assign({},t),{growField:"radius"}))}}class WY extends yY{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(MD),this.setInnerRadiusField(kD)}setValueFieldToPercent(){this.setRadiusField(wD),this.setInnerRadiusField(TD)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}class UY extends yG{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}const YY=(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:CB,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:EB,layoutRadius:e.layoutRadius}};class KY extends NG{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(!RV(e))return null;const{axisType:i,componentName:s,startAngle:n,endAngle:r,center:a,outerRadius:o,layoutRadius:l}=YY(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(!RV(e))return;const{axisType:a,componentName:o,startAngle:l,endAngle:h,center:c,outerRadius:d,layoutRadius:u}=YY(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=hz.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=TB,this._endAngle=wB,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),sB(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:EV(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(){sB(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 Dw(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:Dw(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:KF(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:KF(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=>DV(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=EB,e=0;const i=this.getChart().getSpec();return sB(this.getRegions(),(s=>{const n=s;if(r=n.type,[oB.rose,oB.radar,oB.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(Tj({},this._axisStyle,s)),this._gridMark){this._gridMark.getProduct().encode(Tj({},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)}}KY.type=r.polarAxis,KY.specKey="axes";class XY extends KY{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new TC}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}}XY.type=r.polarLinearAxis,XY.specKey="axes",U(XY,$G);const $Y=()=>{GG(),hz.registerComponent(XY.type,XY)};class qY extends KY{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new rC}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(){}}qY.type=r.polarBandAxis,qY.specKey="axes",U(qY,JG);const ZY=()=>{GG(),hz.registerComponent(qY.type,qY)};class JY extends WY{constructor(){super(...arguments),this.type=oB.rose,this.transformerConstructor=UY,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(JY.mark.rose,{morph:fG(this._spec,JY.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=>GF(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=GF(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(uG(null===(i=hz.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),pG("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}JY.type=oB.rose,JY.mark=iF,JY.transformerConstructor=UY;const QY=()=>{hz.registerSeries(JY.type,JY),PY(),hz.registerAnimation("rose",((t,e)=>({appear:GY(t,e),enter:HY(t),exit:VY(t),disappear:NY(t)}))),ZY(),$Y()};class tK extends mc{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);k(t*e)||(this.valid=!1),this._fromAngle=t,this._fromRadius=e;const{angle:i,radius:s}=this._pointToCoord(this.to);k(i*s)||(this.valid=!1),this._toAngle=i,this._toRadius=s}onUpdate(t,e,i){if(!1!==this.valid)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 eK extends Hc{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}),r=re(s.angle),a=re(n.angle),o=this._pointToCoord(e),l=this._pointToCoord({x:e.x1,y:e.y1}),h=re(o.angle),c=re(l.angle),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 iK=t=>({type:"in"===t?"fadeIn":"fadeOut"});function sK(t,e,i){return"fadeIn"===e?iK(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function nK(t,e,i){return"fadeIn"===e?iK(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 rK=(t,e)=>({custom:Nc,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 aK extends WY{constructor(){super(...arguments),this.type=oB.radar,this.transformerConstructor=LG,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(aK.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:MG,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):TB,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(uG(null===(s=hz.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),pG("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=hz.getAnimationInKey(e);t.setAnimationConfig(uG(null==i?void 0:i(n,r),pG(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}}}aK.type=oB.radar,aK.mark=QD,aK.transformerConstructor=LG,U(aK,TG);const oK=()=>{hz.registerSeries(aK.type,aK),sI(),mW(),EG(),RG(),hz.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:sK(t,e,"in"),enter:sK(t,e,"in"),exit:sK(t,e,"out"),disappear:"clipIn"===e?void 0:sK(t,e,"out"),update:[{options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:eK,customParameters:t,duration:UH.update.duration,easing:UH.update.easing}]}))),hz.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:nK(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:nK(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:tK,customParameters:t,duration:UH.update.duration,easing:UH.update.easing}]}))),hz.registerAnimation("radarGroup",((t,e)=>({appear:rK(t,"in"),disappear:rK(t,"out")}))),Xk(),ZY(),$Y()};class lK extends oN{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 hK=(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},cK={fill:"#bbb",fillOpacity:.2};class dK extends AG{constructor(){super(...arguments),this.type=oB.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]])),Dz(this._option.dataSet,"objFlat",hK),Dz(this._option.dataSet,"copyDataView",Wz),Fz(this._option.dataSet,"dataview",ga),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:Xz.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(Tj(cK,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(dK.mark.group),this._containerMark=this._createMark(dK.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(dK.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(dK.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(dK.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(dK.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(dK.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(dK.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:bD}}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 HF).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:bD}}initTooltip(){this._tooltipHelper=new lK(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]}}dK.type=oB.dot,dK.mark=oF;class uK extends oN{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 pK=(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 gK extends AG{constructor(){super(...arguments),this.type=oB.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(),Dz(this._option.dataSet,"linkDotInfo",pK),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:Xz.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(gK.mark.group),this._containerMark=this._createMark(gK.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(gK.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(gK.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:bD}}initInteraction(){const t=[];this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new uK(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]}}gK.type=oB.link,gK.mark=aF;class mK extends yY{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()?kD:LD],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()?MD: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):TB;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?te(r):wB,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=GF(this.angleAxisHelper.dataToPosition([t[kD]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=GF(this.angleAxisHelper.dataToPosition([t[MD]]),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(mK.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 Xg(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[Tg({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 _K=()=>{hz.registerAnimation("circularProgress",((t,e)=>({appear:vK(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class yK extends yG{constructor(){super(...arguments),this._supportStack=!0}}class bK extends mK{constructor(){super(...arguments),this.type=oB.circularProgress,this.transformerConstructor=yK,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(bK.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(bK.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()?kD:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?MD: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(uG(null===(i=hz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),pG("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(uG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),pG("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}bK.type=oB.circularProgress,bK.mark=rF,bK.transformerConstructor=yK;function xK(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const SK=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:xK(t)}),AK={type:"fadeIn"};function kK(t,e){return!1===e?{}:"fadeIn"===e?AK:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:xK(t)}))(t)}class MK extends oN{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 TK extends AG{constructor(){super(...arguments),this.type=oB.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(TK.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 GF(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 GF(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 GF(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 GF(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(TK.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 GF(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 GF(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(TK.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=GF(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(Tg({x:i,y:0,height:r,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=GF(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(Tg({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(uG(null===(i=hz.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),pG("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(uG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),pG("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new MK(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}TK.type=oB.linearProgress,TK.mark=dF;const wK=()=>{EW(),hz.registerAnimation("linearProgress",((t,e)=>({appear:kK(t,e),enter:{type:"grow"},disappear:SK(t)}))),$H(),hz.registerSeries(TK.type,TK)},CK=[0],EK=[20,40],PK=[200,500],BK={shrink:!1,enlarge:!1,fontSizeLimitMin:0},RK=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],LK=`${hB}_WORD_CLOUD_WEIGHT`,OK=`${hB}_WORD_CLOUD_TEXT`;class IK extends bG{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=EK}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:PK,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:CK,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)?OK:this._nameField,this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:BK},this._spec.wordCloudConfig),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:CK,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=!RK.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(IK.mark.word,{key:yD,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(uG(hz.getAnimationInKey("wordCloud")(n,s),pG("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 HF).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:bD])}}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 TC,o=this._fontWeightRange;if(r){const[e,i]=pb(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:LK,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:OK,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:Qy(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[r,a],shape:this._maskShape,dataIndexKey:yD,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:LK}: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:yD,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:LK}: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)}}IK.mark=lF;function DK(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)||UH.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 jK(){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 zK(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 HK=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function VK(t){return d(t)?t:function(){return t}}class NK{constructor(t){var e,i,s;switch(this.options=z({},NK.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=(s=this.options.shape,FK[s]?FK[s]():FK.circle()),this.getText=null!==(e=VK(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=VK(this.options.fontWeight),this.getTextFontSize=VK(this.options.fontSize),this.getTextFontStyle=VK(this.options.fontStyle),this.getTextFontFamily=VK(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>HK(10,50);break;case"random-light":this.getTextColor=()=>HK(50,90);break;default:this.getTextColor=VK(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 WK extends NK{constructor(t){var e;super(z({},WK.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<=WK.defaultOptions.minFontSize&&(this.options.minFontSize=WK.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=GK[this.options.spiral])&&void 0!==e?e:GK.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=VK(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}=zK(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(P_.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(XK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(KK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}XK(p,this._size)&&(p=$K(p,this._size))}else if(XK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||YK(p,i))&&(!i||!UK(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 UK(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 YK(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,XK=(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 $K(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}=zK(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)}ZK.defaultOptions={enlarge:!1};const QK={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},tX=(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?eX(t.fontFamily):"sans-serif",d=t.fontStyle?eX(t.fontStyle):"normal",u=t.fontWeight?eX(t.fontWeight):"normal",p=t.rotate?eX(t.rotate):0,g=eX(t.text),m=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",f=t.padding?eX(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||QK,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?eX(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=sX(nX(t,l),C);w=i=>e(t(i))}let E=WK;"fast"===t.layoutType?E=ZK:"grid"===t.layoutType&&(E=qK);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()},eX=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],iX=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),sX=(t,e)=>{if(t[0]===t[1])return t=>e[0];const i=iX(t[0]),s=iX(t[1]),n=Math.min(i,s),r=Math.max(i,s);return t=>(iX(t)-n)/(r-n)*(e[1]-e[0])+e[0]},nX=(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 rX(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{kR.registerTransform("wordcloud",{transform:tX,markPhase:"beforeJoin"},!0),aY(),hz.registerAnimation("wordCloud",((t,e)=>({appear:DK(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),hz.registerSeries(aX.type,aX)};(class extends IK{constructor(){super(...arguments),this.type=oB.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(IK.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(uG(null===(e=hz.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}})),pG("word",this._spec,this._markAttributeContext)))}}).type=oB.wordCloud3d;const lX=(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},hX=(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},cX=`${hB}_FUNNEL_TRANSFORM_RATIO`,dX=`${hB}_FUNNEL_REACH_RATIO`,uX=`${hB}_FUNNEL_HEIGHT_RATIO`,pX=`${hB}_FUNNEL_VALUE_RATIO`,gX=`${hB}_FUNNEL_LAST_VALUE_RATIO`,mX=`${hB}_FUNNEL_NEXT_VALUE_RATIO`,fX=`${hB}_FUNNEL_LAST_VALUE`,vX=`${hB}_FUNNEL_CURRENT_VALUE`,_X=`${hB}_FUNNEL_NEXT_VALUE`,yX=`${hB}_FUNNEL_TRANSFORM_LEVEL`,bX=20;class xX extends oN{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[dX])).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 SX extends zH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class AX extends SX{constructor(){super(...arguments),this.type=AX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}AX.type="polygon";const kX=()=>{hz.registerMark(AX.type,AX),fM(),cM(),kR.registerGraphic(RB.polygon,Zg),uO.useRegisters([UI,YI])};class MX extends yG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class TX extends bG{constructor(){super(...arguments),this.type=oB.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=MX,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;Dz(this._dataSet,"funnel",lX),Dz(this._dataSet,"funnelTransform",hX);const t=new ya(this._dataSet,{name:`${hB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new sG(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:vX,asTransformRatio:cX,asReachRatio:dX,asHeightRatio:uX,asValueRatio:pX,asNextValueRatio:mX,asLastValueRatio:gX,asLastValue:fX,asNextValue:_X,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:yX}})}initMark(){var t,e,i,s,n,r,a,o,l,h,c,d;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},TX.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,morph:fG(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({},TX.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(TX.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(TX.mark.outerLabelLine,{themeSpec:e,markSpec:t,depend:[this._funnelOuterLabelMark.label],noSeparateStyle:!0})}}initTooltip(){this._tooltipHelper=new xX(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*aB(dX).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(uG(null===(s=hz.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),pG("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(uG(hz.getAnimationInKey("fadeInOut")(),pG(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(uG(hz.getAnimationInKey("funnel")({},o),pG(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(uG(null===(a=hz.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),pG("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[gX])/2:this._getSecondaryAxisLength(t[pX])/2,n=this._getSecondaryAxisLength(t[pX])/2):(s=this._getSecondaryAxisLength(t[pX])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[mX])/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[yX])}_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[yD]===t[yD]));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?bX: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{kX(),aY(),IU(),hz.registerSeries(TX.type,TX),hz.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},KH))),hz.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Gc,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Gc,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),$H()};class CX extends SX{constructor(){super(...arguments),this.type=CX.type}}CX.type="pyramid3d";class EX extends MX{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class PX extends TX{constructor(){super(...arguments),this.type=oB.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=EX}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},PX.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({},PX.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(PX.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(PX.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())}}PX.type=oB.funnel3d,PX.mark=cF,PX.transformerConstructor=EX;const BX=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},RX=t=>{const e=t.mark.elements.filter((t=>t.diffState===BB.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}))},LX=(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]},OX=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=RX(i),a=LX(r,s,n);return BX(e.startAngle,a)*(n-s)+s},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=RX(i),a=LX(r,s,n);return BX(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}}}),IX=t=>{const e=$(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),i=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[e,i]},DX=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=RX(i),a=IX(r);return BX(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=RX(i),a=IX(r);return BX(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}}}),FX=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},jX=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):jX(t.children,e,i)))})),e};function zX(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=NX(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}},GX=(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=GX(t.children,e,t,n))})),s},WX=(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=WX(t.children,e,t,n)),n=e(t,s,i,n)})),n},UX={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:zX,slice:HX,sliceDice:function(t,e,i,s,n){(t.depth%2==1?HX:zX)(t,e,i,s,n)}};class YX{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({},YX.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?cb(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?VX(this.options.aspectRatio):null!==(e=UX[this.options.splitType])&&void 0!==e?e:UX.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=NX(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)}))}}YX.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const KX=(t,e)=>{const i=new YX(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 jX(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},XX={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class $X{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];zX(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),XX);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({},$X.defaultOpionts,t):Object.assign({},$X.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?cb(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+mb(this.options.center[0],t.width),s=t.y0+mb(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=>mb(t,n))):mb(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>mb(t,n))):mb(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=mb(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=NX(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)}}}$X.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const qX=4294967296;function ZX(t,e){let i,s;if(t$(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function t$(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 n$(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 r$(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 a$(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 o$(t){return{_:t,next:null,prev:null}}function l$(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];n$(n,s,r);let a,o,l,h,c,d,u,p=o$(s),g=o$(n),m=o$(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=NX(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)%qX)/qX}(),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:u$.defaultOpionts.nodeSort;GX([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)GX([o],h$(h)),WX([o],c$(this._getPadding,.5,a)),GX([o],d$(1,this._maxDepth));else{const t=Math.min(s.width,s.height);GX([o],h$(u$.defaultOpionts.setRadius)),WX([o],c$(ub,1,a)),c&&WX([o],c$(this._getPadding,o.radius/t,a)),GX([o],d$(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}u$.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const p$=(t,e={})=>{if(!t)return[];const i=[];return jX(t,i,e),i},g$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new $X(i).layout(t,{width:s,height:n})};class m$ extends oN{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var f$;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(f$||(f$={}));const v$=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===f$.DrillDown){return Y(sz(t,n,s,"children"))}if(i.type===f$.DrillUp){const e=nz(t,n,s,"children");if(e)return Y(e)}return t};class _${_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=_U(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;Dz(t,"drillFilter",v$),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:f$.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:f$.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:f$.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:f$.DrillUp},model:this}),r}}class y$ extends yY{constructor(){super(...arguments),this.type=oB.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:rG),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:yD},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),Dz(this._dataSet,"sunburstLayout",g$),Dz(this._dataSet,"flatten",p$),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:nG,operations:["max","min","values"]},{key:rG,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(Dz(t.dataSet,"addVChartProperty",JN),t.transform({type:"addVChartProperty",options:{beforeCall:hG.bind(this),call:cG}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t,e;if(!1===this._sunburst.visible)return;const i=this._createMark(y$.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()},Jz.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(y$.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},Jz.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new m$(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(uG(null===(e=hz.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),pG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(uG(null===(e=hz.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),pG(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]}}y$.type=oB.sunburst,y$.mark=_F,U(y$,_$);const b$=()=>{hz.registerSeries(y$.type,y$),PY(),aY(),$H(),hz.registerAnimation("sunburst",((t,e)=>({appear:FX(0,e),enter:OX(t),exit:DX(t),disappear:DX(t)})))},x$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new u$(i).layout(t,{width:s,height:n})};class S$ extends oN{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const A$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"};class k$ extends AG{constructor(){super(...arguments),this.type=oB.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:rG),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:yD},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),Dz(this._dataSet,"circlePackingLayout",x$),Dz(this._dataSet,"flatten",p$),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)||(Dz(t.dataSet,"addVChartProperty",JN),t.transform({type:"addVChartProperty",options:{beforeCall:hG.bind(this),call:cG}}))}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(k$.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},Jz.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(k$.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"},Jz.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:nG,operations:["max","min","values"]},{key:rG,operations:["values"]}])}initTooltip(){this._tooltipHelper=new S$(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(uG(null===(i=hz.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),pG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(uG(null===(e=hz.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),pG(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]}}k$.type=oB.circlePacking,k$.mark=xF,U(k$,_$);const M$=()=>{hz.registerSeries(k$.type,k$),PY(),aY(),XH(),hz.registerAnimation("circlePacking",((t,e)=>({appear:A$(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},T$=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=T$(t.children):t.value=0),e+=Math.abs(t.value)})),e};function w$(t){return t.depth}function C$(t,e){return e-1-t.endDepth}const E$=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),P$=(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},B$={left:w$,right:C$,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:w$,end:C$},R$=yt(0,1);class L${constructor(t){this._ascendingSourceBreadth=(t,e)=>E$(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>E$(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},L$.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?cb(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):B$[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)};bb(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))),bb(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=[];T$(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}`;if(n[r])return n[r].value+=wt(t.value),void n[r].datum.push(t);const a={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[t],value:t.value,parents:t.parents.map((t=>t.key))};i.push(a),s[t.source].sourceLinks.push(a),s[t.target].targetLinks.push(a),n[r]=a})),{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=[P$(s[t.source]),P$(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=Math.min(n>0?Math.max(this.options.nodeGap,n):this.options.nodeGap,this._viewBox.height/e);a=()=>i,this._gapY=i,this.options.equalNodeHeight?o=this._viewBox.height/e-i:r=t.reduce(((t,e)=>{const s=e.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-(e.length-1)*i)/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,n,0),p=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.max(e.value?i*R$(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&&(o/=i.length-1,n+o>0)){n+=o,this._gapY=Math.min(n);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(E$),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(E$),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 L$(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]:[]},I$=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&I$(t,e.children,i)}))},D$=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},F$=(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 L$(e),r=[];return r.push(n.layout(s,i)),r},j$=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:[]},z$=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 H$ extends oN{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 V$=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),N$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:V$(t),G$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class W$ extends zH{constructor(){super(...arguments),this.type=W$.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}}W$.type="linkPath";const U$=()=>{kR.registerGlyph("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(BO).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),kR.registerAnimationType("linkPathGrowIn",RO),kR.registerAnimationType("linkPathGrowOut",LO),kR.registerAnimationType("linkPathUpdate",OO),_O(),pO(),hz.registerMark(W$.type,W$)};class Y$ extends AG{constructor(){super(...arguments),this.type=oB.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=[Jz.STATE_SANKEY_EMPHASIS,Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:s})}else n.target===e.key?i.includes(n.source)||i.push(n.source):(t.removeState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState(Jz.STATE_SANKEY_EMPHASIS),e.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS)):(t.removeState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(Jz.STATE_SANKEY_EMPHASIS),void s.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(Jz.STATE_SANKEY_EMPHASIS),void s.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:h.value/r.value});s.removeState(Jz.STATE_SANKEY_EMPHASIS),s.addState(Jz.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=[Jz.STATE_SANKEY_EMPHASIS,Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS),void t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS),void t.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:o.value/i.value});t.removeState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.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){Dz(this._dataSet,"sankeyLayout",F$),Dz(this._dataSet,"sankeyFormat",D$),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:Xz.sankeyLayout});const{dataSet:a}=this._option;Dz(a,"sankeyNodes",j$),Dz(a,"flatten",p$);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:oG.bind(this),call:lG}},!1),this._nodesSeriesData=new sG(this._option,o),Dz(a,"sankeyLinks",z$);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:oG.bind(this),call:lG}},!1),this._linksSeriesData=new sG(this._option,l)}}initMark(){var t,e,i,s;const n=this._createMark(Y$.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(Y$.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(Y$.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},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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(uG(null===(i=hz.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(r,a),pG("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(uG(null===(s=hz.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(r,a),pG("link",this._spec,this._markAttributeContext))),this._labelMark&&this._labelMark.setAnimationConfig(uG(null===(n=hz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),pG("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([Jz.STATE_SANKEY_EMPHASIS_REVERSE,Jz.STATE_SANKEY_EMPHASIS]),e.includes(t.getDatum().key)||t.addState(Jz.STATE_SANKEY_EMPHASIS_REVERSE)}))}initTooltip(){this._tooltipHelper=new H$(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 HF;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 I$(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]}}Y$.type=oB.sankey,Y$.mark=mF;const K$=()=>{kR.registerTransform("sankey",{transform:O$,markPhase:"beforeJoin"},!0),EW(),U$(),aY(),hz.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:N$(t,e)},KH))),hz.registerAnimation("sankeyLinkPath",((t,e)=>({appear:G$(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),$H(),hz.registerSeries(Y$.type,Y$)},X$=(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=p$(n);return i=tG([{latestData:r}],e),i};class $$ extends oN{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}get defaultShapeType(){return"square"}}const q$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class Z$ extends yG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}class J$ extends AG{constructor(){super(...arguments),this.type=oB.treemap,this.transformerConstructor=Z$,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:rG),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:yD},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&&[rG,"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)&&(Dz(this._rawData.dataSet,"addVChartProperty",JN),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:hG.bind(this),call:cG}}))}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){Dz(this._dataSet,"hierarchyDimensionStatistics",X$),Dz(this._dataSet,"flatten",p$);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:nG,operations:["max","min","values"]},{key:rG,operations:["values"]}])}initMark(){var t,e,i,s;const n=this._createMark(J$.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(J$.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()},Jz.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()},Jz.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},Jz.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},Jz.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},Jz.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},Jz.STATE_NORMAL,t.AttributeLevel.Series))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(uG(null===(e=hz.getAnimationInKey("treemap"))||void 0===e?void 0:e(),pG(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 $$(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]}}J$.type=oB.treemap,J$.mark=gF,J$.transformerConstructor=Z$,U(J$,_$),U(J$,bU);const Q$=()=>{EW(),aY(),hz.registerAnimation("treemap",((t,e)=>({appear:q$(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),$H(),kR.registerTransform("treemap",{transform:KX,markPhase:"beforeJoin"},!0),hz.registerSeries(J$.type,J$)},tq={type:"fadeIn"};function eq(t,e){return"fadeIn"===e?tq:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class iq extends yG{constructor(){super(...arguments),this._supportStack=!1}}class sq extends mK{constructor(){super(...arguments),this.type=oB.gaugePointer,this.transformerConstructor=iq,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(sq.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},sq.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(sq.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(uG(null===(i=hz.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),pG("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}sq.type=oB.gaugePointer,sq.mark=vF,sq.transformerConstructor=iq;const nq=()=>{hz.registerSeries(sq.type,sq),gU(),EW(),hz.registerAnimation("gaugePointer",((t,e)=>{const i=eq(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),ZY(),$Y()};class rq extends yG{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class aq extends mK{constructor(){super(...arguments),this.type=oB.gauge,this.transformerConstructor=rq,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();Dz(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[OD]=t[this._angleField[0]],t[LD]=e>0?i[e-1][OD]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(aq.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(aq.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[LD])?this.angleAxisHelper.dataToPosition([t[LD]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[OD]])}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(uG(null===(i=hz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),pG("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}aq.type=oB.gauge,aq.mark=fF,aq.transformerConstructor=rq;class oq extends PG{constructor(){super(...arguments),this.type=oq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}oq.type="cell";const lq=()=>{hz.registerMark(oq.type,oq),fM(),_M(),kR.registerGraphic(RB.cell,bg),kR.registerMark(RB.cell,lD)};function hq(t){return!1===t?{}:{type:"fadeIn"}}class cq extends oN{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return p(i)&&"dimension"===t&&(i.visible=!1),i}}class dq extends yG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class uq extends AG{constructor(){super(...arguments),this.type=oB.heatmap,this.transformerConstructor=dq}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(uq.mark.cell,{morph:fG(this._spec,uq.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(uq.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=SG(this);this._cellMark.setAnimationConfig(uG(null===(i=hz.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),pG("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 cq(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]}}uq.type=oB.heatmap,uq.mark=SF,uq.transformerConstructor=dq;const pq=()=>{aY(),lq(),hz.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},KH),{appear:hq(e)}))),tW(),ZG(),hz.registerSeries(uq.type,uq)},gq=(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=mb(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=mb(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+mb(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+mb(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=cb(e.field),C=t.map(w),[E,P]=pb(C),B=E===P?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(P-E),R=u(e.radiusField)?w:cb(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?pb(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=mq(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),fq({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},fq=(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,[_D]:null==n?void 0:n[_D],[bD]:null==n?void 0:n[bD]}};class _q extends zH{constructor(){super(...arguments),this.type=_q.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}}_q.type="ripple";const yq=()=>{hz.registerMark(_q.type,_q),kR.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}}))),_O(),fO()},bq=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class xq extends yG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class Sq extends yY{constructor(){super(...arguments),this.type=oB.correlation,this.transformerConstructor=xq,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;Dz(this._dataSet,"correlation",gq);const s=new va;Fz(s,"dataview",ga),Dz(s,"correlationCenter",vq);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 sG(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(Sq.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:_D,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(Sq.mark.ripplePoint,{key:_D,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});a&&(this._ripplePointMark=a);const o=this._createMark(Sq.mark.centerPoint,{key:_D,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[gD],y:t=>t[mD],size:t=>t[fD],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},Jz.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},Jz.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},Jz.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)},Jz.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(uG(null===(e=hz.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),pG("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()}}Sq.type=oB.correlation,Sq.mark=AF,Sq.transformerConstructor=xq;const Aq=()=>{RG(),yq(),hz.registerSeries(Sq.type,Sq),hz.registerAnimation("correlation",((t,e)=>Object.assign({appear:bq(0,e)},YH)))};class kq extends zH{constructor(){super(...arguments),this.type=kq.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}}kq.type="liquid";const Mq=(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/2):t;class Tq extends oN{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 wq extends bG{constructor(){super(...arguments),this.type=oB.liquid,this.transformerConstructor=LG,this._liquidBackgroundMark=null,this._liquidOutlineMark=null}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){super.setAttrFromSpec(),this._marginSpec=$F(this._spec.outlineMargin),this._paddingSpec=$F(this._spec.outlinePadding),this.setValueField(this._spec.valueField)}rawDataUpdate(t){super.rawDataUpdate(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(wq.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(wq.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidMark=this._createMark(wq.mark.liquid,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_getPosAndSizeFormRegion(t=!1){const{top:e=0,bottom:i=0,left:s=0,right:n=0}=this._marginSpec,{top:r=0,bottom:a=0,left:o=0,right:l=0}=this._paddingSpec,{width:h,height:c}=this._region.getLayoutRect();return t?{x:h/2+(s-n)/2,y:c/2+(e-i)/2,size:Math.min(h-(s+n),c-(e+i))}:{x:h/2+(s+l-(n+l))/2,y:c/2+(e+r-(i+a))/2,size:Math.min(h-(s+n+o+l),c-(e+i+r+a))}}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),x:()=>this._getPosAndSizeFormRegion(!0).x,y:()=>this._getPosAndSizeFormRegion(!0).y,size:()=>this._getPosAndSizeFormRegion(!0).size,symbolType:()=>{var t;return Mq(null!==(t=this._spec.maskShape)&&void 0!==t?t:"circle",this._getPosAndSizeFormRegion(!0).size)}},"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:()=>{var t;const{x:e,y:i,size:s}=this._getPosAndSizeFormRegion();return[bg({x:e,y:i,size:s,symbolType:Mq(null!==(t=this._spec.maskShape)&&void 0!==t?t:"circle",s),fill:!0})]}},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setInteractive(!1)}_initLiquidMarkStyle(){const e=this._liquidMark;e&&this.setMarkStyle(e,{dx:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,y:()=>{const{y:t,size:e}=this._getPosAndSizeFormRegion();return t-e/2+e-e*this._heightRatio},height:()=>{const{size:t}=this._getPosAndSizeFormRegion();return t*this._heightRatio},fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new Tq(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}initInteraction(){this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i;const s={y:{from:()=>{const{y:t,size:e}=this._getPosAndSizeFormRegion();return t-e/2+e},to:()=>{const{y:t,size:e}=this._getPosAndSizeFormRegion();return t-e/2+e-e*this._heightRatio}},height:{from:0,to:()=>{const{size:t}=this._getPosAndSizeFormRegion();return t*this._heightRatio}}},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(uG(null===(i=hz.getAnimationInKey("liquid"))||void 0===i?void 0:i(s,n),pG("liquid",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=DM(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]}}wq.type=oB.liquid,wq.mark=MF,wq.transformerConstructor=LG;const Cq=t=>Y(t).join(",");class Eq extends oN{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>Cq(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>Cq(null==t?void 0:t[this.series.getDimensionField()[0]])}}class Pq extends yG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}class Bq extends bG{constructor(){super(...arguments),this.type=oB.venn,this.transformerConstructor=Pq,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:yD)}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(Bq.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(Bq.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()},Jz.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},Jz.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},Jz.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=>Cq(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)}},Jz.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=>Cq(t.sets)},Jz.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new Eq(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:Cq(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return Cq(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[Cq(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(Cq(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(uG(null===(e=hz.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),pG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(uG(null===(e=hz.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),pG(t.name,this._spec,this._markAttributeContext)))}))}}Bq.type=oB.venn,Bq.mark=TF,Bq.transformerConstructor=Pq;class Rq extends cW{_isValidSeries(t){return t===oB.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 Lq extends lW{constructor(){super(...arguments),this.transformerConstructor=Rq,this.type="map",this.seriesType=oB.map}}Lq.type="map",Lq.seriesType=oB.map,Lq.transformerConstructor=Rq;class Oq extends cW{_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 Iq extends Oq{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=PV(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,Tj({},s,l)),n&&Object.assign(o,Tj({},n,o))}}class Dq extends Oq{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 Fq extends Oq{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 jq extends lW{constructor(){super(...arguments),this.transformerConstructor=Fq}}jq.transformerConstructor=Fq;class zq extends jq{constructor(){super(...arguments),this.transformerConstructor=Fq,this.type="pie",this.seriesType=oB.pie}}zq.type="pie",zq.seriesType=oB.pie,zq.transformerConstructor=Fq;class Hq extends Fq{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class Vq extends jq{constructor(){super(...arguments),this.transformerConstructor=Hq,this.type="pie3d",this.seriesType=oB.pie3d}}Vq.type="pie3d",Vq.seriesType=oB.pie3d,Vq.transformerConstructor=Hq;class Nq extends Dq{_getDefaultSeriesSpec(t){var e,i,s;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:EB,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:EB,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=>Tj({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}class Gq extends lW{constructor(){super(...arguments),this.transformerConstructor=Nq,this.type="rose",this.seriesType=oB.rose,this._canStack=!0}}Gq.type="rose",Gq.seriesType=oB.rose,Gq.transformerConstructor=Nq;class Wq extends Dq{_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:Tj({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=>Tj({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class Uq extends lW{constructor(){super(...arguments),this.transformerConstructor=Wq,this.type="radar",this.seriesType=oB.radar,this._canStack=!0}}Uq.type="radar",Uq.seriesType=oB.radar,Uq.transformerConstructor=Wq;class Yq extends cW{_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")&&Tj(e,aH(this.type,t))})),this._transformAxisSpec(t)}}class Kq extends lW{constructor(){super(...arguments),this.transformerConstructor=Yq,this.type="common",this._canStack=!0}}Kq.type="common",Kq.transformerConstructor=Yq;class Xq extends dW{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 $q extends lW{constructor(){super(...arguments),this.transformerConstructor=Xq,this._canStack=!0}}$q.transformerConstructor=Xq;class qq extends Xq{transformSpec(t){super.transformSpec(t),sH(t)}}class Zq extends $q{constructor(){super(...arguments),this.transformerConstructor=qq,this.type="histogram",this.seriesType=oB.bar}}Zq.type="histogram",Zq.seriesType=oB.bar,Zq.transformerConstructor=qq;class Jq extends $q{constructor(){super(...arguments),this.transformerConstructor=qq,this.type="histogram3d",this.seriesType=oB.bar3d}}Jq.type="histogram3d",Jq.seriesType=oB.bar3d,Jq.transformerConstructor=qq;class Qq extends Iq{_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 tZ extends lW{constructor(){super(...arguments),this.transformerConstructor=Qq,this.type="circularProgress",this.seriesType=oB.circularProgress,this._canStack=!0}}tZ.type="circularProgress",tZ.seriesType=oB.circularProgress,tZ.transformerConstructor=Qq;class eZ extends Iq{_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:oB.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===oB.gauge||t.type===oB.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===oB.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 iZ extends lW{constructor(){super(...arguments),this.transformerConstructor=eZ,this.type="gauge",this.seriesType=oB.gaugePointer}}iZ.type="gauge",iZ.seriesType=oB.gaugePointer,iZ.transformerConstructor=eZ;class sZ extends cW{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class nZ extends lW{constructor(){super(...arguments),this.transformerConstructor=sZ,this.type="wordCloud",this.seriesType=oB.wordCloud}}nZ.transformerConstructor=sZ;class rZ extends sZ{_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 aZ extends nZ{constructor(){super(...arguments),this.transformerConstructor=rZ,this.type="wordCloud",this.seriesType=oB.wordCloud}}aZ.type="wordCloud",aZ.seriesType=oB.wordCloud,aZ.transformerConstructor=rZ;class oZ extends sZ{_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 lZ extends nZ{constructor(){super(...arguments),this.transformerConstructor=oZ,this.type="wordCloud3d",this.seriesType=oB.wordCloud3d}}lZ.type="wordCloud3d",lZ.seriesType=oB.wordCloud3d,lZ.transformerConstructor=oZ;class hZ extends cW{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 cZ extends lW{constructor(){super(...arguments),this.transformerConstructor=hZ,this.type="funnel",this.seriesType=oB.funnel}}cZ.type="funnel",cZ.seriesType=oB.funnel,cZ.transformerConstructor=hZ;class dZ extends lW{constructor(){super(...arguments),this.transformerConstructor=hZ,this.type="funnel3d",this.seriesType=oB.funnel3d}}dZ.type="funnel3d",dZ.seriesType=oB.funnel3d,dZ.transformerConstructor=hZ;class uZ extends dW{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=PV(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=PV(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class pZ extends lW{constructor(){super(...arguments),this.transformerConstructor=uZ,this.type="linearProgress",this.seriesType=oB.linearProgress,this._canStack=!0}}pZ.type="linearProgress",pZ.seriesType=oB.linearProgress,pZ.transformerConstructor=uZ;class gZ extends dW{_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),sH(t)}}class mZ extends lW{constructor(){super(...arguments),this.transformerConstructor=gZ,this.type="rangeColumn",this.seriesType=oB.rangeColumn}}mZ.type="rangeColumn",mZ.seriesType=oB.rangeColumn,mZ.transformerConstructor=gZ;class fZ extends dW{_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 vZ extends lW{constructor(){super(...arguments),this.transformerConstructor=fZ,this.type="rangeColumn3d",this.seriesType=oB.rangeColumn3d}}vZ.type="rangeColumn3d",vZ.seriesType=oB.rangeColumn3d,vZ.transformerConstructor=fZ;class _Z extends cW{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:CB,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=oB.sunburst;return s.type=n,s[n]=t[n],s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class yZ extends lW{constructor(){super(...arguments),this.transformerConstructor=_Z,this.type="sunburst",this.seriesType=oB.sunburst}}yZ.type="sunburst",yZ.seriesType=oB.sunburst,yZ.transformerConstructor=_Z;class bZ extends cW{_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=oB.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class xZ extends lW{constructor(){super(...arguments),this.transformerConstructor=bZ,this.type="circlePacking",this.seriesType=oB.circlePacking}}xZ.type="circlePacking",xZ.seriesType=oB.circlePacking,xZ.transformerConstructor=bZ;class SZ extends cW{_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 AZ extends lW{constructor(){super(...arguments),this.transformerConstructor=SZ,this.type="treemap",this.seriesType=oB.treemap}}AZ.type="treemap",AZ.seriesType=oB.treemap,AZ.transformerConstructor=SZ;class kZ extends IW{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),sH(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}class MZ extends DW{constructor(){super(...arguments),this.transformerConstructor=kZ,this.type="waterfall",this.seriesType=oB.waterfall}}MZ.type="waterfall",MZ.seriesType=oB.waterfall,MZ.transformerConstructor=kZ;class TZ extends dW{_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"}]),sH(t)}}class wZ extends lW{constructor(){super(...arguments),this.transformerConstructor=TZ,this.type="boxPlot",this.seriesType=oB.boxPlot}}wZ.type="boxPlot",wZ.seriesType=oB.boxPlot,wZ.transformerConstructor=TZ;class CZ extends cW{_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 EZ extends lW{constructor(){super(...arguments),this.transformerConstructor=CZ,this.type="sankey",this.seriesType=oB.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)}))}}EZ.type="sankey",EZ.seriesType=oB.sankey,EZ.transformerConstructor=CZ;class PZ extends dW{_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),sH(t)}}class BZ extends lW{constructor(){super(...arguments),this.transformerConstructor=PZ,this.type="rangeArea",this.seriesType=oB.rangeArea}}BZ.type="rangeArea",BZ.seriesType=oB.rangeArea,BZ.transformerConstructor=PZ;class RZ extends dW{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}class LZ extends lW{constructor(){super(...arguments),this.transformerConstructor=RZ,this.type="heatmap",this.seriesType=oB.heatmap}}LZ.type="heatmap",LZ.seriesType=oB.heatmap,LZ.transformerConstructor=RZ;class OZ extends cW{_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=oB.correlation;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class IZ extends lW{constructor(){super(...arguments),this.transformerConstructor=OZ,this.type="correlation",this.seriesType=oB.correlation}}IZ.type="correlation",IZ.seriesType=oB.correlation,IZ.transformerConstructor=OZ;function DZ(t){var e,i;const s=Object.assign({},t);return B(t.style)||(s.textStyle=lz(t.style)),B(t.textStyle)||Tj(s.textStyle,lz(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&lz(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&lz(s.background.style),s}const FZ=(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},jZ=(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:bD;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 zZ extends jG{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:()=>{sB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),sB(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=UF(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 DH(this._option,e),this._initSelectedData(),sB(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)||(sB(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(Tj({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(Tj({},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(Tj({},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}}zZ.specKey="legends";class HZ extends zZ{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),sB(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:Xz.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){Dz(this._option.dataSet,"discreteLegendFilter",jZ),Dz(this._option.dataSet,"discreteLegendDataMake",FZ);const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return sB(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(!rb(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=qj(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=DZ(s)),B(n.focusIconStyle)||lz(n.focusIconStyle),n.shape&&(n.shape=az(n.shape)),n.label&&(n.label=az(n.label)),n.value&&(n.value=az(n.value)),n.background&&(n.background=az(n.background)),YF(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),YF(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),YF(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)||lz(r.railStyle),B(r.sliderStyle)||lz(r.sliderStyle)):(B(r.textStyle)||lz(r.textStyle),r.handler&&az(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(Tj(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 uP}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(rP.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(rP.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(rP.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}=wV(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=wV(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}HZ.specKey="legends",HZ.type=r.discreteLegend;const VZ=(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[]},NZ=(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)?rz(t,+e,+i):t.filter((t=>t[o]>=e&&t[o]<=i))}return t};function GZ(t){return"color"===t||"size"===t}const WZ={color:vP,size:yP},UZ=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],YZ=[2,10];class KZ extends zZ{static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!y(e))return GZ(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)=>{GZ(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),sB(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData},level:Xz.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(){Dz(this._option.dataSet,"continuousLegendFilter",NZ),Dz(this._option.dataSet,"continuousLegendDataMake",VZ);const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>nB(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=qj(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!rb(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=qj(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?UZ:YZ);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=Tj({},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=DZ(s)),w.showHandler=!1!==n.visible,B(n.style)||(w.handlerStyle=lz(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),B(r.style)||(w.railStyle=lz(r.style)),B(a.style)||(w.trackStyle=lz(a.style)),w.startText=az(o),w.endText=az(l),w.handlerText=az(h),B(c)||(w.sizeBackground=lz(c)),d.visible&&!B(d.style)&&(Tj(w,d.style),p(d.padding)&&(w.padding=d.padding)),w}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return WZ[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))}}}KZ.specKey="legends",KZ.type=r.continuousLegend;class XZ{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=Tz(n,a,!0))&&void 0!==e?e:[],...null!==(i=gz(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(!jw(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=nN(s).includes(t):p(e.visible)||p(e.activeType)?d.visible=nN(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)&&(pN(s).every((t=>{var e;return!nN(null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec).includes("dimension")}))?d.visible=!1:p(e.visible)||p(e.activeType)?d.visible=nN(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=dN(t,i,s),m=uN(t,i,s),f=Tj({},I(e[t]),m),v=g.title,_=mN(void 0,f,u.shape,void 0,v);p(f.title)?f.title=hN(f.title,Object.assign(Object.assign({},v),_)):f.title=hN(v,_,!0);const y=Y(g.content);if(p(f.content)){const t=gN(y);f.content=cN(f.content,(e=>mN(e,f,u.shape,t)))}else f.content=cN(y,(t=>mN(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=SN(a,t,e),l=!!p(o)&&!1!==vN(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 $Z extends XZ{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 qZ extends XZ{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 ZZ extends XZ{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 JZ=t=>p(t)&&!y(t),QZ=t=>p(t)&&y(t);class tJ extends FG{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:s}=super._initTheme(t,e);return i.style=Tj({},this._theme,i.style),{spec:i,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h,c,d;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=nN(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:eb(this._option.mode)||!Qy(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=null===(d=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===d?void 0:d.getElementById(t.parentElement)):Qy(this._option.mode)&&(t.parentElement=null==Jy?void 0:Jy.body)}}class eJ extends jG{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=tJ,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._getMouseOutHandler=t=>e=>{var i,s,n;if(this._alwaysShow)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=Qy(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(!t&&this._clickLock)return;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&&JZ(this._cacheInfo)?a.mark=this._showTooltipByMouseEvent("mark",i,e,t,!0):r&&QZ(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),t&&this._clickLock&&(this._clickLock=!1))},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(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));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&sV.globalConfig.uniqueTooltip&&l&&sV.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._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?_N.canvas:_N.dom,n=hz.getComponentPluginInType(t);n||$y("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 qZ(this),dimension:new $Z(this),group:new ZZ(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)),(tb(i)||eb(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)))}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=iN(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(QZ(t)){if(JZ(this._cacheInfo))return!1;const e=this._cacheInfo;if(!(e.length===t.length&&t.every(((t,i)=>cz(t,e[i])))))return!1}else{if(QZ(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}}eJ.type=r.tooltip,eJ.transformerConstructor=tJ,eJ.specKey="tooltip";var iJ,sJ;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(iJ||(iJ={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(sJ||(sJ={}));const nJ={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class rJ extends jG{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=>{this._handleIn(t),this._clickLock=this._hasActive&&this._spec.lockAfterClick,this._clickLock&&S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._clickLock=!1,this._handleOutEvent()}),this.triggerOff))},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"}:tb(e)||eb(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=this.trigger||"hover",e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;if(y(t)){const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return[{click:"click"===t,in:i[t],out:e(t)}]}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)=>{nJ[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||t.yField)&&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){mz(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=>{jw(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[0],s=e.series.dataToPosition(e.datum[0]);(p(t.dimType)?"y"===t.dimType:fz(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=s.y:r=s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=e.x,a=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=rB(this._regions,"cartesian");if(!e)return;const{x:i,y:s,offsetWidth:n,offsetHeight:r,bandWidth:a,bandHeight:o}=zV(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=NV(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=GV(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 uT(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(n=new pT(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 QM(e)),null==s||s.add(t)),FV(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}aJ.specKey="crosshair",aJ.type=r.cartesianCrosshair;class oJ extends rJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return e.categoryField||e.valueField?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.polarCrosshair}]:void 0;const i=[];return e.forEach(((t,e)=>{(t.categoryField||t.valueField)&&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=>{jw(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=rB(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:"",Tj(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=EV(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=EV(s.getSpec())),c.angle=a.angle,c.axis=s,Tj(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}=wV(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}=wV(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 uT(Object.assign(Object.assign({},l),{lineStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===o&&(t=new mT(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 fT(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex+1})):new gT(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 QM(e),null==s||s.add(t),i(t)),FV(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair]}}oJ.specKey="crosshair",oJ.type=r.polarCrosshair;const lJ=(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)},hJ=(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 cJ extends jG{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 sB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),sB(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=_z(t),this._isHorizontal="horizontal"===yz(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=>!Dw(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(Dw(this._stateScale.type));this._stateScale.domain(e,!0),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={};sB(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=Dw(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 sB(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;Fz(s,"dataview",ga),Dz(s,"dataFilterComputeDomain",hJ);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 DH(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(Dw(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&&Dw(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,Dw(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=Dw(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 rC,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||(Dz(this._option.dataSet,"dataFilterWithNewDomain",lJ),sB(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:()=>Dw(this._stateScale.type)},level:Xz.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(Dw(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&&jw(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,jw(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(cJ,bU);class dJ extends FG{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=Tj({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 uJ extends cJ{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=dJ,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 TC;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(!Dw(t.type)||e[0]!==e[1])&&(!jw(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 rE(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:lz(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:lz(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:lz(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:lz(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:lz(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:lz(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:lz(g.style)},selectedBackgroundStyle:lz(this._spec.selectedBackground.style),dragMaskStyle:lz(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:Tj(lz(null===(l=m.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},lz(null===(h=m.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:Tj(lz(null===(c=f.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},lz(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}=wV(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()}}uJ.type=r.dataZoom,uJ.transformerConstructor=dJ,uJ.specKey="dataZoom";class pJ extends cJ{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 EM(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=$P(this._start,e)&&$P(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=lz(t.style)),B(null==e?void 0:e.style)||(s.sliderStyle=lz(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}pJ.type=r.scrollBar,pJ.specKey="scrollBar";const gJ=(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 mJ extends jG{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!==mJ.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(){Dz(this._option.dataSet,"indicatorFilter",gJ);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 DH(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=Tj({},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({},lz(e.style)),{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?ZF(this._spec.offsetX,this._computeLayoutRadius()):0,dy:this._spec.offsetY?ZF(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({},lz(this._spec.title.style)),{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 SP(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}}mJ.type=r.indicator,mJ.specKey="indicator";const fJ=["sum","average","min","max","variance","standardDeviation","median"];function vJ(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=X(s);return er}function _J(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&vJ(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=YF(t.x)?SJ(t.x,n)+r.x:l.getXAxisHelper().dataToPosition([t.x])+r.x,h}function yJ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&vJ(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=YF(t.y)?SJ(t.y,n)+r.y:l.getYAxisHelper().dataToPosition([t.y])+r.y,h}function bJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&vJ(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 xJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&vJ(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 SJ(t,e){return Number(t.substring(0,t.length-1))*e/100}function AJ(t){return fJ.includes(t)}function kJ(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=_J(t,m,n,d,h,a),i=yJ(t,f,n,d,c,a);u.push([{x:e,y:i}])}else if(e){const e=_J(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=yJ(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 MJ(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=bJ(t,l,n,r),i=xJ(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=bJ(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=xJ(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function TJ(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=YF(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=YF(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])&&vJ(_,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])&&vJ(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 wJ(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])&&vJ(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])&&vJ(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 CJ(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 YF(e)&&(e=SJ(e,r)),e+=s,YF(i)&&(i=SJ(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 YF(e)&&(e=SJ(e,s)),YF(i)&&(i=SJ(i,n)),{x:e,y:i}}))}function EJ(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 PJ(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},lz(r.style)):t.shape={visible:!1},!1!==s.visible?(t.panel=Object.assign({visible:!0},RJ(lz(s.style),i)),p(s.padding)&&(t.padding=ei(s.padding))):(t.panel={visible:!1},t.padding=0),n&&(t.textStyle=RJ(lz(n),i)),t}return{visible:!1}}function BJ(t,e){for(const i in t)d(t[i])&&(t[i]=t[i](e));return t}function RJ(t,e){return d(t)?t(e):t}function LJ(t,e){return d(t)?t(e):t}function OJ(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 IJ(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 DJ(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 FJ(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function jJ(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=>HJ(i,t,e))):s.x=HJ(i,t,e)}if(p(e.y)){const i=e.y;y(i)?s.y=i.map((i=>HJ(i,t,e))):s.y=HJ(i,t,e)}if(p(e.angle)){const i=e.angle;y(i)?s.angle=i.map((i=>HJ(i,t,e))):s.angle=HJ(i,t,e)}if(p(e.radius)){const i=e.radius;y(i)?s.radius=i.map((i=>HJ(i,t,e))):s.radius=HJ(i,t,e)}if(p(e.areaName)){const i=e.areaName;s.areaName=HJ(i,t,e)}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),i.push(s)})),i}const zJ={min:(t,e)=>qP(t[0].latestData,e.field),max:(t,e)=>ZP(t[0].latestData,e.field),sum:function(t,e){return JP(t[0].latestData,e.field)},average:function(t,e){return QP(t[0].latestData,e.field)},variance:function(t,e){return tB(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(tB(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 HJ(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 zJ[i](e,{field:s})}return t}class VJ extends jG{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)&&AJ(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])&&AJ(t[h])?i.x={field:h,aggrType:t[h]}:i.x=Y(h).map((e=>t[e])),_(t[c])&&AJ(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])&&AJ(t[o])?i.angle={field:o,aggrType:t[o]}:i.angle=Y(o).map((e=>t[e])),_(t[l])&&AJ(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=rB(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=KF(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=KF(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 NJ(t,e){return function(t,e,i){const{predict:s}=_b(t,(t=>t[e]),(t=>t[i])),n=qP(t,e),r=ZP(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 GJ(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 WJ extends VJ{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}=IJ(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:RJ(lz(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:PJ(y,this._markerData),state:{line:BJ(null!==(a=null===(r=this._spec.line)||void 0===r?void 0:r.state)&&void 0!==a?a:{},this._markerData),lineStartSymbol:BJ(null!==(l=null===(o=this._spec.startSymbol)||void 0===o?void 0:o.state)&&void 0!==l?l:{},this._markerData),lineEndSymbol:BJ(null!==(c=null===(h=this._spec.endSymbol)||void 0===h?void 0:h.state)&&void 0!==c?c:{},this._markerData),label:BJ(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:BJ(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:lz(b.style)}):S.startSymbol={visible:!1},x.visible?S.endSymbol=Object.assign(Object.assign({},x),{visible:!0,style:lz(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}=EJ([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}=IJ(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;Dz(this._option.dataSet,"markerAggregation",jJ),Dz(this._option.dataSet,"markerRegression",NJ),Dz(this._option.dataSet,"markerFilter",GJ);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}}WJ.specKey="markLine";class UJ extends WJ{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new UE(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:_}=IJ(e);let y=[];if(u||m||g||f||v||a&&l||a&&h){const t=kJ(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=TJ(i,r,d,e.coordinatesOffset):c&&(y=CJ(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(YF(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}=IJ(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}}}UJ.type=r.markLine,UJ.coordinateType="cartesian";class YJ extends WJ{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=IJ(this._spec);return e||i?new XE(t):new UE(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}=IJ(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=MJ(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=wJ(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}=IJ(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}}}YJ.type=r.polarMarkLine,YJ.coordinateType="polar";class KJ extends jG{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=UF(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 bP(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}}KJ.type=r.title,KJ.specKey=r.title;class XJ extends VJ{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=DJ(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:RJ(lz(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:PJ(u,this._markerData),state:{area:BJ(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData),label:BJ(null===(o=this._spec.label)||void 0===o?void 0:o.state,this._markerData),labelBackground:BJ(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}=EJ([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}=DJ(t);if(!(e||i||s||n||r||a||o))return null;const{options:l}=this._computeOptions(),h=this._getRelativeDataView();Dz(this._option.dataSet,"markerAggregation",jJ),Dz(this._option.dataSet,"markerFilter",GJ);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}}XJ.specKey="markArea";class $J extends XJ{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new KE(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}=DJ(e),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t;let u=[],g=[];if(l){g=kJ(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=kJ(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[...t,e[1],e[0]])}else h?u=TJ(i,r,d,e.coordinatesOffset):c&&(u=CJ(e.positions,r,e.regionRelative));return{points:u}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=DJ(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}}}$J.type=r.markArea,$J.coordinateType="cartesian";class qJ extends XJ{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=DJ(this._spec);return i||e||s?new $E(t):new KE(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}=DJ(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=MJ(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=wJ(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}=DJ(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}}}qJ.type=r.polarMarkArea,qJ.coordinateType="polar";const ZJ=t=>lz(Object.assign({},t)),JJ=t=>Object.assign(Object.assign({},t),{style:Object.assign({},lz(t.style))}),QJ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,m;const f=ZJ(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=ZJ(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:{},lz(Object.assign({},y)));var y;const b=JJ(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=JJ(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=JJ(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=JJ(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},tQ=t=>"left"===t||"right"===t,eQ=t=>"top"===t||"bottom"===t;class iQ extends jG{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({},QJ(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({},QJ(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 DP(t):this._playerComponent=new zP(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=tQ(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=tQ(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(PP.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(PP.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(PP.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(PP.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(PP.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(PP.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=tQ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=eQ(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)):tQ(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))):eQ(this._orient)?this._maxSize():t.height}_computeDx(t){return tQ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return eQ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}}iQ.specKey="player",iQ.type=r.player;class sQ extends jG{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)))}}sQ.type=r.label;class nQ extends rY{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}}nQ.type="text",nQ.constructorType="label";const rQ=()=>{hz.registerMark(nQ.constructorType,nQ),vO()};class aQ extends FG{_initTheme(t,e){return{spec:t,theme:this._theme}}}class oQ extends sQ{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=aQ,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),sB(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=Tj({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=HU[t])&&void 0!==i?i:HU.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}:VU(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}}oQ.type=r.label,oQ.specKey="label",oQ.transformerConstructor=aQ;class lQ extends sQ{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[PD]},"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 Tj({textStyle:{pickable:!0===this._spec.interactive},position:hQ(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[RD]))},a))}})).encode((e=>VU({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 hQ(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}lQ.type=r.totalLabel,lQ.specKey="totalLabel";class cQ extends VJ{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=FJ(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:LJ(E.offsetX,this._relativeSeries.getRegion()),offsetY:LJ(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:RJ(B.style,this._markerData)},state:{line:BJ(null!==(h=null===(l=this._spec.itemLine.line)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData),lineStartSymbol:BJ(null!==(d=null===(c=this._spec.itemLine.startSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData),lineEndSymbol:BJ(null!==(p=null===(u=this._spec.itemLine.endSymbol)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData),symbol:BJ(null!==(m=null===(g=this._spec.itemContent.symbol)||void 0===g?void 0:g.state)&&void 0!==m?m:{},this._markerData),image:BJ(null!==(v=null===(f=this._spec.itemContent.image)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData),text:BJ(null!==(y=null===(_=this._spec.itemContent.text)||void 0===_?void 0:_.state)&&void 0!==y?y:{},this._markerData),textBackground:BJ(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:BJ(null!==(A=null===(S=this._spec.itemContent.richText)||void 0===S?void 0:S.state)&&void 0!==A?A:{},this._markerData),customMark:BJ(null!==(M=null===(k=this._spec.itemContent.customMark)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData),targetItem:BJ(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=lz(RJ(L.style,this._markerData))),(null==O?void 0:O.style)&&(F.itemContent.imageStyle=RJ(O.style,this._markerData)),R&&(F.itemContent.textStyle=PJ(R,this._markerData)),(null==I?void 0:I.style)&&(F.itemContent.richTextStyle=RJ(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:lz(z.style)}):{visible:!1};return new ZE(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}=EJ([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:OJ(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:OJ(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}=FJ(t);if(!(p(t.coordinate)||e||i||s))return;Dz(this._option.dataSet,"markerAggregation",jJ),Dz(this._option.dataSet,"markerFilter",GJ);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}}cQ.specKey="markPoint";class dQ extends cQ{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=kJ(i,s,s,s,o)[0][0]:r?l=TJ(i,s,o,e.coordinatesOffset)[0]:a&&(l=CJ([e.position],s,e.regionRelative)[0]),{point:l}}_computeOptions(){const t=this._spec,{doXYProcess:e}=FJ(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}}}dQ.type=r.markPoint,dQ.coordinateType="cartesian";class uQ extends cQ{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=MJ(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}])]}}}uQ.type=r.polarMarkPoint,uQ.coordinateType="polar";class pQ extends cQ{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}])]}}}pQ.type=r.geoMarkPoint,pQ.coordinateType="geo";const gQ="inBrush",mQ="outOfBrush";class fQ extends jG{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),gQ,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),mQ,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 GP(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:lz(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(FP.drawStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(FP.moveStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(FP.drawing,(s=>{this._needInitOutState&&"single"===o&&this._initMarkBrushState(i,mQ),this._needInitOutState=!1,this._needDisablePickable=!0,this._handleBrushChange(t.ChartEvent.brushChange,e,s),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(FP.moving,(i=>{this._handleBrushChange(t.ChartEvent.brushChange,e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(FP.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(FP.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(FP.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({},lz(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(gQ),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(gQ),i.addState(mQ),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(gQ),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(gQ),i.addState(mQ),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(gQ),i.removeState(mQ),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}}}fQ.type=r.brush,fQ.specKey="brush";class vQ extends jG{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,`${hB}_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=uG({},pG(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}}}vQ.type=r.customMark,vQ.specKey="customMark";function _Q(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 yQ(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function bQ(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:yQ(t.rect),anchorCandidates:TQ(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=>_Q(t,r)));if(n.anchorCandidates)if(a&&(null===(e=n.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;t_Q(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 xQ(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=kQ(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(!kQ(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],SQ(AQ(t.point,l)))):t.point;n&&(s.x=n.x,s.y=n.y);const r=SQ(AQ(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=MQ(t.rect,a,0),t}));return bQ(h)}function SQ(t){return t>180?t-360:t}function AQ(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function kQ(t,e){for(let i=0;i{const{x:r,y:a}=MQ(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,s);n.push({x:r,y:a})})),n}class wQ extends jG{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:Xz.copyDataView},!1),this._data=new DH(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 ZE({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=$F(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=ku({});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=Tg(lz(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=bg(lz(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=mp(lz(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=mp(lz(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=MQ(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:lz(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]}))):bQ(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}}wQ.type=r.mapLabel,wQ.specKey="mapLabel";class CQ{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=>EQ(t))),a=n.filter((t=>!EQ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>EQ(t))),h=o.filter((t=>!EQ(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 EQ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}CQ.type="grid";sV.useRegisters([()=>{iI(),sI(),EG(),RG(),ZH(),XH(),tW(),ZG(),hz.registerSeries(nW.type,nW),hz.registerChart(pW.type,pW)},()=>{iI(),sI(),EG(),mW(),RG(),vW(),tW(),ZG(),hz.registerSeries(yW.type,yW),hz.registerChart(xW.type,xW)},()=>{OW(),hz.registerChart(DW.type,DW)},()=>{$W(),hz.registerChart(ZW.type,ZW)},()=>{OY(),hz.registerChart(zq.type,zq)},()=>{QY(),hz.registerChart(Gq.type,Gq)},()=>{oK(),hz.registerChart(Uq.type,Uq)},()=>{OW(),hz.registerChart(Zq.type,Zq)},()=>{TU(),hz.registerChart(Lq.type,Lq)},()=>{nq(),hz.registerSeries(aq.type,aq),PY(),_K(),$Y(),hz.registerChart(iZ.type,iZ)},()=>{oX(),hz.registerChart(aZ.type,aZ)},()=>{wX(),hz.registerChart(cZ.type,cZ)},()=>{ZU(),hz.registerChart(MZ.type,MZ)},()=>{sY(),RG(),XH(),tW(),ZG(),hz.registerSeries(nY.type,nY),hz.registerChart(wZ.type,wZ)},()=>{hz.registerSeries(bK.type,bK),PY(),_K(),$H(),ZY(),$Y(),hz.registerChart(tZ.type,tZ)},()=>{wK(),hz.registerChart(pZ.type,pZ)},()=>{mY(),hz.registerChart(mZ.type,mZ)},()=>{mW(),tW(),ZG(),hz.registerSeries(_Y.type,_Y),hz.registerChart(BZ.type,BZ)},()=>{b$(),hz.registerChart(yZ.type,yZ)},()=>{M$(),hz.registerChart(xZ.type,xZ)},()=>{Q$(),hz.registerChart(AZ.type,AZ)},()=>{K$(),hz.registerChart(EZ.type,EZ)},()=>{pq(),hz.registerChart(LZ.type,LZ)},()=>{Aq(),hz.registerChart(IZ.type,IZ)},()=>{hz.registerChart(Kq.type,Kq)},ZG,tW,()=>{GG(),hz.registerComponent(eW.type,eW)},()=>{GG(),hz.registerComponent(iW.type,iW)},()=>{GG(),hz.registerComponent(sW.type,sW)},ZY,$Y,()=>{hz.registerComponent(HZ.type,HZ)},()=>{hz.registerComponent(KZ.type,KZ)},()=>{hz.registerComponent(eJ.type,eJ)},()=>{hz.registerComponent(aJ.type,aJ)},()=>{hz.registerComponent(oJ.type,oJ)},()=>{hz.registerComponent(uJ.type,uJ)},()=>{hz.registerComponent(pJ.type,pJ)},()=>{hz.registerComponent(mJ.type,mJ)},AU,()=>{hz.registerComponent(UJ.type,UJ),WE()},()=>{hz.registerComponent($J.type,$J),YE()},()=>{hz.registerComponent(dQ.type,dQ),qE()},()=>{hz.registerComponent(YJ.type,YJ),XE._animate=TE,WE()},()=>{hz.registerComponent(qJ.type,qJ),$E._animate=CE,YE()},()=>{hz.registerComponent(uQ.type,uQ),qE()},()=>{hz.registerComponent(pQ.type,pQ),qE()},()=>{hz.registerComponent(KJ.type,KJ)},()=>{hz.registerComponent(iQ.type,iQ)},()=>{zO(),rQ(),HG(),hz.registerComponent(oQ.type,oQ,!0)},()=>{zO(),rQ(),HG(),hz.registerComponent(lQ.type,lQ,!0)},()=>{hz.registerComponent(fQ.type,fQ)},()=>{hz.registerComponent(vQ.type,vQ)},()=>{hz.registerComponent(wQ.type,wQ)},()=>{ql.load(cT)},()=>{hz.registerLayout(CQ.type,CQ)},ZN,pV,UR,WR]),sV.useRegisters([()=>{cA(ql)}]),t.ARC_END_ANGLE=xB,t.ARC_K=SB,t.ARC_MIDDLE_ANGLE=AB,t.ARC_QUADRANT=kB,t.ARC_RADIAN=MB,t.ARC_RATIO=yB,t.ARC_START_ANGLE=bB,t.ARC_TRANSFORM_VALUE=_B,t.AxisSyncPlugin=xV,t.BASE_EVENTS=hD,t.CORRELATION_SIZE=fD,t.CORRELATION_X=gD,t.CORRELATION_Y=mD,t.CanvasTooltipHandler=qN,t.DEFAULT_CHART_HEIGHT=dB,t.DEFAULT_CHART_WIDTH=cB,t.DEFAULT_CONICAL_GRADIENT_CONFIG=HD,t.DEFAULT_DATA_INDEX=_D,t.DEFAULT_DATA_KEY=yD,t.DEFAULT_DATA_SERIES_FIELD=bD,t.DEFAULT_GRADIENT_CONFIG=VD,t.DEFAULT_LABEL_ALIGN=pB,t.DEFAULT_LABEL_LIMIT=uB,t.DEFAULT_LABEL_TEXT=gB,t.DEFAULT_LABEL_VISIBLE=mB,t.DEFAULT_LABEL_X=fB,t.DEFAULT_LABEL_Y=vB,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_GRADIENT_CONFIG=jD,t.DEFAULT_MEASURE_CANVAS_ID=vD,t.DEFAULT_RADIAL_GRADIENT_CONFIG=zD,t.DEFAULT_SERIES_STYLE_NAME=xD,t.DomTooltipHandler=$N,t.Factory=hz,t.FormatterPlugin=uV,t.GradientType=FD,t.MediaQuery=lV,t.POLAR_DEFAULT_RADIUS=EB,t.POLAR_END_ANGLE=270,t.POLAR_END_RADIAN=wB,t.POLAR_START_ANGLE=CB,t.POLAR_START_RADIAN=TB,t.PREFIX=hB,t.SEGMENT_FIELD_END=OD,t.SEGMENT_FIELD_START=LD,t.STACK_FIELD_END=MD,t.STACK_FIELD_END_OffsetSilhouette=ED,t.STACK_FIELD_END_PERCENT=wD,t.STACK_FIELD_KEY=AD,t.STACK_FIELD_START=kD,t.STACK_FIELD_START_OffsetSilhouette=CD,t.STACK_FIELD_START_PERCENT=TD,t.STACK_FIELD_TOTAL=PD,t.STACK_FIELD_TOTAL_PERCENT=BD,t.STACK_FIELD_TOTAL_TOP=RD,t.ThemeManager=Wj,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=sV,t.WaterfallDefaultSeriesField=pD,t.builtinThemes=Lj,t.computeActualDataScheme=LF,t.darkTheme=yj,t.dataScheme=JF,t.default=sV,t.defaultThemeName=Oj,t.getActualColor=IF,t.getColorSchemeBySeries=zF,t.getDataScheme=RF,t.getMergedTheme=Nj,t.getTheme=zj,t.hasThemeMerged=Fj,t.isColorKey=DF,t.isProgressiveDataColorScheme=FF,t.isTokenKey=fj,t.lightTheme=_j,t.queryColorFromColorScheme=OF,t.queryToken=mj,t.registerCanvasTooltipHandler=ZN,t.registerChartPlugin=oV,t.registerDomTooltipHandler=()=>{XN($N)},t.registerFormatPlugin=pV,t.registerMediaQuery=()=>{oV(lV)},t.registerTheme=jj,t.removeTheme=Hj,t.themeExist=Vj,t.themes=Ij,t.token=vj,t.transformColorSchemeToStandardStruct=jF,t.version="1.11.4",t.vglobal=P_,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 V(t){return Object.prototype.toString.call(t)}function N(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(V(t)!==V(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=N(t),n=N(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 Vt(t){return t>1?0:t<-1?Et:Math.acos(t)}function Nt(t){return t>=1?Pt:t<=-1?-Pt:Math.asin(t)}function Gt(t,e,i,s,n){let r,a;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 Ve,Ne,Ge,We;function Ue(t){return Ve=1/0,Ne=1/0,Ge=-1/0,We=-1/0,t.forEach((t=>{Ve>t.x&&(Ve=t.x),Get.y&&(Ne=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},Vi=Math.sqrt,Ni=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=Vi(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=Ns},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=Vs,Rs=Os=t,Ls=Is=e}function Vs(t,e){Fs.add(Is*t-Os*e),Os=t,Is=e}function Ns(){Vs(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=Vi(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=Vi(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(Vi(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 Vn=16,Nn=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=Vi(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()):Vi(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 Ni((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)*Vi(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 Vr(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 Vr(s).parse(t)},Yr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Lr.DSV,Nr(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",Va="Function",Na="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 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 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 No(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 No("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){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"linearClosed":return ll(t,i)}}class cl 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 dl=["l",0,0,0,0,0,0,0];function ul(t,e,i){const s=dl[0]=t[0];if("a"===s||"A"===s)dl[1]=e*t[1],dl[2]=i*t[2],dl[3]=t[3],dl[4]=t[4],dl[5]=t[5],dl[6]=e*t[6],dl[7]=i*t[7];else if("h"===s||"H"===s)dl[1]=e*t[1];else if("v"===s||"V"===s)dl[1]=i*t[1];else for(let s=1,n=t.length;s{at.getInstance().warn("空函数")}}),Cl=Object.assign(Object.assign({},bl),{points:[],cornerRadius:0,closePath:!0}),El=Object.assign(Object.assign({},bl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},bl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const Pl=Object.assign(Object.assign({},bl),{symbolType:"circle",size:10,keepDirIn3d:!0}),Bl=Object.assign(Object.assign(Object.assign({},bl),vl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Rl=Object.assign(Object.assign(Object.assign({},bl),vl),{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}),Ll=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},bl),{fill:!0,cornerRadius:0}),Ol=Object.assign(Object.assign({},Ll),{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 Il=new class{},Dl={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"}},Fl=!0,jl=!1,zl=/\w|\(|\)|-/,Hl=/[.?!,;:/,。?!、;:]/,Vl=/\S/;function Nl(t,e,i,s,n){if(!e||e<=0)return 0;const r=Il.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=Gl(t,a)),a}function Gl(t,e){let i=e;for(;zl.test(t[i-1])&&zl.test(t[i])||Hl.test(t[i]);)if(i--,i<=0)return e;return i}function Wl(t,e){const i=Il.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 Ul=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Yl=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=Bl.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=Gl(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=Gl(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}};Yl=Ul([Oa()],Yl);var Kl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Xl=Symbol.for("TextMeasureContribution");let $l=class extends Yl{};$l=Kl([Oa()],$l);const ql=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 Va: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===Da&&(t.cache=e,t.activated=!0)}},Zl=Symbol.for("CanvasFactory"),Jl=Symbol.for("Context2dFactory");function Ql(t){return ql.getNamed(Zl,Il.global.env)(t)}const th=1e-4,eh=Math.sqrt(3),ih=1/3;function sh(t){return t>-vh&&tvh||t<-vh}const rh=[0,0],ah=[0,0],oh=[0,0];function lh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function hh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function ch(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 dh(t){return(t%=Rt)<0&&(t+=Rt),t}function uh(t,e,i,s,n,r){if(r>e&&r>s||rn?o:0}function ph(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 fh(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(sh(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 yh=[-1,-1,-1],bh=[-1,-1];function xh(){const t=bh[0];bh[0]=bh[1],bh[1]=t}function Sh(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(sh(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,ih):Math.pow(i,ih),s=s<0?-Math.pow(-s,ih):Math.pow(s,ih);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+eh*Math.sin(e)))/(3*a),h=(-o+i*(s-eh*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,yh);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&xh(),p=ch(e,s,r,o,bh[0]),u>1&&(g=ch(e,s,r,o,bh[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(sh(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,yh);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=hh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);yh[0]=-l,yh[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>=yh[0]+t&&a<=yh[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=yh[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 Mh(t){return Math.round(t/Et*1e8)/1e8%2*Et}function Th(t,e){let i=Mh(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-Mh(i-n)):e&&i1&&(i||(h+=uh(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;wh[0]=S,wh[1]=A,Th(wh,Boolean(a[6])),S=wh[0],A=wh[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(fh(c,d,f,v,e,s,n))return!0}else h+=uh(c,d,f,v,s,n)||0;c=f,d=v;break;case po.C:if(i){if(gh(c,d,f,v,_,y,b,x,e,s,n))return!0}else h+=Sh(c,d,f,v,_,y,b,x,s,n)||0;c=b,d=x;break;case po.Q:if(i){if(ph(c,d,f,v,_,y,e,s,n))return!0}else h+=Ah(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+=uh(c,d,o,l,s,n),i){if(mh(f,v,_,k,k+M,T,e,w,n))return!0}else h+=kh(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(fh(u,p,o,p,e,s,n)||fh(o,p,o,l,e,s,n)||fh(o,l,u,l,e,s,n)||fh(u,l,u,p,e,s,n))return!0}else h+=uh(o,p,o,l,s,n),h+=uh(u,l,u,p,s,n);break;case po.Z:if(i){if(fh(c,d,u,p,e,s,n))return!0}else h+=uh(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},Bh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Rh=Symbol.for("VWindow"),Lh=Symbol.for("WindowHandlerContribution");let Oh=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&&(ql.getNamed(Lh,t.env).configure(this,t),this.actived=!0)},this._uid=ba.GenAutoIncrementId(),this.global=Il.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)}};Oh=Ph([Oa(),Bh("design:paramtypes",[])],Oh);var Ih=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fh=function(t,e){return function(i,s){e(i,s,t)}};let jh=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=Il.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=Eh.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:vl.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:vl.fontFamily,fontSize:vl.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=ql.get(Rh),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 zh;jh=Ih([Oa(),Fh(0,Ra(qa)),Fh(0,Ia(Xl)),Dh("design:paramtypes",[Object])],jh),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(zh||(zh={}));const Hh=new oe;let Vh=class{constructor(){this.matrix=new oe}init(t){return this.mode=zh.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=zh.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Hh.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(Hh.a,Hh.b,Hh.c,Hh.d,Hh.e,Hh.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Hh.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(Hh.a,Hh.b,Hh.c,Hh.d,Hh.e,Hh.f),this}scale(t,e,i){return this.mode===zh.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===zh.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Hh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Hh.a,Hh.b,Hh.c,Hh.d,Hh.e,Hh.f),this}translate(t,e){return this.mode===zh.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===zh.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Vh=Ih([Oa(),Dh("design:paramtypes",[])],Vh);const Nh={arc:xl,area:Sl,circle:Al,line:Tl,path:wl,symbol:Pl,text:Bl,rect:El,polygon:Cl,richtext:Rl,richtextIcon:Ol,image:Ll,group:kl,glyph:Ml},Gh=Object.keys(Nh);function Wh(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Uh={arc:Object.assign({},Nh.arc),area:Object.assign({},Nh.area),circle:Object.assign({},Nh.circle),line:Object.assign({},Nh.line),path:Object.assign({},Nh.path),symbol:Object.assign({},Nh.symbol),text:Object.assign({},Nh.text),rect:Object.assign({},Nh.rect),polygon:Object.assign({},Nh.polygon),richtext:Object.assign({},Nh.richtext),richtextIcon:Object.assign({},Nh.richtextIcon),image:Object.assign({},Nh.image),group:Object.assign({},Nh.group),glyph:Object.assign({},Nh.glyph)};class Yh{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Gh.forEach((t=>{this._defaultTheme[t]=Object.create(Uh[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;Gh.forEach((s=>{const n=Object.create(Uh[s]);t&&t[s]&&Wh(n,t[s]),i[s]&&Wh(n,i[s]),e[s]&&Wh(n,e[s]),this.combinedTheme[s]=n})),e.common&&Gh.forEach((t=>{Wh(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 Kh=new Yh;function Xh(t,e){return t.glyphHost?Xh(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)):Kh.getTheme()}return null}(t)||t.attachedThemeGraphic&&Xh(t.attachedThemeGraphic)||Kh.getTheme()}var $h=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=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 $h(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 Qh))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(sc(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 Qh))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=sc(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 Qh))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=sc(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 Qh))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=sc(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 Qh))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=ic.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(sc(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(sc(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,sc(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 Qh))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"):sc(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 tc))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=ic.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 nc(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 Qh,this.rootWheelEvent=new tc,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 lc{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return lc.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 hc{static Avaliable(){return!0}avaliable(){return hc.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 cc{static Avaliable(){return!!Il.global.getRequestAnimationFrame()}avaliable(){return cc.Avaliable()}tick(t,e){Il.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var dc;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(dc||(dc={}));class uc{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-uc.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*uc.bounceIn(2*t):.5*uc.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}}}uc.quadIn=uc.getPowIn(2),uc.quadOut=uc.getPowOut(2),uc.quadInOut=uc.getPowInOut(2),uc.cubicIn=uc.getPowIn(3),uc.cubicOut=uc.getPowOut(3),uc.cubicInOut=uc.getPowInOut(3),uc.quartIn=uc.getPowIn(4),uc.quartOut=uc.getPowOut(4),uc.quartInOut=uc.getPowInOut(4),uc.quintIn=uc.getPowIn(5),uc.quintOut=uc.getPowOut(5),uc.quintInOut=uc.getPowInOut(5),uc.backIn=uc.getBackIn(1.7),uc.backOut=uc.getBackOut(1.7),uc.backInOut=uc.getBackInOut(1.7),uc.elasticIn=uc.getElasticIn(1,.3),uc.elasticOut=uc.getElasticOut(1,.3),uc.elasticInOut=uc.getElasticInOut(1,.3*1.5);class pc{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 gc=new pc;class mc{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(){}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 fc extends mc{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let vc=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]:gc;this.id=t,this.timeline=e,this.status=Ao.INITIAL,this.tailAnimate=new _c(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.duration===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 fc((()=>{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 _c(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()}};vc.mode=ko.NORMAL,vc.interpolateMap=new Map;class _c{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 yc(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?uc[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?uc[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 yc(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 yc{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 bc=200,xc="cubicOut",Sc=1e3,Ac="quadInOut";var kc;!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"}(kc||(kc={}));const Mc=[!1,!1,!1,!1],Tc=[0,0,0,0],wc=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Tc[0]=t[0],Tc[2]=t[0],Tc[1]=t[1],Tc[3]=t[1],Tc):t:t:0,Cc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Ec=[1,2,3,0,1,2,3,0];function Pc(t,e,i,s){for(;t>=Rt;)t-=Rt;for(;t<0;)t+=Rt;for(;t>e;)e+=Rt;Cc[0].x=i,Cc[1].y=i,Cc[2].x=-i,Cc[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]:Ic.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)}}Ic.TimeOut=1e3/60;const Dc=new Ic,Fc=(t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class jc extends mc{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 zc;!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"}(zc||(zc={}));class Hc extends mc{constructor(t,e,i,s,n){super(t,e,i,s,n),this.newPointAnimateType="appear"===(null==n?void 0:n.newPointAnimateType)?"appear":"grow"}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}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?[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=Bc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),i.points=this.points}}class Vc extends mc{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 Nc extends Vc{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=Il.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 Gc extends Vc{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=Il.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 Wc extends mc{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 Uc extends mc{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?uc[n]:n;e=r(e),s.onUpdate(t,e,i)})),this.updating=!1)}}function Yc(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 Kc(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 Qc(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 td(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 sd(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}))),ad=(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]},od=(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 ad(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return ad(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);od(n[0],s,i),od(n[1],e-s,i)}};var ld;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(ld||(ld={}));class hd{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ld.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===ld.Color1){const e=hd.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];hd.store1[t]=e,hd.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=hd.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&&(hd.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],hd.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===ld.Color1){if(hd.store1[t])return;hd.store1[t]=i,hd.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(hd.store255[t])return;hd.store255[t]=i,hd.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function cd(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 dd(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)=>ud(y(t)?t[r]:t,y(e)?e[r]:e,i,s))):ud(t,e,i,s,n)}function ud(t,e,i,s,n){if(!t||!e)return t&&cd(t)||e&&cd(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=hd.Get(t,ld.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=hd.Get(e,ld.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:cd(a)})))});return o?dd(r,l,i,s,n):dd(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:md(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:md(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:md(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),cd(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)}hd.store255={},hd.store1={};const pd=[0,0,0,0],gd=[0,0,0,0];function md(t,e,i){return hd.Get(t,ld.Color255,pd),hd.Get(e,ld.Color255,gd),`rgba(${Math.round(pd[0]+(gd[0]-pd[0])*i)},${Math.round(pd[1]+(gd[1]-pd[1])*i)},${Math.round(pd[2]+(gd[2]-pd[2])*i)},${pd[3]+(gd[3]-pd[3])*i})`}const fd=(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=dd(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},vd=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?Qc(t):[],n=Qc(e);i&&s&&(i.fromTransform&&td(s,i.fromTransform.clone().getInverse()),td(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})))},yd=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],bd=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!yd.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]?hd.Get(t[n],ld.Color255):t[n],to:"string"==typeof r?hd.Get(r,ld.Color255):r,key:n}):i.push({from:t[n],to:r,key:n}),s=!0)})),s?i:null};class xd extends mc{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;vd(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&fd(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Sd=(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=_d(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=bd(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 xd({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Sc,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Ac)),c};class Ad extends mc{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;vd(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&&fd(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const kd=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Lc.includes(t))(i)||(e[i]=t[i])})),e},Md=(t,e,i)=>{const s=kd(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=Il.graphicService.creator.rect({x:0,y:0,width:a,height:o});n.appendChild(i),e.push(i)}))}},Td=(t,e,i)=>{const s=[],n=i?null:kd(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:kd(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=id(t.attribute),n=sd(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(Il.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=sd(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(Il.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=sd(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(Il.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 nd(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 nd(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(Il.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:rd(i)}];const s=[];return od(i,e,s),s})(t,e).forEach((t=>{s.push(Il.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 od(r,e,h),h})(t,e).forEach((t=>{s.push(Il.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=Qc(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(Il.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(Il.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Md(t,s,e),s};class Cd{static GetImage(t,e){var i;const s=Cd.cache.get(t);s?"fail"===s.loadState?Il.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):Cd.loadImage(t,e)}static GetSvg(t,e){var i;let s=Cd.cache.get(t);s?"fail"===s.loadState?Il.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"},Cd.cache.set(t,s),s.dataPromise=Il.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=Cd.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"},Cd.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Il.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Il.global.loadBlob(t):"json"===e&&(i.dataPromise=Il.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Cd.isLoading&&Cd.toLoadAueue.length){Cd.isLoading=!0;const t=Cd.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Cd.cache.set(i,n),n.dataPromise=Il.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((()=>{Cd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Cd.loading()})).catch((t=>{console.error(t),Cd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Cd.loading()}))}}),0)}static loadImage(t,e){const i=Ed(t,Cd.toLoadAueue);if(-1!==i)return Cd.toLoadAueue[i].marks.push(e),void Cd.loading();Cd.toLoadAueue.push({url:t,marks:[e]}),Cd.loading()}static improveImageLoading(t){const e=Ed(t,Cd.toLoadAueue);if(-1!==e){const t=Cd.toLoadAueue.splice(e,1);Cd.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Ed(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;Dd.x=n+(null!==(i=t.scrollX)&&void 0!==i?i:0),Dd.y=r+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else Dd.x=n,Dd.y=r;return Dd}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Il.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Il.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]:Rd;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Rd;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(Il.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:bc,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:xc),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 Bd.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(Bd),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=pl.x,y:e=pl.y,scaleX:i=pl.scaleX,scaleY:s=pl.scaleY,angle:n=pl.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),Il.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(pl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Pd.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),Il.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=dd(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=dd(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=dd(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 Xh(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:Il.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 cl).fromString(t):this.pathProxy=new cl,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",Il.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new ec(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)}}}jd.mixin(rc);class zd{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 Hd(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Vd(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 Nd=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class Gd{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=Vd(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Hd(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Vd(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 zd(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 zd(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 Wd(t,e){return Ud(t)}function Ud(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 Zd=0;function Jd(){return Zd++}var Qd;function tu(t){const e=[];let i=0,s="";for(let n=0;neu.set(t,!0)));const iu=new Map;function su(t){if(eu.has(t))return!0;if(iu.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>iu.set(t,!0)));const nu=Jd(),ru=Jd(),au=Jd(),ou=Jd(),lu=Jd(),hu=Jd(),cu=Jd(),du=Jd(),uu=Jd(),pu=Jd();Jd();const gu=Jd();Jd();const mu=Jd(),fu=Jd(),vu=Jd(),_u=Symbol.for("GraphicService"),yu=Symbol.for("GraphicCreator"),bu={"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"},xu=Object.keys(bu);var Su;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Su||(Su={}));let Au=class t extends jd{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=hu,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 Yh),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Yh)}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;Il.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),Il.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=pl.x,y:e=pl.y,dx:i=pl.dx,dy:s=pl.dy,scaleX:n=pl.scaleX,scaleY:r=pl.scaleY,angle:a=pl.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=Xh(this).group;this._AABBBounds.clear();const i=Il.graphicService.updateGroupAABBBounds(t,e,this._AABBBounds,this),{boundsPadding:s=e.boundsPadding}=t,n=wc(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(),Il.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Il.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,Il.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{Il.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),Il.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=Il.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 ku(t){return new Au(t)}Au.NOWORK_ANIMATE_ATTR=Fd;class Mu extends Au{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 Yh,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=>{Il.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=>{Il.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 Tu=Symbol.for("TransformUtil"),wu=Symbol.for("GraphicUtil"),Cu=Symbol.for("LayerService"),Eu=Symbol.for("StaticLayerHandlerContribution"),Pu=Symbol.for("DynamicLayerHandlerContribution"),Bu=Symbol.for("VirtualLayerHandlerContribution");var Ru,Lu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)};let Iu=Ru=class{static GenerateLayerId(){return`${Ru.idprefix}_${Ru.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Il.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(Eu):"dynamic"===t?ql.get(Pu):ql.get(Bu),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 Mu(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Ru.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)}};Iu.idprefix="visactor_layer",Iu.prefix_count=0,Iu=Ru=Lu([Oa(),Ou("design:paramtypes",[])],Iu);var Du=new xa((t=>{t(io).to(ao).inSingletonScope(),t(Rh).to(Oh),t(wu).to(jh).inSingletonScope(),t(Tu).to(Vh).inSingletonScope(),t(Cu).to(Iu).inSingletonScope()}));function Fu(t,e){return!(!t&&!e)}function ju(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function zu(t,e,i){return i&&t*e>0}function Hu(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Vu(t,e){return t*e>0}function Nu(t,e,i,s){return t*e>0&&0!==i&&0!==s}function Gu(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 Uu(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(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:m,outerEndAngle:f,innerEndAngle:v,innerStartAngle:_}=t.getParsePadAngle(o,l),y=u,b=u,x=u,S=u,A=Math.max(b,y),k=Math.max(x,S);let M=A,T=k;const w=n*It(m),C=n*jt(m),E=r*It(v),P=r*jt(v);let B,R,L,O;if((k>Ct||A>Ct)&&(B=n*It(f),R=n*jt(f),L=r*It(_),O=r*jt(_),hCt){const t=Ft(y,M),r=Ft(b,M),o=Wu(L,O,w,C,n,t,Number(c)),l=Wu(B,R,E,P,n,r,Number(c));M0&&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+B,s+n*jt(f))}else!a||a[0]?(e.moveTo(i+w,s+C),e.arc(i,s,n,m,f,!c)):e.moveTo(i+n*It(f),s+n*jt(f));if(!(r>Ct)||g<.001)!a||a[1]?e.lineTo(i+E,s+P):e.moveTo(i+E,s+P),d=!0;else if(T>Ct){const t=Ft(S,T),n=Ft(x,T),o=Wu(E,P,B,R,r,-n,Number(c)),l=Wu(w,C,L,O,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),T0&&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+L,s+O)}else!a||a[1]?e.lineTo(i+E,s+P):e.moveTo(i+E,s+P),!a||a[2]?e.arc(i,s,r,v,_,c):e.moveTo(i+r*It(_),s+r*jt(_))}return a?a[3]&&e.lineTo(i+n*It(o),s+n*jt(o)):e.closePath(),d}class Yu{static GetCanvas(){try{return Yu.canvas||(Yu.canvas=Il.global.createCanvas({})),Yu.canvas}catch(t){return null}}static GetCtx(){if(!Yu.ctx){const t=Yu.GetCanvas();Yu.ctx=t.getContext("2d")}return Yu.ctx}}class Ku extends le{static getInstance(){return Ku._instance||(Ku._instance=new Ku),Ku._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=Yu.GetCanvas(),s=Yu.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 Ku(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Xu{static GetSize(t){for(let e=0;e=t)return Xu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Xu.GenKey(t,e,i,s,n),l=Xu.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=Xu.GenKey(t,e,i,s,n);Xu.cache[l]?Xu.cache[l].push({width:a,height:o,pattern:r}):Xu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}Xu.cache={},Xu.ImageSize=[20,40,80,160,320,640,1280,2560];const $u=Symbol.for("ArcRenderContribution"),qu=Symbol.for("AreaRenderContribution"),Zu=Symbol.for("CircleRenderContribution"),Ju=Symbol.for("GroupRenderContribution"),Qu=Symbol.for("ImageRenderContribution"),tp=Symbol.for("PathRenderContribution"),ep=Symbol.for("PolygonRenderContribution"),ip=Symbol.for("RectRenderContribution"),sp=Symbol.for("SymbolRenderContribution"),np=Symbol.for("TextRenderContribution"),rp=Symbol.for("InteractiveSubRenderContribution"),ap=["radius","startAngle","endAngle",...Rd];class op extends jd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=ou}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=Xh(this).circle;this._AABBBounds.clear();const i=this.attribute,s=Il.graphicService.updateCircleAABBBounds(i,Xh(this).circle,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=wc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xh(this).circle[t]}needUpdateTags(t){return super.needUpdateTags(t,ap)}needUpdateTag(t){return super.needUpdateTag(t,ap)}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 cl;return o.arc(0,0,n,r,a),o}clone(){return new op(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return op.NOWORK_ANIMATE_ATTR}}function lp(t){return new op(t)}function hp(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 cp(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function dp(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)}op.NOWORK_ANIMATE_ATTR=Fd;class up{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=vu,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=Xh(this).text;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=this.attribute,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}updateWrapAABBBounds(t){var e,i,s,n;const r=Xh(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=Fc(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=Il.graphicUtil.textMeasure,k=new up(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===Qd.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=cp(x,o),M=dp(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=Xh(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=Fc(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 _=Il.graphicUtil.textMeasure,y=new up(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=Xh(this).text,a=Il.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=Fc(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=cp(x,o),e=this.cache.verticalList.length*b,i=dp(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=>tu(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===Qd.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=cp(x,o),M=this.cache.verticalList.length*b,T=dp(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 Xh(this).text[t]}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pp;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pp;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function mp(t){return new gp(t)}gp.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Fd),gp.baselineMapAlign={top:"left",bottom:"right",middle:"center"},gp.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class fp{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 vp(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 _p=new class extends fp{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 vp(t,e/2,i,s,n)}drawOffset(t,e,i,s,n,r){return vp(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 yp=new class extends fp{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 bp(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 xp=new class extends fp{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 bp(t,e/2,i,s,n)}drawFitDir(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)}};function Sp(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Ap=new class extends fp{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Sp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Sp(t,e/2+n,i,s)}};class kp extends fp{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 Mp=new kp;var Tp=new class extends kp{constructor(){super(...arguments),this.type="triangle"}};const wp=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Cp=Math.sin(Bt/10)*wp,Ep=-Math.cos(Bt/10)*wp;function Pp(t,e,i,s){const n=Cp*e,r=Ep*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 Bp=new class extends fp{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 Pp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Pp(t,e/2+n,i,s)}};const Rp=zt(3);function Lp(t,e,i,s){const n=e,r=n/Rp,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 Op=new class extends fp{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 Lp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Lp(t,e/2+n,i,s)}};function Ip(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 Dp=new class extends fp{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Ip(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Ip(t,e/2+n,i,s)}};function Fp(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var jp=new class extends fp{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}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)}};const zp=-.5,Hp=zt(3)/2,Vp=1/zt(12);function Np(t,e,i,s){const n=e/2,r=e*Vp,a=n,o=e*Vp+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(zp*n-Hp*r+i,Hp*n+zp*r+s),t.lineTo(zp*a-Hp*o+i,Hp*a+zp*o+s),t.lineTo(zp*l-Hp*h+i,Hp*l+zp*h+s),t.lineTo(zp*n+Hp*r+i,zp*r-Hp*n+s),t.lineTo(zp*a+Hp*o+i,zp*o-Hp*a+s),t.lineTo(zp*l+Hp*h+i,zp*h-Hp*l+s),t.closePath(),!1}var Gp=new class extends fp{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 Np(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Np(t,e/2+n,i,s)}};var Wp=new class extends fp{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 Up=new class extends fp{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 Yp=new class extends fp{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 Kp=zt(3);function Xp(t,e,i,s){const n=e*Kp;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var $p=new class extends kp{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Xp(t,e/2/Kp,i,s)}drawOffset(t,e,i,s,n){return Xp(t,e/2/Kp+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 Zp=new class extends fp{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 Jp(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 Qp=new class extends fp{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 Jp(t,e/4,i,s)}drawOffset(t,e,i,s,n){return Jp(t,e/4+n,i,s)}};function tg(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 eg=new class extends fp{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 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-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var sg=new class extends fp{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 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,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var rg=new class extends fp{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return ng(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return ng(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 ag(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var og=new class extends fp{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return ag(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return ag(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 lg(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 hg=new class extends fp{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 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-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function cg(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function dg(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var ug=new class extends fp{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)?dg(t,e,i,s):cg(t,e,i,s)}drawOffset(t,e,i,s,n){return S(e)?dg(t,e+2*n,i,s):cg(t,[e[0]+2*n,e[1]+2*n],i,s)}};const pg=new Qt;class gg{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;pg.x1=s.bounds.x1*t,pg.y1=s.bounds.y1*t,pg.x2=s.bounds.x2*t,pg.y2=s.bounds.y2*t,e.union(pg)}))}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 mg={};[_p,yp,xp,Ap,$p,Tp,Bp,Op,Dp,jp,Gp,Wp,Up,Mp,Yp,Zp,Qp,eg,sg,ug,rg,og,hg].forEach((t=>{mg[t.type]=t}));const fg={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"},vg=new Qt,_g=["symbolType","size",...Rd];let yg=class t extends jd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=fu}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=Xh(this).symbol;let{symbolType:i=e.symbolType}=this.attribute,s=mg[i];if(s)return this._parsedPath=s,s;if(s=t.userSymbolMap[i],s)return this._parsedPath=s,s;if(i=fg[i]||i,!0===((n=i).startsWith("{const e=(new cl).fromString(t.d),i={};xu.forEach((e=>{t[e]&&(i[bu[e]]=t[e])})),r.push({path:e,attribute:i}),vg.union(e.bounds)}));const a=vg.width(),o=vg.height(),l=1/Dt(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new gg(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var n;const r=(new cl).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 gg(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=Xh(this).symbol;this._AABBBounds.clear();const i=this.attribute,s=Il.graphicService.updateSymbolAABBBounds(i,Xh(this).symbol,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=wc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xh(this).symbol[t]}needUpdateTags(t){return super.needUpdateTags(t,_g)}needUpdateTag(t){return super.needUpdateTag(t,_g)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new cl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new cl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function bg(t){return new yg(t)}yg.userSymbolMap={},yg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Fd);const xg=["segments","points","curveType",...Rd];let Sg=class t extends jd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=du}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=Rc(i,s,e))}doUpdateAABBBounds(){const t=Xh(this).line;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateLineAABBBounds(e,Xh(this).line,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xh(this).line[t]}needUpdateTags(t){return super.needUpdateTags(t,xg)}needUpdateTag(t){return super.needUpdateTag(t,xg)}toCustomPath(){const t=this.attribute,e=new cl,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 Ag(t){return new Sg(t)}Sg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Fd);const kg=["width","x1","y1","height","cornerRadius",...Rd];class Mg extends jd{constructor(t){super(t),this.type="rect",this.numberType=gu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}doUpdateAABBBounds(){const t=Xh(this).rect;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateRectAABBBounds(e,Xh(this).rect,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xh(this).rect[t]}needUpdateTags(t){return super.needUpdateTags(t,kg)}needUpdateTag(t){return super.needUpdateTag(t,kg)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:s,height:n}=id(t),r=new cl;return r.moveTo(e,i),r.rect(e,i,s,n),r}clone(){return new Mg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Mg.NOWORK_ANIMATE_ATTR}}function Tg(t){return new Mg(t)}Mg.NOWORK_ANIMATE_ATTR=Fd;class wg extends jd{constructor(t){super(t),this.type="glyph",this.numberType=lu,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=Il.graphicService.updateGlyphAABBBounds(this.attribute,Xh(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 wg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return wg.NOWORK_ANIMATE_ATTR}}function Cg(t){return new wg(t)}wg.NOWORK_ANIMATE_ATTR=Fd;class Eg{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=Dl[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 Pg{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const s=Fc(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}=Wl(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}=Wl(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=Nl(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}=Wl(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||jl;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||Fl;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=Nl(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Wl(this.text.slice(t),this.character);return i+this.ellipsisWidth-s}return i}}const Bg=["width","height","image",...Rd];class Rg extends jd{constructor(t){super(t),this.type="image",this.numberType=cu,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=Xh(this).image;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateImageAABBBounds(e,Xh(this).image,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Ll[t]}needUpdateTags(t){return super.needUpdateTags(t,Bg)}needUpdateTag(t){return super.needUpdateTag(t,Bg)}clone(){return new Rg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Rg.NOWORK_ANIMATE_ATTR}}function Lg(t){return new Rg(t)}Rg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Fd);class Og extends Rg{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=wc(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=wc(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=Ll.width,height:e=Ll.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 Ig{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 Og?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=Dl[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Pg){const e=Vl.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 Og)break;if("vertical"===this.direction&&"vertical"!==s.direction){s.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";s.ellipsisStr=r;const{width:a}=Wl(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 Og)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 Og)break;const{width:n}=Wl(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 Og?t.width:t.getWidthWithEllips(this.direction)})),i}}class Dg{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=Dl[this.direction]}store(t){if(t instanceof Og){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 Ig(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 Og?"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=Nl(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 Pg(i,t.newLine,t.character),new Pg(s,!0,t.character)]}(t,s);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const Fg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...Rd];class jg extends jd{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=mu}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Rl.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:Rl.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:Rl.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:Rl.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:Rl.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:Rl.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:Rl.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:Rl.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=Xh(this).richtext;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateRichTextAABBBounds(e,Xh(this).richtext,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Rl[t]}needUpdateTags(t){return super.needUpdateTags(t,Fg)}needUpdateTag(t){return super.needUpdateTag(t,Fg)}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(){var t;const{textConfig:e=[],maxWidth:i,maxHeight:s,width:n,height:r,ellipsis:a,wordBreak:o,verticalDirection:l,textAlign:h,textBaseline:c,layoutDirection:d,singleLine:u,disableAutoWrapLine:p}=this.attribute,g=[];for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,g.push(t)}}else{const i=this.combinedStyleToCharacter(e[t]);if(S(i.text)&&(i.text=`${i.text}`),i.text&&i.text.includes("\n")){const t=i.text.split("\n");for(let e=0;e0,f="number"==typeof s&&Number.isFinite(s)&&s>0,v="number"==typeof n&&Number.isFinite(n)&&n>0&&(!m||n<=i),_="number"==typeof r&&Number.isFinite(r)&&r>0&&(!f||r<=s),y=new Eg(0,0,(v?n:m?i:0)||0,(_?r:f?s:0)||0,a,o,l,h,c,d||"horizontal",!v&&m,!_&&f,u||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),b=new Dg(y);if(p){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 jg.NOWORK_ANIMATE_ATTR}}function zg(t){return new jg(t)}jg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Fd);const Hg=["path","customPath",...Rd];class Vg extends jd{constructor(t){super(t),this.type="path",this.numberType=uu}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=Xh(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof cl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof cl?this.cache:t.path)}doUpdateAABBBounds(){const t=Xh(this).path;this.doUpdatePathShape(),this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updatePathAABBBounds(e,Xh(this).path,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new cl).fromString(t.path):t.customPath&&(this.cache=new cl,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xh(this).path[t]}needUpdateTags(t){return super.needUpdateTags(t,Hg)}needUpdateTag(t){return super.needUpdateTag(t,Hg)}toCustomPath(){return(new cl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Vg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Vg.NOWORK_ANIMATE_ATTR}}function Ng(t){return new Vg(t)}Vg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Fd);const Gg=["segments","points","curveType",...Rd];class Wg extends jd{constructor(t){super(t),this.type="area",this.numberType=au}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=Xh(this).area;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateAreaAABBBounds(e,Xh(this).area,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Rc(i,s,e))}getDefaultAttribute(t){return Xh(this).area[t]}needUpdateTags(t){return super.needUpdateTags(t,Gg)}needUpdateTag(t){return super.needUpdateTag(t,Gg)}toCustomPath(){const t=new cl,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 Wg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Wg.NOWORK_ANIMATE_ATTR}}function Ug(t){return new Wg(t)}Wg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Fd);const Yg=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Rd];class Kg extends jd{constructor(t){super(t),this.type="arc",this.numberType=nu}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=Xh(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);return Math.min(S(e,!0)?e:a*parseFloat(e)/100,a/2)}getParsedAngle(){const t=Xh(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=Xh(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=Nt(Number(l)/o*jt(g)),n=Nt(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=Xh(this).arc;this._AABBBounds.clear();const i=this.attribute,s=Il.graphicService.updateArcAABBBounds(i,Xh(this).arc,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=wc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return super.needUpdateTags(t,Yg)}needUpdateTag(t){return super.needUpdateTag(t,Yg)}getDefaultAttribute(t){return Xh(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 Kg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Kg.NOWORK_ANIMATE_ATTR}}function Xg(t){return new Kg(t)}Kg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Fd);const $g=["points","cornerRadius",...Rd];class qg extends jd{constructor(t){super(t),this.type="polygon",this.numberType=pu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=Xh(this).polygon;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updatePolygonAABBBounds(e,Xh(this).polygon,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Rc(i,s,e))}getDefaultAttribute(t){return Xh(this).polygon[t]}needUpdateTags(t){return super.needUpdateTags(t,$g)}needUpdateTag(t){return super.needUpdateTag(t,$g)}toCustomPath(){const t=this.attribute.points,e=new cl;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 Zg(t){return new qg(t)}qg.NOWORK_ANIMATE_ATTR=Fd;class Jg extends Au{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 Qg(t){return new Jg(t)}class tm{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 em extends tm{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 im{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 im.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},am=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},om=function(t,e){return function(i,s){e(i,s,t)}};function lm(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 hm(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 cm(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 dm(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),lm(t,t,[n+o,r+l,a+h]),lm(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),lm(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=nm.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]}lm(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),lm(i,i,[-s[0],-s[1],0]),cm(t,t,i)}}let um=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 tm],this._symbolBoundsContribitions=[new em],this._imageBoundsContribitions=[new tm],this._circleBoundsContribitions=[new tm],this._arcBoundsContribitions=[new tm],this._pathBoundsContribitions=[new tm]}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,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}=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 h=this.tempAABBBounds1,c=this.tempAABBBounds2;return h.setValue(i.x1,i.y1,i.x2,i.y2),c.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=dp(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=cp(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),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}=t,r=i;return n.forEach((t=>{r.add(t.x,t.y)})),r}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{r.add(t.x,t.y)}))})),r}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):Pc(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):(Pc(h,l,n,i),Pc(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&&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)}};um=rm([Oa(),om(0,Ra(yu)),am("design:paramtypes",[Object])],um);const pm=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 gm,mm;function fm(t){return gm||(gm=pm.CreateGraphic("text",{})),gm.initAttributes(t),gm.AABBBounds}const vm={x:0,y:0,z:0,lastModelMatrix:null};class _m{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=zu(o,l,n),p=Vu(o,c),g=Fu(n,r),m=ju(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;vm.x=n,vm.y=r,vm.z=a,vm.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=nm.allocate(),n=nm.allocate();dm(n,t,e),cm(s,d||s,n),vm.x=0,vm.y=0,vm.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),nm.free(n)}if(g&&!d){const s=t.getOffsetXY(e);vm.x+=s.x,vm.y+=s.y,vm.z=a,i.setTransformForCurrent()}else if(p)vm.x=0,vm.y=0,vm.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);vm.x+=s.x,vm.y+=s.y,this.transformWithoutTranslate(i,vm.x,vm.y,vm.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),vm.x=0,vm.y=0,vm.z=0;return vm}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=Xh(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,_=zu(d,u,h),y=Vu(d,g),b=Fu(h),x=ju(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&&nm.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}const ym=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 bm{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(bm.IsGradientStr(t))try{const e=ym(t)[0];if(e){if("linear"===e.type)return bm.ParseLinear(e);if("radial"===e.type)return bm.ParseRadial(e);if("conic"===e.type)return bm.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 xm(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 Sm(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 Am=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},km=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mm=function(t,e){return function(i,s){e(i,s,t)}};class Tm{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=Xh(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=Eh.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),Eh.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 wm=new Tm;let Cm=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)}))}};Cm=Am([Oa(),Mm(0,Ra(qa)),Mm(0,Ia(rp)),km("design:paramtypes",[Object])],Cm);class Em{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=Eh.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])),Eh.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 Pm=new Em;const Bm=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=xm(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T+r,innerRadius:M-r,startAngle:_-a,endAngle:y+a}),e.beginPath(),Uu(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=xm(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T-r,innerRadius:M+r,startAngle:_+a,endAngle:y-a}),e.beginPath(),Uu(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})}},Rm=Pm,Lm=wm;const Om=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=xm(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=xm(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()}}}},Im=Pm,Dm=wm;const Fm=new class extends Tm{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()}},jm=Et/2;function zm(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],-jm,0,!1)}if(t.lineTo(_[0],_[1]),!q(v,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,jm,!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],jm,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+jm,!1)}return t.closePath(),t}var Hm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Vm{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=xm(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(),zm(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=xm(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(),zm(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 Nm=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)}};Nm=Hm([Oa()],Nm);let Gm=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()}}};Gm=Hm([Oa()],Gm);const Wm=new Vm,Um=Pm,Ym=wm;const Km=new class extends Vm{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)}},Xm=new class extends Tm{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=Xh(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=wc(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?zm(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 $m=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=xm(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=xm(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=Pm,Zm=wm;var Jm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},tf=function(t,e){return function(i,s){e(i,s,t)}};let ef=class extends _m{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=nu,this.builtinContributions=[Bm,Lm,Rm],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||T>Ct)&&(O=n*It(y),I=n*jt(y),D=r*It(x),F=r*jt(x),uCt){const t=Ft(S,C),r=Ft(A,C),a=Wu(D,F,P,B,n,t,Number(p)),o=Wu(O,I,R,L,n,r,Number(p));if(C0&&e.arc(i+o.cx,s+o.cy,r,Ot(o.y11,o.x11),Ot(o.y01,o.x01),!p)}}else e.moveTo(i+P,s+B);if(!(r>Ct)||v<.001)e.lineTo(i+R,s+L),g=!0;else if(E>Ct){const t=Ft(M,E),n=Ft(k,E),a=Wu(R,L,O,I,r,-n,Number(p)),o=Wu(P,B,D,F,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),E0&&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(x),s+r*jt(x));return g}drawShape(t,e,i,s,n,r,a,o){const l=Xh(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++)Mc[s]=t,i&&(i=!(null!==(e=Mc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Mc[e]=!!t[e],i&&(i=!!Mc[e]);else Mc[0]=!1,Mc[1]=!1,Mc[2]=!1,Mc[3]=!1;return{isFullStroke:i,stroke:Mc}})(d);if((v||C)&&(e.beginPath(),Uu(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(),Uu(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),dd(o.color,l.color,h,!1)}(0,0,h,n);a||zu&&(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=Xh(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}};ef=Jm([Oa(),tf(0,Ra(qa)),tf(0,Ia($u)),Qm("design:paramtypes",[Object])],ef);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 _m{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=ou,this.builtinContributions=[Om,Dm,Im],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Xh(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=Xh(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function of(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 lf(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),of(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 cf=class extends _m{constructor(){super(...arguments),this.numberType=du}draw(t,e,i,s){const n=Xh(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;lf(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(),lf(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"===f)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=hl(t.points,f,{startPoint:e});return s=n,n})).filter((t=>!!t)),"linearClosed"===f){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===v){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],v,_,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=v*r;let g=0,m=!1;t.cache.forEach(((r,f)=>{if(m)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(m=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[f],[l,t.attribute],Ft(y,1),_,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,v,_,i,s,t,a,o)}};function df(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 uf(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),of(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),of(t,l,1,s),o=!1):o=!0}t.closePath()}cf=hf([Oa()],cf);const pf=new class extends Em{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:Oc(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Oc(l,"textureColor")),textureSize:b=(null!==(m=t.attribute.textureSize)&&void 0!==m?m:Oc(l,"textureSize")),texturePadding:x=(null!==(f=t.attribute.texturePadding)&&void 0!==f?f:Oc(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},gf=wm;var mf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ff=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)}};function _f(t,e,i){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"linearClosed":return ll(t,i)}}let yf=class extends _m{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=au,this.builtinContributions=[pf,gf],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=Xh(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}=t.attribute,b=this.valid(t,g,a,o);if(!b)return;const{doFill:x,doStroke:S}=b,{clipRange:A=g.clipRange,closePath:k,points:M,segments:T}=t.attribute;let{curveType:w=g.curveType}=t.attribute;if(k&&"linear"===w&&(w="linearClosed"),1===A&&!T&&!M.some((t=>!1===t.defined))&&"linear"===w)return this.drawLinearAreaHighPerformance(t,e,!!m,S,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(T&&T.length){let e,i;const s=T.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=_f(t.points,w,{startPoint:e});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=T.length-1;t>=0;t--){const e=T[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=T[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=_f(i,"stepBefore"===w?"stepAfter":"stepAfter"===w?"stepBefore":w),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!M||!M.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=M,i=[];for(let t=M.length-1;t>=0;t--)i.push({x:null!==(u=M[t].x1)&&void 0!==u?u:M[t].x,y:null!==(p=M[t].y1)&&void 0!==p?p:M[t].y});const s=_f(e,w),n=_f(i,"stepBefore"===w?"stepAfter":"stepAfter"===w?"stepBefore":w);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===A){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,x,v,S,y,r[c],[g,t.attribute],A,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=A*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,x,v,S,y,r[u],[g,t.attribute],Ft(m,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,x,v,S,y,t.attribute,g,A,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Xh(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=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),df(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),df(t,e,i,s),e.length=0,i.length=0)}n=o})),df(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},Af=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kf=function(t,e){return function(i,s){e(i,s,t)}};let Mf=class extends _m{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=uu,this.builtinContributions=[xf,bf],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:Xh(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=Xh(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Mf=Sf([Oa(),kf(0,Ra(qa)),kf(0,Ia(tp)),Af("design:paramtypes",[Object])],Mf);var Tf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 _m{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=gu,this.builtinContributions=[Wm,Ym,Um],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Xh(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=Hu(g,m,k,M,c),w=Nu(g,v,k,M),C=Fu(c,d),E=ju(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(),zm(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=Xh(t,null==s?void 0:s.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Ef=Tf([Oa(),Cf(0,Ra(qa)),Cf(0,Ia(ip)),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 _m{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=fu,this.builtinContributions=[$m,Zm,qm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=Xh(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=Xh(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Lf=Pf([Oa(),Rf(0,Ra(qa)),Rf(0,Ia(sp)),Bf("design:paramtypes",[Object])],Lf);const Of=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 If=new class extends Tm{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=Of.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=fm(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?(zm(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&&Of.free(C),w()}};var Df=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ff=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jf=function(t,e){return function(i,s){e(i,s,t)}};let zf=class extends _m{constructor(t){super(),this.textRenderContribitions=t,this.numberType=vu,this.builtinContributions=[If],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Xh(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=Fc(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=sm.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),sm.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=Xh(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=cp(l,f),_=dp(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=dp("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 Hf(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},Yf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kf=function(t,e){return function(i,s){e(i,s,t)}};let Xf=class extends _m{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=pu,this.builtinContributions=[Wf,Gf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Xh(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))?Hf(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 Hf(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=Vf(d,u),b=Vf(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*f);const S=Nf(h,_,y,d,u),A=Nf(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Vf(k,M),w=Nf(h,Vf(_,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=Xh(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Xf=Uf([Oa(),Kf(0,Ra(qa)),Kf(0,Ia(ep)),Yf("design:paramtypes",[Object])],Xf);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},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)}};const Jf=["","repeat-x","repeat-y","repeat"];let Qf=class extends _m{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=cu,this.builtinContributions=[Km,Xm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Xh(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(),zm(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,Jf[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 Cd.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Xh(t).image;this._draw(t,a,!1,i)}};Qf=$f([Oa(),Zf(0,Ra(qa)),Zf(0,Ia(Qu)),qf("design:paramtypes",[Object])],Qf);const tv=Symbol.for("IncrementalDrawContribution"),ev=Symbol.for("ArcRender"),iv=Symbol.for("AreaRender"),sv=Symbol.for("CircleRender"),nv=Symbol.for("GraphicRender"),rv=Symbol.for("GroupRender"),av=Symbol.for("LineRender"),ov=Symbol.for("PathRender"),lv=Symbol.for("PolygonRender"),hv=Symbol.for("RectRender"),cv=Symbol.for("SymbolRender"),dv=Symbol.for("TextRender"),uv=Symbol.for("RichTextRender"),pv=Symbol.for("GlyphRender"),gv=Symbol.for("ImageRender"),mv=Symbol.for("DrawContribution");var fv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)};const _v=Symbol.for("DrawItemInterceptor"),yv=new Qt,bv=new Qt;class xv{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return t.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){yv.copy(s.dirtyBounds),bv.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(yv),s.backupDirtyBounds.copy(bv)),!0}}class Sv{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 Av=class{constructor(){this.order=1,this.interceptors=[new xv,new Mv,new kv,new Sv]}afterDrawItem(t,e,i,s,n){for(let r=0;r(e=t.numberType===ru,!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&&nm.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Tv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},Cv=function(t,e){return function(i,s){e(i,s,t)}};const Ev=Symbol.for("RenderService");let Pv=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}};Pv=Tv([Oa(),Cv(0,Ra(mv)),wv("design:paramtypes",[Object])],Pv);var Bv=new xa((t=>{t(Ev).to(Pv)}));const Rv=Symbol.for("PickerService"),Lv=Symbol.for("GlobalPickerService");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};const Iv=Symbol.for("PickItemInterceptor");let Dv=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){if(!t.shadowRoot)return null;const{parentMatrix:r}=n||{};if(!r)return null;const a=e.pickContext;a.highPerformanceSave();const o=t.shadowRoot,l=sm.allocateByObj(r),h=new $t(l.a*i.x+l.c*i.y+l.e,l.b*i.x+l.d*i.y+l.f),c=e.pickGroup(o,h,l,s);return a.highPerformanceRestore(),c}};Dv=Ov([Oa()],Dv);let Fv=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}};Fv=Ov([Oa()],Fv);let jv=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===ru,!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()}};jv=Ov([Oa()],jv);var zv=new xa(((t,e,i)=>{i(Rv)||(t(Lv).toSelf(),t(Rv).toService(Lv)),t(jv).toSelf().inSingletonScope(),t(Iv).toService(jv),t(Dv).toSelf().inSingletonScope(),t(Iv).toService(Dv),t(Fv).toSelf().inSingletonScope(),t(Iv).toService(Fv),Ja(t,Iv)})),Hv=new xa((t=>{t(_u).to(um).inSingletonScope(),t(yu).toConstantValue(pm)}));const Vv=Symbol.for("AutoEnablePlugins"),Nv=Symbol.for("PluginService");var Gv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},Uv=function(t,e){return function(i,s){e(i,s,t)}};let Yv=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(Vv)&&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=[]}};Yv=Gv([Oa(),Uv(0,Ra(qa)),Uv(0,Ia(Vv)),Wv("design:paramtypes",[Object])],Yv);var Kv=new xa((t=>{t(Nv).to(Yv),function(t,e){t(qa).toDynamicValue((t=>{let{container:i}=t;return new Za(e,i)})).whenTargetNamed(e)}(t,Vv)})),Xv=new xa((t=>{Ja(t,eo)})),$v=new xa((t=>{t(Xl).to($l).inSingletonScope(),Ja(t,Xl)})),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)};let Jv=class{constructor(){this.type="static",this.offscreen=!1,this.global=Il.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=Ql({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()}};Jv=qv([Oa(),Zv("design:paramtypes",[])],Jv);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},t_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let e_=class{constructor(){this.offscreen=!1,this.type="virtual",this.global=Il.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(){}};e_=Qv([Oa(),t_("design:paramtypes",[])],e_);var i_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},s_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let n_=class{constructor(){this.offscreen=!0,this.type="dynamic",this.global=Il.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;const s=Ql({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){}};n_=i_([Oa(),s_("design:paramtypes",[])],n_);var r_=new xa((t=>{t(Jv).toSelf(),t(n_).toSelf(),t(e_).toSelf(),t(Eu).toService(Jv),t(Pu).toService(n_),t(Bu).toService(e_)}));var a_=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 o_(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 a_(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,s)}))}function h_(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 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)},u_=function(t,e){return function(i,s){e(i,s,t)}};let p_=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=Il.global,this.layerService=Il.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:bl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:bl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,sm.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=h_(e,i,bl.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=Of.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=sm.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))})):o_(t,bl.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),Of.free(n),sm.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(tv);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},m_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},f_=function(t,e){return function(i,s){e(i,s,t)}};let v_=class{constructor(t){this.groupRenderContribitions=t,this.numberType=hu}drawShape(t,e,i,s,n,r,a,o){const l=Xh(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=Hu(u,f,p,g,h),k=Nu(u,v,p,g),M=Fu(h,c),T=ju(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(),zm(e,i,s,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Fm));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=Xh(t,null==s?void 0:s.theme).group,l=n.modelMatrix;if(n.camera){const e=nm.allocate(),i=nm.allocate();dm(i,t,o),cm(e,l||e,i),n.modelMatrix=e,nm.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&&nm.free(n.modelMatrix),n.modelMatrix=l,n.baseGlobalAlpha/=a,d&&d.then?d.then((()=>{r?n.restore():n.highPerformanceRestore()})):r?n.restore():n.highPerformanceRestore()}};v_=g_([Oa(),f_(0,Ra(qa)),f_(0,Ia(Ju)),m_("design:paramtypes",[Object])],v_);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};let y_=class extends cf{constructor(){super(...arguments),this.numberType=du}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=Xh(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=zu(u,p,c),_=Vu(u,g),y=Fu(c),b=ju(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())}};y_=__([Oa()],y_);var b_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 x_=class extends yf{constructor(){super(...arguments),this.numberType=au}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=Xh(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=zu(u,d,c),m=Fu(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())}};x_=b_([Oa()],x_);var S_,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},k_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},M_=function(t,e){return function(i,s){e(i,s,t)}},T_=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"}(S_||(S_={}));let w_=class extends p_{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=S_.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 T_(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:bl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:bl.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 T_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return T_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>T_(this,void 0,void 0,(function*(){if(2!==t.count)yield l_(t,bl.zIndex,((i,s)=>{if(this.status===S_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return T_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return T_(this,void 0,void 0,(function*(){this.rendering&&(this.status=S_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=S_.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 T_(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:()=>T_(this,void 0,void 0,(function*(){yield l_(t,bl.zIndex,(t=>T_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};w_=A_([Oa(),M_(0,La(nv)),M_(1,Ra(y_)),M_(2,Ra(x_)),M_(3,Ra(qa)),M_(3,Ia(_v)),k_("design:paramtypes",[Array,Object,Object,Object])],w_);var C_=new xa((t=>{t(Tm).toSelf().inSingletonScope(),t(Em).toSelf().inSingletonScope(),t(mv).to(p_),t(tv).to(w_),t(rv).to(v_).inSingletonScope(),t(nv).toService(rv),Ja(t,Ju),t(Cm).toSelf().inSingletonScope(),Ja(t,rp),Ja(t,nv),t(Av).toSelf().inSingletonScope(),t(_v).toService(Av),Ja(t,_v)}));function E_(){E_.__loaded||(E_.__loaded=!0,ql.load(Du),ql.load(Hv),ql.load(Bv),ql.load(zv),ql.load(Kv),function(t){t.load(Xv),t.load($v),t.load(r_)}(ql),function(t){t.load(C_)}(ql))}E_.__loaded=!1,E_();const P_=ql.get(io);Il.global=P_;const B_=ql.get(wu);Il.graphicUtil=B_;const R_=ql.get(Tu);Il.transformUtil=R_;const L_=ql.get(_u);Il.graphicService=L_;const O_=ql.get(Cu);Il.layerService=O_;class I_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Il.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),Il.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){Il.graphicService.hooks.onAttributeUpdate.taps=Il.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onSetStage.taps=Il.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class D_{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 F_{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,Il.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))})),Il.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){Il.graphicService.hooks.onAddIncremental.taps=Il.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onClearIncremental.taps=Il.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Il.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 j_{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)),Il.graphicService.hooks.onRemove.unTap(this.key),Il.graphicService.hooks.onRelease.unTap(this.key),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?Il.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:Il.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return function(t){const e={};return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[ni(i)]=t[i])})),["fontSize","lineHeight"].forEach((i=>{const s=ni(i);u(t[i])||(e[s]=/^[0-9]*$/.test(`${t[i]}`)?`${t[i]}px`:`${t[i]}`)})),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:Xh(t).text)}getTransformOfText(t){const e=Xh(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=Il.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),f=o+m.left-p.left,v=l+m.top-p.top;if(a.left=`${f}px`,a.top=`${v}px`,"text"===t.type&&"position"===c&&(a=Object.assign(Object.assign({},a),this.getTransformOfText(t))),d(n.style)){const e=n.style({top:v,left:f,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)));Il.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"===Il.global.env&&(t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:bl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:bl.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&&Il.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"===Il.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 z_=new Qt;class H_{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()})),Il.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&&(z_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(z_,t.parent&&t.parent.globalTransMatrix)))})),Il.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))})),Il.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){Il.graphicService.hooks.beforeUpdateAABBBounds.taps=Il.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.afterUpdateAABBBounds.taps=Il.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)),Il.graphicService.hooks.onRemove.taps=Il.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const V_=new Qt;class N_{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=Xh(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,Il.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),Il.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&V_.copy(s)})),Il.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(V_.equals(i)||this.tryLayout(t,!1))})),Il.graphicService.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1)}))}deactivate(t){Il.graphicService.hooks.onAttributeUpdate.taps=Il.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.beforeUpdateAABBBounds.taps=Il.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.afterUpdateAABBBounds.taps=Il.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onSetStage.taps=Il.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const G_=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===dc.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=dc.INITIAL,Il.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),Il.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:cc},{mode:"timeout",cons:hc},{mode:"manual",cons:lc}];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!==dc.INITIAL&&(this.status=dc.PAUSE,!0)}resume(){return this.status!==dc.INITIAL&&(this.status=dc.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===dc.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===dc.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=dc.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=dc.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};G_.addTimeline(gc),G_.setFPS(60);class W_{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=hd.Get(e,ld.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)?hd.Get(e,ld.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}function U_(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 Y_(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 K_{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=nm.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=nm.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()})),i&&Il.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))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])this.htmlMap[o].root.render(r);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t){const i=n.createRoot(t);i.render(r),this.htmlMap||(this.htmlMap={}),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}}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 Z_="white";class J_ extends Au{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:Z_}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 Yh,this.hooks={beforeRender:new to(["stage"]),afterRender:new to(["stage"])},this.global=Il.global,!this.global.env&&$_()&&this.global.setEnv("browser"),this.window=ql.get(Rh),this.renderService=ql.get(Ev),this.pluginService=ql.get(Nv),this.layerService=ql.get(Cu),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:Z_,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||G_,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new pc,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 oc(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 W_(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 K_(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 D_))}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 I_))}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 F_))}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 H_,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 N_))}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 j_))}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){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(){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){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(){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];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];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){this.pickerService||(this.pickerService=ql.get(Rv));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){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){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;const e=ql.get(Rh),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;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 Q_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ty=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ey=new oe(1,0,0,1,0,0),iy={x:0,y:0};let sy=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 cl,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 sm.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(sm.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(sm.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},iy),function(t,e,i){return Ch(t,0,!1,e,i)}(this.path.commandList,iy.x,iy.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},iy);const i=xm(this,this.lineWidth,this.dpr);return function(t,e,i,s){return Ch(t,e,!0,i,s)}(this.path.commandList,i,iy.x,iy.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(ey,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=>sm.free(t))),this.stack.length=0}};sy=Q_([Oa(),ty("design:paramtypes",[Object,Number])],sy);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},ry=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ay={WIDTH:500,HEIGHT:500,DPR:1};let oy=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=ay.WIDTH,height:n=ay.HEIGHT,dpr:r=ay.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)}};oy.env="browser",oy=ny([Oa(),ry("design:paramtypes",[Object])],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};let hy=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}}};hy=ly([Oa()],hy);var cy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let uy=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}};uy=cy([Oa(),dy("design:paramtypes",[])],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)},my=function(t,e){return function(i,s){e(i,s,t)}};let fy=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=Il.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=nm.allocate();if(hm(i,e),a){if(i){const t=nm.allocate();r.modelMatrix=cm(t,a,i),nm.free(i)}}else hm(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=Xh(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=Xh(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&&nm.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),sm.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function vy(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&&vy(t,e,a,s,n),n.push(t[a],t[a+1]),i-a>2&&vy(t,a,i,s,n))}function _y(t,e){const i=t.length-1,s=[t[0]];return vy(t,0,i,e,s),s.push(t[i]),s}fy=py([Oa(),my(0,Ra(qa)),my(0,Ia(Iv)),gy("design:paramtypes",[Object])],fy);let yy=!1;const by=new xa((t=>{yy||(yy=!0,t(ef).toSelf().inSingletonScope(),t(ev).to(ef).inSingletonScope(),t(nv).toService(ev),t($u).toService(Cm),Ja(t,$u))}));let xy=!1;const Sy=new xa((t=>{xy||(xy=!0,t(Ef).toSelf().inSingletonScope(),t(hv).to(Ef).inSingletonScope(),t(nv).toService(hv),t(Gm).toSelf(),t(Nm).toSelf(),t(ip).toService(Gm),t(ip).toService(Nm),t(ip).toService(Cm),Ja(t,ip))}));let Ay=!1;const ky=new xa((t=>{Ay||(Ay=!0,t(cf).toSelf().inSingletonScope(),t(y_).toSelf().inSingletonScope(),t(av).to(cf).inSingletonScope(),t(nv).toService(av))}));let My=!1;const Ty=new xa((t=>{My||(My=!0,t(yf).toSelf().inSingletonScope(),t(iv).to(yf).inSingletonScope(),t(nv).toService(iv),t(qu).toService(Cm),Ja(t,qu),t(x_).toSelf().inSingletonScope())}));let wy=!1;const Cy=new xa((t=>{wy||(wy=!0,t(Lf).toSelf().inSingletonScope(),t(cv).to(Lf).inSingletonScope(),t(nv).toService(cv),t(sp).toService(Cm),Ja(t,sp))}));let Ey=!1;const Py=new xa((t=>{Ey||(Ey=!0,t(af).toSelf().inSingletonScope(),t(sv).to(af).inSingletonScope(),t(nv).toService(sv),t(Zu).toService(Cm),Ja(t,Zu))}));let By=!1;const Ry=new xa((t=>{By||(By=!0,t(dv).to(zf).inSingletonScope(),t(nv).toService(dv),t(np).toService(Cm),Ja(t,np))}));let Ly=!1;const Oy=new xa((t=>{Ly||(Ly=!0,t(Mf).toSelf().inSingletonScope(),t(ov).to(Mf).inSingletonScope(),t(nv).toService(ov),t(tp).toService(Cm),Ja(t,tp))}));let Iy=!1;const Dy=new xa((t=>{Iy||(Iy=!0,t(lv).to(Xf).inSingletonScope(),t(nv).toService(lv),t(ep).toService(Cm),Ja(t,ep))}));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};let jy=class{constructor(){this.numberType=lu}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=Xh(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};jy=Fy([Oa()],jy);let zy=!1;const Hy=new xa((t=>{zy||(zy=!0,t(pv).to(jy).inSingletonScope(),t(nv).toService(pv))}));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},Ny=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Gy=class extends _m{constructor(){super(),this.numberType=mu,this.builtinContributions=[If],this.init()}drawShape(t,e,i,s,n){const r=Xh(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=zu(o,l,!0),d=zu(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=Xh(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(),zm(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=Xh(t).richtext;this._draw(t,s,!1,i)}};Gy=Vy([Oa(),Ny("design:paramtypes",[])],Gy);let Wy=!1;const Uy=new xa((t=>{Wy||(Wy=!0,t(uv).to(Gy).inSingletonScope(),t(nv).toService(uv))}));let Yy=!1;const Ky=new xa((t=>{Yy||(Yy=!0,t(gv).to(Qf).inSingletonScope(),t(nv).toService(gv),t(Qu).toService(Cm),Ja(t,Qu))}));const Xy=(t,e)=>(d(qy.warnHandler)&&qy.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),$y=(t,e,i)=>{if(!d(qy.errorHandler))throw new Error(t);qy.errorHandler.call(null,t,e)},qy={silent:!1,warnHandler:!1,errorHandler:!1},Zy=$_(),Jy=Zy&&globalThis?globalThis.document:void 0;function Qy(t){return("desktop-browser"===t||"mobile-browser"===t)&&Zy}function tb(t){return eb(t)||"mobile-browser"===t}function eb(t){return t.includes("miniApp")||"lynx"===t||"wx"===t}let ib=0;function sb(){return ib>=9999999&&(ib=0),ib++}function nb(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function rb(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const ab=(t,e,i)=>(t.fields=e||[],t.fname=i,t),ob=t=>e=>R(e,t),lb=t=>{at.getInstance().error(t)},hb=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||lb("Access path missing open bracket: "+t),o>0&&h(),o=0,s=n+1):n>s?h():s=n+1}return o&&lb("Access path missing closing bracket: "+t),a&&lb("Access path missing closing quote: "+t),n>s&&(n+=1,h()),e})(t),n=1===s.length?s[0]:t;return ab((i&&i.get||ob)(s),[n],e||n)},cb=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(y(t)){const s=t.map((t=>hb(t,e,i)));return t=>s.map((e=>e(t)))}return hb(t,e,i)};cb("id");const db=ab((function(t){return t}),[],"identity"),ub=ab((function(){return 0}),[],"zero");ab((function(){return 1}),[],"one"),ab((function(){return!0}),[],"true"),ab((function(){return!1}),[],"false"),ab((function(){return{}}),[],"emptyObject");const pb=(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=>gb(t,r,n)))))},mb=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t;function fb(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 vb(t,e,i,s,n){let r=0,a=0;return fb(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function _b(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;fb(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:vb(t,e,i,n,h)}}function yb(t){return"horizontal"===t}function bb(t){return"vertical"===t}const xb=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Sb extends Au{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,xb.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=>xb.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"},Zb=(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 Jb 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=ic.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=ic.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=Zb(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=ic.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=Zb(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=ic.now()-i>this.config.press.time&&Zb(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},tx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ex=[0,0,0];let ix=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({},gl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},fl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},vl),{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 sm.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&&(sm.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(sm.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&&Xu.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&&(Y_(ex,[t,e,i],this.modelMatrix),t=ex[0],e=ex[1],i=ex[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&&(Y_(ex,[t,e,i],this.modelMatrix),t=ex[0],e=ex[1],i=ex[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Y_(ex,[e,i,s],this.modelMatrix),e=ex[0],i=ex[1],s=ex[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]:Il.global.measureTextMethod;var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Il.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:vl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:vl.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&&(Y_(ex,[e,i,s],this.modelMatrix),e=ex[0],i=ex[1],s=ex[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=Sm(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=xm(this,l,this.dpr),r.strokeStyle=Sm(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=hp(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=hp(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=>sm.free(t))),this.stack.length=0}};ix.env="browser",ix=Qb([Oa(),tx("design:paramtypes",[Object,Number])],ix);var 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},nx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let rx=class extends oy{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Il.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new ix(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 ax(t,e){return new xa((i=>{i(Zl).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Jl).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}rx.env="browser",rx=sx([Oa(),nx("design:paramtypes",[Object])],rx);const ox=ax(rx,ix);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},hx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cx=function(t,e){return function(i,s){e(i,s,t)}};let dx=class extends fy{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=Eh.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 px=class{constructor(){this.type="group",this.numberType=hu}contains(t,e,i){return!1}};px=ux([Oa()],px);const gx=new xa(((t,e,i,s)=>{gx.__vloaded||(gx.__vloaded=!0,t(Kb).to(px).inSingletonScope(),t(Xb).toService(Kb),Ja(t,Xb))}));gx.__vloaded=!1;var mx=gx;const fx=new xa(((t,e,i,s)=>{i(dx)||t(dx).toSelf().inSingletonScope(),i(Rv)?s(Rv).toService(dx):t(Rv).toService(dx)}));var vx,_x=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let bx=vx=class extends uy{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${vx.idprefix}_${vx.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Il.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:vx.GenerateCanvasId(),canvasControled:!0};this.canvas=new rx(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 rx({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)}};bx.env="browser",bx.idprefix="visactor_window",bx.prefix_count=0,bx=vx=_x([Oa(),yx("design:paramtypes",[])],bx);const xx=new xa((t=>{t(bx).toSelf(),t(Lh).toDynamicValue((t=>t.container.get(bx))).whenTargetNamed(bx.env)}));var 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)};class kx{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 Mx(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 Tx=class extends hy{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 kx(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 Mx(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Mx(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}}};Tx=Sx([Oa(),Ax("design:paramtypes",[])],Tx);const wx=new xa((t=>{wx.isBrowserBound||(wx.isBrowserBound=!0,t(Tx).toSelf().inSingletonScope(),t(eo).toService(Tx))}));function Cx(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Cx.__loaded||(Cx.__loaded=!0,t.load(wx),t.load(ox),t.load(xx),e&&function(t){t.load(mx),t.load(fx)}(t))}wx.isBrowserBound=!1,Cx.__loaded=!1;var Ex=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Px=class extends ix{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}};Px.env="feishu",Px=Ex([Oa()],Px);var Bx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Rx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Lx=class extends oy{constructor(t){super(t)}init(){this._context=new Px(this,this._dpr)}release(){}};Lx.env="feishu",Lx=Bx([Oa(),Rx("design:paramtypes",[Object])],Lx);const Ox=ax(Lx,Px);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)},Fx=function(t,e){return function(i,s){e(i,s,t)}};class jx{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 zx=class extends uy{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new jx}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 Lx(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 Lx({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()}};zx.env="feishu",zx=Ix([Oa(),Fx(0,Ra(io)),Dx("design:paramtypes",[Object])],zx);const Hx=new xa((t=>{t(zx).toSelf(),t(Lh).toDynamicValue((t=>t.container.get(zx))).whenTargetNamed(zx.env)}));var Vx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Gx=function(t,e){return function(i,s){e(i,s,t)}};let Wx=class extends fy{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 sy(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}};Wx=Vx([Oa(),Gx(0,Ra(qa)),Gx(0,Ia(Ab)),Gx(1,Ra(qa)),Gx(1,Ia(Iv)),Nx("design:paramtypes",[Object,Object])],Wx);const Ux=new xa((t=>{Ux.__vloaded||(Ux.__vloaded=!0,Ja(t,Ab))}));Ux.__vloaded=!1;var Yx=Ux,Kx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$x=function(t,e){return function(i,s){e(i,s,t)}};let qx=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=nu}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=Xh(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}};qx=Kx([Oa(),$x(0,Ra(ev)),Xx("design:paramtypes",[Object])],qx);let Zx=!1;const Jx=new xa(((t,e,i,s)=>{Zx||(Zx=!0,t(kb).to(qx).inSingletonScope(),t(Ab).toService(kb))}));var Qx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},eS=function(t,e){return function(i,s){e(i,s,t)}};let iS=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=au}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=Xh(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}};iS=Qx([Oa(),eS(0,Ra(iv)),tS("design:paramtypes",[Object])],iS);let sS=!1;const nS=new xa(((t,e,i,s)=>{sS||(sS=!0,t(Mb).to(iS).inSingletonScope(),t(Ab).toService(Mb))}));var rS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oS=function(t,e){return function(i,s){e(i,s,t)}};let lS=class{constructor(t){this.canvasRenderer=t,this.type="circle",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=Xh(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}};lS=rS([Oa(),oS(0,Ra(sv)),aS("design:paramtypes",[Object])],lS);let hS=!1;const cS=new xa(((t,e,i,s)=>{hS||(hS=!0,t(Tb).to(lS).inSingletonScope(),t(Ab).toService(Tb))}));var dS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pS=function(t,e){return function(i,s){e(i,s,t)}};let gS=class{constructor(t){this.canvasRenderer=t,this.type="glyph",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=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}};gS=dS([Oa(),pS(0,Ra(pv)),uS("design:paramtypes",[Object])],gS);let mS=!1;const fS=new xa(((t,e,i,s)=>{mS||(mS=!0,t(Ob).to(gS).inSingletonScope(),t(gS).toService(Ob))}));var vS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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{constructor(){this.type="image",this.numberType=cu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};_S=vS([Oa()],_S);let yS=!1;const bS=new xa(((t,e,i,s)=>{yS||(yS=!0,t(wb).to(_S).inSingletonScope(),t(_S).toService(wb))}));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},SS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},AS=function(t,e){return function(i,s){e(i,s,t)}};let kS=class{constructor(t){this.canvasRenderer=t,this.type="line",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=Xh(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}};kS=xS([Oa(),AS(0,Ra(av)),SS("design:paramtypes",[Object])],kS);let MS=!1;const TS=new xa(((t,e,i,s)=>{MS||(MS=!0,t(Cb).to(kS).inSingletonScope(),t(Ab).toService(Cb))}));var wS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ES=function(t,e){return function(i,s){e(i,s,t)}};let PS=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=pu}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=Xh(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}};PS=wS([Oa(),ES(0,Ra(lv)),CS("design:paramtypes",[Object])],PS);let BS=!1;const RS=new xa(((t,e,i,s)=>{BS||(BS=!0,t(Lb).to(PS).inSingletonScope(),t(Ab).toService(Lb))}));var LS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},OS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IS=function(t,e){return function(i,s){e(i,s,t)}};let DS=class{constructor(t){this.canvasRenderer=t,this.type="path",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=Xh(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}};DS=LS([Oa(),IS(0,Ra(ov)),OS("design:paramtypes",[Object])],DS);let FS=!1;const jS=new xa(((t,e,i,s)=>{FS||(FS=!0,t(Eb).to(DS).inSingletonScope(),t(Ab).toService(Eb))}));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},HS=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)}};const NS=new Qt;let GS=class{constructor(t){this.canvasRenderer=t,this.type="rect",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=Xh(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;NS.setValue(i.x1,i.y1,i.x2,i.y2),NS.expand(-r/2),h=!NS.containsPoint(e)}}return s.highPerformanceRestore(),h}};GS=zS([Oa(),VS(0,Ra(hv)),HS("design:paramtypes",[Object])],GS);let WS=!1;const US=new xa(((t,e,i,s)=>{WS||(WS=!0,t(Pb).to(GS).inSingletonScope(),t(Ab).toService(Pb))}));let YS=!1;const KS=new xa(((t,e,i,s)=>{YS||(YS=!0,t(wb).to(_S).inSingletonScope(),t(_S).toService(wb))}));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},$S=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qS=function(t,e){return function(i,s){e(i,s,t)}};let ZS=class{constructor(t){this.canvasRenderer=t,this.type="symbol",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=Xh(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}};ZS=XS([Oa(),qS(0,Ra(cv)),$S("design:paramtypes",[Object])],ZS);let JS=!1;const QS=new xa(((t,e,i,s)=>{JS||(JS=!0,t(Bb).to(ZS).inSingletonScope(),t(Ab).toService(Bb))}));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};let eA=class{constructor(){this.type="text",this.numberType=vu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};eA=tA([Oa()],eA);let iA=!1;const sA=new xa(((t,e,i,s)=>{iA||(iA=!0,t(Rb).to(eA).inSingletonScope(),t(Ab).toService(Rb))})),nA=new xa(((t,e,i,s)=>{i(Wx)||t(Wx).toSelf().inSingletonScope(),i(Rv)?s(Rv).toService(Wx):t(Rv).toService(Wx)}));class rA{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 aA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let lA=class extends hy{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 rA(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 Dc.call(t)}}getCancelAnimationFrame(){return t=>{Dc.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}};lA=aA([Oa(),oA("design:paramtypes",[])],lA);const hA=new xa((t=>{hA.isFeishuBound||(hA.isFeishuBound=!0,t(lA).toSelf().inSingletonScope(),t(eo).toService(lA))}));function cA(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];cA.__loaded||(cA.__loaded=!0,t.load(hA),t.load(Ox),t.load(Hx),e&&function(t){t.load(Yx),t.load(nA),t.load(Jx),t.load(nS),t.load(cS),t.load(fS),t.load(bS),t.load(TS),t.load(RS),t.load(jS),t.load(US),t.load(KS),t.load(QS),t.load(sA)}(t))}hA.isFeishuBound=!1,cA.__loaded=!1;var dA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let pA=class extends ix{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(){}};pA.env="node",pA=dA([Oa(),uA("design:paramtypes",[Object,Number])],pA);var gA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let fA=class extends oy{constructor(t){super(t)}init(){this._context=new pA(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};fA.env="node",fA=gA([Oa(),mA("design:paramtypes",[Object])],fA);const vA=ax(fA,pA);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)},bA=function(t,e){return function(i,s){e(i,s,t)}};let xA=class extends uy{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 fA(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 fA({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){}};xA.env="node",xA=_A([Oa(),bA(0,Ra(io)),yA("design:paramtypes",[Object])],xA);const SA=new xa((t=>{t(xA).toSelf(),t(Lh).toDynamicValue((t=>t.container.get(xA))).whenTargetNamed(xA.env)}));var AA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 kA=class extends hy{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 Dc.call(t)}}getCancelAnimationFrame(){return t=>{Dc.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};kA=AA([Oa()],kA);const MA=new xa((t=>{MA.isNodeBound||(MA.isNodeBound=!0,t(kA).toSelf().inSingletonScope(),t(eo).toService(kA))}));function TA(t){TA.__loaded||(TA.__loaded=!0,t.load(MA),t.load(vA),t.load(SA))}MA.isNodeBound=!1,TA.__loaded=!1;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},CA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},EA=function(t,e){return function(i,s){e(i,s,t)}};let PA=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=nu}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=Xh(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=xm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};PA=wA([Oa(),EA(0,Ra(ev)),CA("design:paramtypes",[Object])],PA);let BA=!1;const RA=new xa(((t,e,i,s)=>{BA||(BA=!0,t(Ib).to(PA).inSingletonScope(),t(Xb).toService(Ib))}));var LA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},OA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IA=function(t,e){return function(i,s){e(i,s,t)}};const DA=new Qt;let FA=class{constructor(t){this.canvasRenderer=t,this.type="rect",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=Xh(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=xm(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;DA.setValue(i.x1,i.y1,i.x2,i.y2),DA.expand(-r/2),h=!DA.containsPoint(e)}}return s.highPerformanceRestore(),h}};FA=LA([Oa(),IA(0,Ra(hv)),OA("design:paramtypes",[Object])],FA);let jA=!1;const zA=new xa(((t,e,i,s)=>{jA||(jA=!0,t(Vb).to(FA).inSingletonScope(),t(Xb).toService(Vb))}));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 VA=class extends _m{};VA=HA([Oa()],VA);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},GA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},WA=function(t,e){return function(i,s){e(i,s,t)}};let UA=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="line",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;s.highPerformanceSave();const n=Xh(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=xm(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&nm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};UA=NA([Oa(),WA(0,Ra(av)),GA("design:paramtypes",[Object])],UA);let YA=!1;const KA=new xa(((t,e,i,s)=>{YA||(YA=!0,t(zb).to(UA).inSingletonScope(),t(Xb).toService(zb))}));var XA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},qA=function(t,e){return function(i,s){e(i,s,t)}};let ZA=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=au}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=Xh(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=xm(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h})),s.highPerformanceRestore(),h}};ZA=XA([Oa(),qA(0,Ra(iv)),$A("design:paramtypes",[Object])],ZA);let JA=!1;const QA=new xa(((t,e,i,s)=>{JA||(JA=!0,t(Db).to(ZA).inSingletonScope(),t(Xb).toService(Db))}));var tk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ik=function(t,e){return function(i,s){e(i,s,t)}};let sk=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=fu}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=Xh(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=xm(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&nm.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};sk=tk([Oa(),ik(0,Ra(cv)),ek("design:paramtypes",[Object])],sk);let nk=!1;const rk=new xa(((t,e,i,s)=>{nk||(nk=!0,t(Nb).to(sk).inSingletonScope(),t(Xb).toService(Nb))}));var ak=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ok=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lk=function(t,e){return function(i,s){e(i,s,t)}};let hk=class{constructor(t){this.canvasRenderer=t,this.type="circle",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=Xh(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=xm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};hk=ak([Oa(),lk(0,Ra(sv)),ok("design:paramtypes",[Object])],hk);let ck=!1;const dk=new xa(((t,e,i,s)=>{ck||(ck=!0,t(Fb).to(hk).inSingletonScope(),t(Xb).toService(Fb))}));var uk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gk=function(t,e){return function(i,s){e(i,s,t)}};let mk=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=vu}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=Xh(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=dp(a,u,n),v=cp(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&&nm.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};mk=uk([Oa(),gk(0,Ra(dv)),pk("design:paramtypes",[Object])],mk);let fk=!1;const vk=new xa(((t,e,i,s)=>{fk||(fk=!0,t(Gb).to(mk).inSingletonScope(),t(Xb).toService(Gb))}));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},yk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bk=function(t,e){return function(i,s){e(i,s,t)}};let xk=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="path",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=Xh(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=xm(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&nm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};xk=_k([Oa(),bk(0,Ra(ov)),yk("design:paramtypes",[Object])],xk);let Sk=!1;const Ak=new xa(((t,e,i,s)=>{Sk||(Sk=!0,t(Hb).to(xk).inSingletonScope(),t(Xb).toService(Hb))}));var kk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mk=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 wk=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=pu}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=Xh(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=xm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};wk=kk([Oa(),Tk(0,Ra(lv)),Mk("design:paramtypes",[Object])],wk);let Ck=!1;const Ek=new xa(((t,e,i,s)=>{Ck||(Ck=!0,t(Wb).to(wk).inSingletonScope(),t(Xb).toService(Wb))}));var Pk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rk=function(t,e){return function(i,s){e(i,s,t)}};let Lk=class{constructor(t){this.canvasRenderer=t,this.type="glyph",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=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}};Lk=Pk([Oa(),Rk(0,Ra(pv)),Bk("design:paramtypes",[Object])],Lk);let Ok=!1;const Ik=new xa(((t,e,i,s)=>{Ok||(Ok=!0,t(Yb).to(Lk).inSingletonScope(),t(Xb).toService(Yb))}));var Dk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Fk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jk=function(t,e){return function(i,s){e(i,s,t)}};let zk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=mu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};zk=Dk([Oa(),jk(0,Ra(uv)),Fk("design:paramtypes",[Object])],zk);let Hk=!1;const Vk=new xa(((t,e,i,s)=>{Hk||(Hk=!0,t(Ub).to(zk).inSingletonScope(),t(Xb).toService(Ub))}));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};let Gk=class{constructor(){this.type="image",this.numberType=cu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Gk=Nk([Oa()],Gk);let Wk=!1;const Uk=new xa(((t,e,i,s)=>{Wk||(Wk=!0,t(jb).to(Gk).inSingletonScope(),t(Xb).toService(jb))})),Yk=$_();function Kk(){Kk.__loaded||(Kk.__loaded=!0,pm.RegisterGraphicCreator("arc",Xg),ql.load(by),ql.load(Yk?RA:Jx))}Kk.__loaded=!1;const Xk=Kk;function $k(){$k.__loaded||($k.__loaded=!0,pm.RegisterGraphicCreator("area",Ug),ql.load(Ty),ql.load(Yk?QA:nS))}$k.__loaded=!1;const qk=$k;function Zk(){Zk.__loaded||(Zk.__loaded=!0,pm.RegisterGraphicCreator("circle",lp),ql.load(Py),ql.load(Yk?dk:cS))}Zk.__loaded=!1;const Jk=Zk;function Qk(){Qk.__loaded||(Qk.__loaded=!0,pm.RegisterGraphicCreator("glyph",Cg),ql.load(Hy),ql.load(Yk?Ik:fS))}Qk.__loaded=!1;const tM=Qk;function eM(){eM.__loaded||(eM.__loaded=!0,pm.RegisterGraphicCreator("group",ku))}eM.__loaded=!1;const iM=eM;function sM(){sM.__loaded||(sM.__loaded=!0,pm.RegisterGraphicCreator("image",Lg),ql.load(Ky),ql.load(Yk?Uk:bS))}sM.__loaded=!1;const nM=sM;function rM(){rM.__loaded||(rM.__loaded=!0,pm.RegisterGraphicCreator("line",Ag),ql.load(ky),ql.load(Yk?KA:TS))}rM.__loaded=!1;const aM=rM;function oM(){oM.__loaded||(oM.__loaded=!0,pm.RegisterGraphicCreator("path",Ng),ql.load(Oy),ql.load(Yk?Ak:jS))}oM.__loaded=!1;const lM=oM;function hM(){hM.__loaded||(hM.__loaded=!0,pm.RegisterGraphicCreator("polygon",Zg),ql.load(Dy),ql.load(Yk?Ek:RS))}hM.__loaded=!1;const cM=hM;function dM(){dM.__loaded||(dM.__loaded=!0,pm.RegisterGraphicCreator("rect",Tg),ql.load(Sy),ql.load(Yk?zA:US))}dM.__loaded=!1;const uM=dM;function pM(){pM.__loaded||(pM.__loaded=!0,pm.RegisterGraphicCreator("richtext",zg),ql.load(Uy),ql.load(Yk?Vk:KS))}pM.__loaded=!1;const gM=pM;function mM(){mM.__loaded||(mM.__loaded=!0,pm.RegisterGraphicCreator("shadowRoot",Qg))}mM.__loaded=!1;const fM=mM;function vM(){vM.__loaded||(vM.__loaded=!0,pm.RegisterGraphicCreator("symbol",bg),ql.load(Cy),ql.load(Yk?rk:QS))}vM.__loaded=!1;const _M=vM;function yM(){yM.__loaded||(yM.__loaded=!0,pm.RegisterGraphicCreator("text",mp),ql.load(Ry),ql.load(Yk?vk:sA))}yM.__loaded=!1;const bM=yM;function xM(){iM(),uM()}const SM=-.5*Math.PI,AM=1.5*Math.PI,kM="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 MM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(MM||(MM={}));const TM={[MM.selectedReverse]:{},[MM.selected]:{},[MM.hover]:{},[MM.hoverReverse]:{}},wM={container:"",width:30,height:30,style:{}},CM={debounce:xt,throttle:St};xM();let EM=class t extends Sb{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"===P_.env?(P_.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),P_.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:CM[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"===P_.env?(P_.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),P_.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",CM[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 PM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&PM(t,e)}))}EM.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 BM=t=>!u(t)&&!1!==t.visible;function RM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function LM(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 IM=["#ffffff","#000000"];function DM(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 FM(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(...IM);for(const n of a)if(t!==n&&FM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function FM(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?jM(t,e)>s:"largeText"===i?jM(t,e)>3:jM(t,e)>4.5}function jM(t,e){const i=zM(t),s=zM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function zM(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 HM(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 VM(t,e){return[t[0]*e,t[1]*e]}function NM(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 GM=(t,e,i,s)=>new Qe(Object.assign({defaultFontParams:Object.assign({fontFamily:kM,fontSize:14},s),getTextBounds:i?void 0:fm,specialCharSet:"-/: .,@%'\"~"+Qe.ALPHABET_CHAR_SET+Qe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function WM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const s=fm({text:t,fontFamily:e.fontFamily||i.fontFamily||kM,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 UM(t){return"rich"===YM(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type")}function YM(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 KM(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 XM(t){const e=YM(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?pm.richtext(KM(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)),pm.text(t))}function $M(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 ZM(){iM(),uM(),_M(),gM(),bM()}var JM=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);nh&&(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,V=JM(a,["visible"]);if(m&&c(H)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},V),{visible:H&&!!s,x:I,y:D,width:k,height:M}),"rect");B(null==f?void 0:f.panel)||(t.states=f.panel),this._bgRect=t}}this._textShape=P}}QM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const tT={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}},eT={poptip:z({},tT)};var iT=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]]}}}}nT.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 rT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 aT=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,nT.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new nT(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,eT.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}))}};aT=rT([Oa()],aT);var oT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 lT=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)}};lT=oT([Oa()],lT);let hT=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)}};hT=oT([Oa()],hT);const cT=new xa(((t,e,i,s)=>{i(aT)||(t(aT).toSelf().inSingletonScope(),t(rp).toService(aT)),i(lT)||(t(lT).toSelf(),t(Vv).toService(lT)),i(hT)||(t(hT).toSelf(),t(Vv).toService(hT))}));class dT extends Sb{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}iM(),aM();class uT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},uT.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})}}uT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},iM(),uM();class pT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},pT.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})}}pT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},iM(),Xk();class gT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},gT.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)}}gT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},iM(),Xk();class mT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},mT.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=SM,endAngle:s=AM}=this.attribute,n=s-i,r=ee(ne(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}mT.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},iM(),lM();class fT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fT.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)}}fT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const vT=new Uint32Array(33),_T=new Uint32Array(33);_T[0]=0,vT[0]=~_T[0];for(let t=1;t<=32;++t)_T[t]=_T[t-1]<<1|1,vT[t]=~_T[t];function yT(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]&vT[31&l]&_T[1+(31&h)])return!0}else{if(i[c]&vT[31&l])return!0;if(i[d]&_T[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,vT[31&n]&_T[1+(31&r)]);else for(s(a,vT[31&n]),s(o,_T[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,_T[31&i]|vT[1+(31&s)]);else for(n(r,_T[31&i]),n(a,vT[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 bT(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 xT(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=bT(t,r),!(s&&e.outOfBounds(r)||e.getRange(r))}function ST(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 ST(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 ST(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 ST(t,e,n,s,h,c)}return!1}const kT=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],MT=["top","inside-top","inside"];function TT(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 wT={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 CT(t,e){var i,s;return null!==(s=null===(i=wT[e])||void 0===i?void 0:i.call(wT,t))&&void 0!==s?s:{from:{},to:{}}}const ET=(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 PT(t,e,i,s){t.attribute.text!==e.attribute.text&&k(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new jc({text:t.attribute.text},{text:e.attribute.text},i,s))}const BT={mode:"same-time",duration:300,easing:"linear"};function RT(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 LT(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 OT(t){return 3===t||4===t}function IT(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 DT=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)}},FT=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 jT(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 zT(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)}}iM(),bM(),gM(),aM();class HT extends Sb{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},HT.defaultAttributes,t)),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(MM.hover,!0),PM(this,(t=>{t===e||B(t.states)||t.addState(MM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(PM(this,(t=>{B(t.states)||(t.removeState(MM.hoverReverse),t.removeState(MM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void PM(this,(t=>{B(t.states)||(t.removeState(MM.selectedReverse),t.removeState(MM.selected))}));B(e.states)||(e.addState(MM.selected,!0),PM(this,(t=>{t===e||B(t.states)||t.addState(MM.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:[];(this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)]).forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(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[zT(g,m,c,d,a,o),zT(-g,-m,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds);if(i){const t=pm.line({points:i});return e&&e.attribute.fill&&t.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&t.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(t),t}}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)),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 XM(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&&y.setRange(bT(v,t.AABBBounds,!0))}))),m.length>0&&m.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&&y.setRange(bT(v,t.AABBBounds,!0))})):t.AABBBounds&&y.setRange(bT(v,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 i=new Map,s=this._graphicToText||new Map,n=[],r=[],{visible:a}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{const o=this.getRelatedGraphic(t.attribute),l=t.attribute.id,h=this._isCollectionBase?l:o,c=(null==s?void 0:s.get(h))?"update":"enter";let d;if(a&&(d=this._createLabelLine(t,o)),"enter"===c){if(n.push(t),i.set(h,d?{text:t,labelLine:d}:{text:t}),o){const{from:i,to:s}=CT(t.attribute,"fadeIn");this.add(t),d&&(r.push(d),this.add(d)),this._syncStateWithRelatedGraphic(o),this._animationConfig.enter.duration>0&&o.once("animate-bind",(a=>{t.setAttributes(i),d&&d.setAttributes(i);const l=this._afterRelatedGraphicAttributeUpdate(t,n,d,r,e,o,s,this._animationConfig.enter);o.on("afterAttributeUpdate",l)}))}}else if("update"===c){const e=s.get(h);s.delete(h),i.set(h,e);const n=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&&PT(t,e,s,n))}i.forEach(((i,s)=>{const{duration:n,easing:r,increaseEffect:a=!0,channel:o}=i,{from:l,to:h}=ET(t,e,o,i.options);B(h)||t.animate().to(h,n,r),"text"in l&&"text"in h&&a&&PT(t,e,n,r)}))})(n,t,this._animationConfig.update),e.labelLine&&d&&e.labelLine.animate().to(d.attribute,r,a)}})),s.forEach((t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(CT(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=i}_renderWithOutAnimation(t){var e;const i=new Map,s=this._graphicToText||new Map,{visible:n}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach((t=>{const e=this.getRelatedGraphic(t.attribute),r=(null==s?void 0:s.get(e))?"update":"enter",a=this._isCollectionBase?t.attribute.id:e;let o;if(n&&(o=this._createLabelLine(t,e)),"enter"===r)i.set(a,o?{text:t,labelLine:o}:{text:t}),this.add(t),o&&this.add(o),this._syncStateWithRelatedGraphic(e);else if("update"===r){const e=s.get(a);s.delete(a),i.set(a,e),e.text.setAttributes(t.attribute),e.labelLine&&o&&e.labelLine.setAttributes(o.attribute)}})),s.forEach((t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)})),this._graphicToText=i}_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)}}VT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};class NT extends HT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},NT.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}}}NT.tag="rect-label",NT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};let GT=class t extends HT{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 jT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};GT.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class WT{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 UT extends HT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UT.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:"…"}),n=this._createLabelText(s),r=this.getGraphicBounds(n),a=r.x2-r.x1,o=e.map((t=>t.attribute)),l=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),o,i,a);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=LT(l.endAngle-d/2),p=RT(h.x,h.y,l.outerRadius,o),g=RT(h.x,h.y,a+e.line.line1MinLength,o),m=new WT(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);m.pointA=RT(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):OT(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=RT(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=OT(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=OT(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=OT(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?OT(t.quadrant)?"left":"right":OT(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*(OT(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;e1&&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 jT(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 extends HT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},KT.defaultAttributes,t)),this.name="line-data-label"}labeling(t,e){return DT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}KT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const XT={rect:NT,symbol:VT,arc:UT,line:GT,area:YT,"line-data":KT};class $T extends Sb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},$T.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=yT(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(){iM(),aM(),cM(),_M()}function ZT(){iM(),aM(),Xk(),_M()}$T.defaultAttributes={pickable:!1},qT();class JT extends Sb{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({},JT.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=pm.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=pm.line;Y(i)[0].cornerRadius&&(t=pm.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=pm.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}}JT.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}}},ZT();class QT extends JT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JT.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=pm.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 tw,ew;!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"}(tw||(tw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(ew||(ew={}));const iw={[ew.selectedReverse]:{},[ew.selected]:{},[ew.hover]:{},[ew.hoverReverse]:{}},sw={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}}},nw=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 rw(t,e,i){return!mt(t,e,0,1e-6)&&!gt(t,i,0,1e-6)}function aw(t,e,i,s){const n=fm(Object.assign({text:i},s)),r=n.width(),a=n.height(),o=nw(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=rw(o,-l,-h)?((o+l)/c-.5)*r:rw(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=rw(o,-l,-h)?.5*-a:rw(o,h,l)?.5*a:Math.cos(o)>=0?(.5-(h-o)/c)*a:(.5-nw(o-l)/c)*a,{x:p,y:g-m}}function ow(t){const e={};return PM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function lw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function hw(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 VM(r,(s?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}const cw=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!B(s.states)?(s.addState(MM.hover,!0),PM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(MM.hoverReverse,!0)})),s):i},dw=(t,e,i)=>i?(PM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(MM.hoverReverse),t.removeState(MM.hover))})),null):i,uw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(MM.selected)?(PM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(MM.selectedReverse),t.removeState(MM.selected))})),null):s.name&&!B(s.states)?(s.addState(MM.selected,!0),PM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(MM.selectedReverse,!0)})),s):i};class pw extends Sb{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=cw(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=dw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=uw(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=pm.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&&ow(this._innerView),this.removeAllChild(!0),this._innerView=pm.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=pm.group({x:0,y:0,zIndex:1});if(a.name=tw.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=pm.group({x:0,y:0,pickable:!1});t.name=tw.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=pm.group({x:0,y:0,pickable:!1});i.name=tw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=pm.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=tw.tick,r.id=this._getNodeId(t.id),B(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=TM;else{const t=this.data[s],e=z({},TM,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=pm.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=tw.subTick,r.id=this._getNodeId(`${n}`),B(s.state))r.states=TM;else{const i=z({},TM,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=pm.group({x:0,y:0,pickable:!1});return r.name=`${tw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=XM(this._getLabelAttribute(t,e,n,i));if(a.name=tw.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=TM;else{const s=z({},TM,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 QM(Object.assign({},e));i.name=tw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return lw(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({},sw.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 gw(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 mw(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 fw={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&&vw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function vw(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 _w(t,e){for(let i,s=1,n=t.length,r=t[0];s1&&e.height()>1}function bw(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Aw(t,e.attribute.angle)),{angle:Sw(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({},kw(t,e.attribute.angle)),{angle:Sw(e.attribute.angle)}))}))}(t,e),gw(e)}function Sw(){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 Aw(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=Sw(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 kw(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=Sw(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 Mw{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 VM([s[1],-1*s[0]],t*(e?1:-1)*i)}}function Tw(){iM(),aM(),gM(),bM()}var ww=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=NM(_,[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({},iw,c.text),shape:z({},iw,c.shape),panel:z({},iw,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 Aw(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return kw(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)})),xw(i,t),!bw(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(yw);if(B(i))return;let s;s=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i),gw(s);const{method:n="parity",separation:r=0}=e,a=d(n)?n:fw[n]||fw.parity;if(s.length>=3&&_w(s,r)){do{s=a(s,r)}while(s.length>=3&&_w(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&&vw(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=pm.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=tw.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=WM(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}}Cw.defaultAttributes=sw,U(Cw,Mw);class Ew{isInValidValue(t){const{startAngle:e=SM,endAngle:i=AM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=SM,endAngle:i=AM,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 hw(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 Pw,Bw=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=pm.circle(c);d.name=tw.line,d.id=this._getNodeId("line"),B(a.state)||(d.states=z({},iw,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=Bw(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({},iw,d.text),shape:z({},iw,d.shape),panel:z({},iw,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 aw(t,e,i,s)}}Rw.defaultAttributes=sw,U(Rw,Ew);class Lw extends mc{constructor(){super(...arguments),this.mode=ko.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},PM(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{Iw[t]=!0}));const Hw=t=>-Math.log(-t),Vw=t=>-Math.exp(-t),Nw=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,Gw=t=>10===t?Nw:t===Math.E?Math.exp:e=>Math.pow(t,e),Ww=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Uw=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),Yw=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function Kw(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 Xw(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function $w(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),$w(t,i,s)*(e/(1-i))}function Zw(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function Jw(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 eC{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=Zw(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 iC=Symbol("implicit");class sC extends eC{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=Pw.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=iC}clone(){const t=(new sC).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!==iC)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 rC extends sC{constructor(t){super(),this.type=Pw.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:nC(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 nC(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 rC(!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:aC}=xe;function oC(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=aC(_e.parseColorString(t),s);return t=>e(t).formatRgb()}return At(Number(t),Number(e))}return e instanceof ye?aC(t,e):e instanceof _e?aC(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 lC extends eC{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:zw,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zw;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=zw,this._piecewise=Xw,this._interpolate=oC}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?Jw:Xw,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:zw),this.rescale(i)):this._clamp!==zw}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 hC=Math.sqrt(50),cC=Math.sqrt(10),dC=Math.sqrt(2),uC=[1,2,5,10],pC=(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=vC(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?mC(0,-(e-1)/s,s):mC((e-1)/s,0,s)},gC=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 pC(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return pC(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=mC(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=mC(t,e,l);return n&&r.reverse(),r})),vC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=uC[0];return i>=hC?s=uC[3]:i>=cC?s=uC[2]:i>=dC&&(s=uC[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function _C(t,e,i){const s=(e-t)/Math.max(0,i);return vC(s)}function yC(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=_C(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 xC(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 SC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),AC=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})),kC=ft(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=fC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?SC(t,e,n):SC(t,e,tC(n)),h=SC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),MC=ft(((t,e,i,s,n)=>yC(s(t),s(e),i).map((t=>tC(n(t))))));class TC extends lC{constructor(){super(...arguments),this.type=Pw.Linear}clone(){return(new TC).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 gC(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=fC(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 yC(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=xC(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=bC(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=bC(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=bC(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function wC(t){return e=>-t(-e)}function CC(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class EC extends lC{constructor(){super(Ww(10),Gw(10)),this.type=Pw.Log,this._limit=CC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new EC).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=Ww(this._base),s=Gw(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=wC(i),this._pows=wC(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=Hw,this.untransformer=Vw):(this._logs=i,this._pows=s,this._limit=CC(),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 zw}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 AC(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 kC(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 MC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return MC(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=xC(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=Qw(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 PC extends TC{constructor(){super(Uw(1),Yw(1)),this.type=Pw.Symlog,this._const=1}clone(){return(new PC).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=Uw(t),this.untransformer=Yw(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 AC(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 kC(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 MC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return MC(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=xC(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=Qw(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 BC{constructor(){this.type=Pw.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 BC).domain(this._domain).range(this._range).unknown(this._unknown)}}const RC=t=>t.map(((t,e)=>({index:e,value:t}))),LC=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 OC(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function IC(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=GM(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=DC(S,y,m[0],m[m.length-1]):a&&c&&s===e.length-1?T=DC(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=DC(A,b,m[0],m[m.length-1]):a&&d&&s===e.length-1?w=DC(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},jC=(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=GM(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=lw(o,hw(s,o,e,n));return aw(l,hw(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},zC={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&OC(i.AABBBounds,t.AABBBounds,e)||(i=t,0))))}},HC=(t,e,i,s)=>FC(t,e,i).map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),VC=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},NC=(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&&!VC(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?NC(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&&LC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},UC=(t,e)=>{if(Dw(t.type))return((t,e)=>{if(!Dw(t.type))return RC(t.domain());const i=t.range(),s=Math.abs(i[i.length-1]-i[0]);if(s<2)return RC([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=FC(t,h,e).map(((t,e)=>({AABBBounds:t,value:h[e]})));for(;n.length>=3&&IC(n,i);)n=zC.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 RC(h)})(t,e);if(jw(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?RC([s[s.length-1]]):RC([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=HC(t,s,e,c),l=Math.min(...n.map((t=>t[2]))),h=GC(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=HC(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 RC(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=jC(t,i,e),r=$(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=WC(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 RC(c)})(t,e)}return RC(t.domain())};function YC(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 KC(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 XC(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=YC(t,!!n),o=YC(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=KC(e,t,!1,!!n),o=KC(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=YC(t,!!n),o=YC(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class $C extends Sb{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&ow(this._innerView),this.removeAllChild(!0),this._innerView=pm.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 lw(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?`${tw.grid}-sub`:`${tw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=YC(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=KC(t,o,!1,!!a)}const u=pm.path(Object.assign({path:c,z:l},d(r)?z({},this.skipDefault?null:$C.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=YC(o,!!a),f=Lt(o[0].x-o[1].x),v=Lt(o[0].y-o[1].y),_=pm.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:$C.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,Mw);var ZC=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(JC,Ew);const QC="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",tE={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:QC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:QC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},eE={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 iE;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(iE||(iE={}));var sE=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=iE.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=iE.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=iE.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=iE.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=iE.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t),"browser"===P_.env&&(P_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),P_.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===iE.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===iE.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=iE.endHandler):h+=l:this._activeTag===iE.endHandler&&(c+l{t.preventDefault();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===iE.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"===P_.env&&(P_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),P_.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===iE.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===iE.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=sE(i,["formatMethod"]),{formatMethod:a}=s,o=sE(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:V={},brushSelect:N,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=V.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:N?"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),N&&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:N?"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:N?"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"},eE.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=V.symbolType)&&void 0!==y?y:"square"},eE.horizontal),V),{pickable:!G&&(null===(b=V.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},eE.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},eE.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"},eE.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=V.symbolType)&&void 0!==R?R:"square"},eE.vertical),V),{pickable:!G&&(null===(L=V.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},eE.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},eE.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 _y(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 QM(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 aE,oE,lE,hE;function cE(){iM(),ZM()}function dE(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 uE(t,e){const{dx:i,dy:s}=dE(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}rE.defaultAttributes=tE,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"}(aE||(aE={})),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"}(oE||(oE={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(lE||(lE={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(hE||(hE={}));class pE extends Sb{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=cw(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=dw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=uw(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=pm.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=pm.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=pm.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 gE(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 mE(t,e,i,s){t&&(gE(t.startSymbol,e,i,s),t.lines.forEach((t=>gE(t,e,i,s))),gE(t.line,e,i,s),gE(t.endSymbol,e,i,s))}function fE(t,e,i,s){t&&(gE(t.getTextShape(),e,i,s),gE(t.getBgRect(),e,i,s))}function vE(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 _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,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;gE(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)})),gE(t.endSymbol,s+r+a,o,n),gE(e.getTextShape(),s+r+a+o,l,n),gE(e.getBgRect(),s+r+a+o,l,n)}function xE(t,e,i,s,n){mE(t,s,i,n),fE(e,s,i,n)}function SE(t,e,i,s,n){gE(t,s,i,n),fE(e,s,i,n)}function AE(t,e,i,s,n){gE(t,s,i,n),fE(e,s,i,n)}function kE(t,e,i,s,n,r){var a;mE(t,n,s,r),gE(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?fE(i,n,s,r):gE(i,n,s,r)}function ME(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;gE(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)})),gE(e,n+o+l,h,r),gE(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(gE(i.getTextShape(),n+o+l+h+c,d,r),gE(i.getBgRect(),n+o+l+c,d,r)):gE(i,n+o+l+c,d,r)}function TE(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?bE(t,e,s,r,a):"fadeIn"===i&&xE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?bE(t,e,s,n,a):"fadeIn"===i&&xE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){_E(t,s,i,n),yE(e,s,i,n)}(t,e,i,s,n)}}function wE(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&&SE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&SE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){vE(t,s,i,n),yE(e,s,i,n)}(t,e,i,s,n)}}function CE(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&&AE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&AE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){vE(t,s,i,n),yE(e,s,i,n)}(t,e,i,s,n)}}function EE(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?kE(n,r,e,i,s,o):"callIn"===t&&ME(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?kE(n,r,e,i,s,a):"callIn"===t&&ME(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;_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)}(n,r,e,t,i,s)}}const PE={type:"clipIn",duration:500,easing:"linear",delay:0},BE={type:"fadeIn",duration:500,easing:"linear",delay:0},RE={type:"callIn",duration:500,easing:"linear",delay:0},LE={type:"fadeOut",duration:500,easing:"linear",delay:0};class OE extends pE{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=PE,this.defaultExitAnimation=LE}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;uE(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 QM(Object.assign(Object.assign({},e),{state:{panel:z({},TM,null==i?void 0:i.labelBackground),text:z({},TM,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({},TM,null==e?void 0:e.labelBackground),text:z({},TM,null==e?void 0:e.label)}})),this.setLabelPos())}}const IE=.001,DE={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:aE.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]}},FE={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"}}},jE={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:lE.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]}},zE={interactive:!0,label:{position:oE.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}},HE={interactive:!0,label:{position:lE.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}},VE={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"}},NE={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"}},GE={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 WE(){UE._animate=TE}cE(),qT();class UE extends OE{markerAnimate(t){UE._animate&&this._animationConfig&&UE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UE.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(RM(t)?t:t-Math.PI)+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}getTextStyle(t,e,i){return LM(Math.abs(e),Math.PI/2,IE)||LM(Math.abs(e),3*Math.PI/2,IE)?OM(i,e,t):RM(e)?FE.postiveXAxis[t]:FE.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new JT({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},TM,null==a?void 0:a.line),startSymbol:z({},TM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},TM,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({},TM,null==a?void 0:a.line),startSymbol:z({},TM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},TM,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 YE(){KE._animate=wE}UE.defaultAttributes=DE,cE(),cM();class KE extends pE{markerAnimate(t){KE._animate&&this._animationConfig&&KE._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({},KE.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=BE,this.defaultExitAnimation=LE}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({},NE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;uE(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=pm.polygon(Object.assign({points:e},s));r.states=z({},TM,null==n?void 0:n.area),r.name="mark-area-polygon",this._area=r,t.add(r);const a=new QM(Object.assign(Object.assign({},i),{state:{panel:z({},TM,null==n?void 0:n.labelBackground),text:z({},TM,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({},TM,null==s?void 0:s.area)),this._label&&this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},e),{state:{panel:z({},TM,null==s?void 0:s.labelBackground),text:z({},TM,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}}KE.defaultAttributes=zE,cE(),ZT();class XE extends OE{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,{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 lE.arcInnerStart:l=s;case lE.arcOuterStart:l=s;break;case lE.arcInnerEnd:l=n;case lE.arcOuterEnd:l=n;break;case lE.center:case lE.arcInnerMiddle:case lE.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 VE[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 QT({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},TM,null==o?void 0:o.line),startSymbol:z({},TM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},TM,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({},TM,null==o?void 0:o.line),startSymbol:z({},TM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},TM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}}XE.defaultAttributes=jE,cE(),Xk();class $E extends pE{markerAnimate(t){$E._animate&&this._animationConfig&&$E._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({},$E.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcArea",this.defaultUpdateAnimation=BE,this.defaultExitAnimation=LE}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 lE.center:h=(i+s)/2,c=(n+r)/2;break;case lE.arcInnerStart:h=i,c=n;break;case lE.arcOuterStart:h=s,c=n;break;case lE.arcInnerEnd:h=i,c=r;break;case lE.arcOuterEnd:h=s,c=r;break;case lE.arcInnerMiddle:h=i,c=(n+r)/2;break;case lE.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({},VE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;uE(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=pm.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));h.states=z({},TM,null==l?void 0:l.area),h.name="polar-mark-area-area",this._area=h,t.add(h);const c=new QM(Object.assign(Object.assign({},o),{state:{panel:z({},TM,null==l?void 0:l.labelBackground),text:z({},TM,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({},TM,null==o?void 0:o.area)),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},a),{state:{panel:z({},TM,null==o?void 0:o.labelBackground),text:z({},TM,null==o?void 0:o.label)}})),this.setLabelPos())}isValidPoints(){return!0}}function qE(){ZE._animate=EE}$E.defaultAttributes=HE,cE(),qT(),ZT(),_M(),nM(),aM();class ZE extends pE{markerAnimate(t){ZE._animate&&this._animationConfig&&ZE._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ZE.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=RE,this.defaultExitAnimation=LE,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return LM(Math.abs(s),Math.PI/2,IE)||LM(Math.abs(s),3*Math.PI/2,IE)?OM(t,s,n):RM(s)?GE.postiveXAxis[n]:GE.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=hE.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({},TM,null==m?void 0:m.textBackground),text:z({},TM,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({},TM,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({},TM,null==m?void 0:m.image));const y=RM(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=pm.symbol(Object.assign(Object.assign({},i),r)),h.states=z({},TM,null==s?void 0:s.symbol)):"text"===n?h=new QM(Object.assign(Object.assign({},i),{state:{panel:z({},TM,null==s?void 0:s.textBackground),text:z({},TM,null==s?void 0:s.text)}})):"richText"===n?(h=pm.richtext(Object.assign(Object.assign({},i),a)),h.states=z({},TM,null==s?void 0:s.richText)):"image"===n?(h=pm.image(Object.assign(Object.assign({},i),o)),h.states=z({},TM,null==s?void 0:s.image)):"custom"===n&&l&&(h=l(),h.states=z({},TM,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=LM(c,0,IE)||LM(d,0,IE),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(aP.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(aP.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===aP.focus||"focus"===o){const s=a.hasState(nP.focus);a.toggleState(nP.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[nP.unSelected,nP.unSelectedHover,nP.focus],t),this._setLegendItemState(e,nP.selected,t)})):(this._setLegendItemState(a,nP.selected,t),this._removeLegendItemState(a,[nP.unSelected,nP.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[nP.selected,nP.selectedHover,nP.focus],t),this._setLegendItemState(e,nP.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(nP.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(nP.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(rP.legendItemClick,a,t);i?(this._removeLegendItemState(a,[nP.selected,nP.selectedHover],t),this._setLegendItemState(a,nP.unSelected,t)):(this._setLegendItemState(a,nP.selected,t),this._removeLegendItemState(a,[nP.unSelected,nP.unSelectedHover],t))}else this._setLegendItemState(a,nP.selected,t),this._removeLegendItemState(a,[nP.unSelected,nP.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[nP.selected,nP.selectedHover],t),this._setLegendItemState(e,nP.unSelected,t))}))}this._dispatchLegendEvent(rP.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,nP.selected),this._removeLegendItemState(e,[nP.unSelected,nP.unSelectedHover])):(this._removeLegendItemState(e,[nP.selected,nP.selectedHover]),this._setLegendItemState(e,nP.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=eP,spaceRow:h=iP}=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;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):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=pm.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,aP.item,t,w)):(w=pm.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,aP.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?nP.selected:nP.unSelected);const C=pm.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=pm.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,aP.itemShape,t,w,S.state),s.addState(e?nP.selected:nP.unSelected),C.add(s)}let O=0;if(d){const e=R(g,"size",10);E=pm.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},g),{visible:!0,pickMode:"imprecise",boundsPadding:T})),this._appendDataToShape(E,aP.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=XM(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,aP.itemLabel,t,w,A.state),D.addState(e?nP.selected:nP.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=XM(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,aP.itemValue,t,w,k.state),r.addState(e?nP.selected:nP.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(),V=p(this.attribute.item.width)?this.attribute.item.width:z+T[1]+T[3],N=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=V,w.attribute.height=N,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 tP(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 tP(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 EM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:12},t),{width:e})):new EM(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=pm.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=eP,spaceRow:a=iP}=s,o=this._itemsContainer,{space:l=sP,defaultCurrent:h=1}=n,c=cP(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 _=pm.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(nP.selected)?this._setLegendItemState(t,nP.selectedHover,e):this._setLegendItemState(t,nP.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===aP.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(rP.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(nP.unSelectedHover)||t.hasState(nP.selectedHover))&&(i=!0),t.removeState(nP.unSelectedHover),t.removeState(nP.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(nP.unSelectedHover)&&!t.hasState(nP.selectedHover)||(i=!0),t.removeState(nP.unSelectedHover),t.removeState(nP.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===aP.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(rP.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(rP.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!==aP.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(rP.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!==aP.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(rP.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(nP.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({},dP,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(nP.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 pP;function gP(t){return y(t)?t:[t,t]}function mP(t){return t?"ew-resize":"ns-resize"}uP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:eP,spaceRow:iP,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:sP,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"}(pP||(pP={})),lP();class fP extends Sb{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({},fP.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"===P_.env?(P_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),P_.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"===P_.env?(P_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),P_.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"===P_.env?(P_.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),P_.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"===P_.env?(P_.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),P_.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:gP(d)[0],endValue:gP(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const m=pm.group({x:0,y:0});m.name=pP.innerView,this.add(m),this._innerView=m;let f,v=0;if(r&&r.visible){f=pm.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=pP.startText,m.add(f);const e=p(r.space)?r.space:0;v+=(g?f.AABBBounds.width():f.AABBBounds.height())+e}const _=pm.group({x:g?v:0,y:g?0:v});m.add(_);const y=pm.group({x:0,y:0});let b;if(y.name=pP.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=pm.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=pP.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=pm.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=pP.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]=gP(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":mP(p)},r));if(v.name=pP.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=f,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=pP.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":mP(p)},r));if(i.name=pP.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(m,"end");e.name=pP.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=pm.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=pP.trackContainer;const f=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===f?"pointer":mP(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=pm.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=pP.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return pm.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":mP(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),pm.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=pm.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=pm.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===pP.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===pP.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===pP.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===pP.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}}}fP.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}}},hP(),lP();class vP extends oP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},vP.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 _P(){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`}vP.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"}}},hP(),lP(),lM();class yP extends oP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},yP.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=pm.group({x:0,y:0});this._innerView.add(x);const S=new fP({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:_P(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=pm.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))}}yP.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)"}},iM(),bM(),gM();let bP=class t extends Sb{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,V,N,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},wM),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},wM),$),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!==(V=K.width)&&void 0!==V?V: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!==(N=$.width)&&void 0!==N?N: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"))}}}};bP.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 xP={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"}}};iM(),bM(),gM();let SP=class extends Sb{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==e)return void(o&&o.hideAll());if(p(i))if(!1!==i.visible){const t=z({},R(xP,"title.style"),i.style);UM(t)?this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},KM(t)),{visible:i.visible,x:0,y:0}),"richtext"):this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},t),{lineHeight:p(t.lineHeight)?t.lineHeight:t.fontSize,visible:i.visible,x:0,y:0}),"text"),i.autoFit&&k(a)&&this._setLocalAutoFit(a,this._title,i),i.autoLimit&&k(r)&&this._title.setAttribute("maxLineWidth",a)}else{const t=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}if(p(s)){const t=Y(s),e=[];t.forEach(((t,s)=>{if(!1!==t.visible){const n=z({},R(xP,"content.style"),t.style);let l;l=UM(n)?o.createOrUpdateChild("indicator-content-"+s,Object.assign(Object.assign({},KM(n)),{visible:i.visible,x:0,y:0}),"richtext"):o.createOrUpdateChild("indicator-content-"+s,Object.assign(Object.assign({},n),{lineHeight:p(n.lineHeight)?n.lineHeight:n.fontSize,visible:t.visible,x:0,y:0}),"text"),t.autoFit&&k(a)&&this._setLocalAutoFit(a,l,t),t.autoLimit&&k(r)&&l.setAttribute("maxLineWidth",a),e.push(l)}else{const t=o.find((t=>t.name==="indicator-content-"+s),!1);t&&o.removeChild(t)}})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.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=WM(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 AP extends yg{constructor(t){super(t)}}var kP,MP;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(kP||(kP={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(MP||(MP={}));class TP extends Sb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},TP.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"},TP.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"},TP.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},TP.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},TP.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 AP(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new AP(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new AP(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(kP.OnPlay)},this.pause=()=>{this._dispatchEvent(kP.OnPause)},this.forward=()=>{this._dispatchEvent(kP.OnForward)},this.backward=()=>{this._dispatchEvent(kP.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()}}TP.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},TP.defaultAttributes={[MP.Start]:{},[MP.Pause]:{},[MP.Backward]:{},[MP.Forward]:{}};const wP={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},CP=[200,10];var EP,PP;!function(t){t.Default="default",t.Reverse="reverse"}(EP||(EP={})),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"}(PP||(PP={}));const BP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===EP.Default&&s===i})({direction:e,maxIndex:i,dataIndex:n})||(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===EP.Reverse&&s===i})({direction:e,minIndex:s,dataIndex:n})},RP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===EP.Default&&s===i})({direction:e,minIndex:s,dataIndex:n})||(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===EP.Reverse&&s===i})({direction:e,maxIndex:i,dataIndex:n})},LP=t=>"top"===t||"bottom"===t;class OP extends Sb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},OP.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(LP(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:CP[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:CP[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 fP(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 LP(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 TP(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=LP(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:CP[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?(LP(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:LP(this._orient)?t+s:(this._size.width-r)/2,y:LP(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:LP(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:LP(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:LP(this._orient)?t+s:(this._size.width-r)/2,y:LP(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 IP(){lP(),iM(),_M()}OP.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({},wP),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},wP),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},wP),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},wP),{key:"backward",position:"start"})}},IP();class DP extends OP{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:EP.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(kP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(kP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(kP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(kP.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(PP.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(BP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||RP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===EP.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(PP.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=P_.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(PP.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(PP.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=P_.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(),P_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(PP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,P_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(PP.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(PP.change),this.dispatchCustomEvent(PP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var FP,jP=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())}))};IP();class zP extends OP{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(kP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(kP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(kP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(kP.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(PP.change))},this.play=()=>jP(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(PP.play),this._rafId=P_.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=P_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,P_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(PP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,P_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(PP.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(PP.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(PP.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"}(FP||(FP={}));const HP={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}},VP=5;const NP={debounce:xt,throttle:St};iM(),cM();let GP=class t extends Sb{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:NP[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(FP.brushClear,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._container.incrementalClearChild(),this._brushMaskAABBBoundsDict={}):(this._activeDrawState&&this._dispatchEvent(FP.drawEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._activeMoveState&&this._dispatchEvent(FP.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=HP.trigger,updateTrigger:e=HP.updateTrigger,endTrigger:i=HP.endTrigger,resetTrigger:s=HP.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(FP.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(FP.moveStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_drawing(t){var e,i;const s=this.eventPosToStagePos(t),{sizeThreshold:n=VP,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(FP.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(FP.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=pm.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)})},UP=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}},YP={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:kM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:kM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:kM,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},KP=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];iM(),uM(),_M(),bM(),gM();let XP=class t extends Sb{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:BM(u)&&BM(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:BM(u)&&BM(u.value)},UP(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:BM(u)&&BM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:BM(u)&&BM(u.value)},UP(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},wM),u.value),visible:BM(u)&&BM(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=BM(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 _=BM(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(!BM(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)+(BM(n.key)?r+n.key.spacing:0)+(BM(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&&($M(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:BM(n.key)||"right"===c||(t="left"),m.setAttribute("textAlign",t),$M(c,m,t,u,a),m.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(BM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Fc(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(BM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},UP(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},UP(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},wM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(BM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},UP(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},UP(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=>KP.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)&&BM(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=BM(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=GM(u),y=GM(p);let b=0;if(BM(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(BM(p)){const{width:t,height:e}=y.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}f&&mg[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 WP({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return WP({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};XP.defaultAttributes=YP;const $P=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 ZP(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function JP(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function QP(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 tB(t,e){const i=QP(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 eB(t,e){const i=iB(t),s=iB(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 iB(t,e={x:0,y:0}){return qt.distancePP(t,e)}function sB(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 nB(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const rB=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var oB,lB;!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"}(oB||(oB={})),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.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(lB||(lB={}));const hB="__VCHART",cB=500,dB=500,uB=`${hB}_LABEL_LIMIT`,pB=`${hB}_LABEL_ALIGN`,gB=`${hB}_LABEL_TEXT`,mB=`${hB}_LABEL_VISIBLE`,fB=`${hB}_LABEL_X`,vB=`${hB}_LABEL_Y`,_B=`${hB}_ARC_TRANSFORM_VALUE`,yB=`${hB}_ARC_RATIO`,bB=`${hB}_ARC_START_ANGLE`,xB=`${hB}_ARC_END_ANGLE`,SB=`${hB}_ARC_K`,AB=`${hB}_ARC_MIDDLE_ANGLE`,kB=`${hB}_ARC_QUADRANT`,MB=`${hB}_ARC_RADIAN`,TB=-Math.PI/2,wB=3*Math.PI/2,CB=-90,EB=.6;var PB,BB,RB,LB,OB,IB,DB,FB,jB,zB,HB,VB,NB,GB,WB;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(PB||(PB={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(BB||(BB={})),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"}(RB||(RB={})),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"}(LB||(LB={})),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"}(OB||(OB={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(IB||(IB={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(DB||(DB={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(FB||(FB={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(jB||(jB={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(zB||(zB={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(HB||(HB={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(VB||(VB={})),t.VGRAMMAR_HOOK_EVENT=void 0,(NB=t.VGRAMMAR_HOOK_EVENT||(t.VGRAMMAR_HOOK_EVENT={})).BEFORE_EVALUATE_DATA="beforeEvaluateData",NB.AFTER_EVALUATE_DATA="afterEvaluateData",NB.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",NB.AFTER_EVALUATE_SCALE="afterEvaluateScale",NB.BEFORE_PARSE_VIEW="beforeParseView",NB.AFTER_PARSE_VIEW="afterParseView",NB.BEFORE_TRANSFORM="beforeTransform",NB.AFTER_TRANSFORM="afterTransform",NB.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",NB.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",NB.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",NB.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",NB.BEFORE_STAGE_RESIZE="beforeStageResize",NB.AFTER_STAGE_RESIZE="afterStageResize",NB.BEFORE_VRENDER_DRAW="beforeVRenderDraw",NB.AFTER_VRENDER_DRAW="afterVRenderDraw",NB.BEFORE_MARK_JOIN="beforeMarkJoin",NB.AFTER_MARK_JOIN="afterMarkJoin",NB.BEFORE_MARK_UPDATE="beforeMarkUpdate",NB.AFTER_MARK_UPDATE="afterMarkUpdate",NB.BEFORE_MARK_STATE="beforeMarkState",NB.AFTER_MARK_STATE="afterMarkState",NB.BEFORE_MARK_ENCODE="beforeMarkEncode",NB.AFTER_MARK_ENCODE="afterMarkEncode",NB.BEFORE_DO_LAYOUT="beforeDoLayout",NB.AFTER_DO_LAYOUT="afterDoLayout",NB.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",NB.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",NB.BEFORE_DO_RENDER="beforeDoRender",NB.AFTER_DO_RENDER="afterDoRender",NB.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",NB.AFTER_MARK_RENDER_END="afterMarkRenderEnd",NB.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",NB.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",NB.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",NB.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",NB.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",NB.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",NB.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",NB.BEFORE_ELEMENT_STATE="beforeElementState",NB.AFTER_ELEMENT_STATE="afterElementState",NB.BEFORE_ELEMENT_ENCODE="beforeElementEncode",NB.AFTER_ELEMENT_ENCODE="afterElementEncode",NB.ANIMATION_START="animationStart",NB.ANIMATION_END="animationEnd",NB.ELEMENT_ANIMATION_START="elementAnimationStart",NB.ELEMENT_ANIMATION_END="elementAnimationEnd",NB.ALL_ANIMATION_START="allAnimationStart",NB.ALL_ANIMATION_END="allAnimationEnd",function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(GB||(GB={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(WB||(WB={}));const UB="__vgrammar_scene_item__",YB=[RB.line,RB.area],KB=[RB.arc3d,RB.rect3d,RB.pyramid3d],XB="key",$B=[{}],qB=["key"],ZB=!0,JB=!0,QB=!1,tR=!0,eR="VGRAMMAR_IMMEDIATE_ANIMATION",iR=0,sR=1e3,nR=0,rR=0,aR=!1,oR=!1,lR="quintInOut",hR={stopWhenStateChange:!1,immediatelyApply:!0};function cR(t,e){return Y(t).reduce(((t,i)=>{const s=_(i)?e.getGrammarById(i):i;return s&&t.push(s),t}),[])}function dR(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 cR(t.dependency,e);var i;return[]}function uR(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function pR(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 gR(t,e){return mR(t)?t.output():e[t]}const mR=t=>t&&!u(t.grammarType),fR=t=>d(t)?t:e=>e[t];function vR(t){return!!(null==t?void 0:t.scale)}function _R(t){return!!(null==t?void 0:t.field)}function yR(t,e){if(!t)return[];let i=[];return t.scale&&(i=mR(t.scale)?[t.scale]:Y(e.getScaleById(t.scale))),i.concat(dR(t,e))}function bR(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 xR(t,e,i,s,n){i&&(uR(i)?e.forEach((e=>{const n=pR(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 RB.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case RB.group:case RB.rect:case RB.image:return["width","height","y1"].includes(e);case RB.path:case RB.shape:return["path","customPath"].includes(e);case RB.line:return"defined"===e;case RB.area:return["x1","y1","defined"].includes(e);case RB.rule:return["x1","y1"].includes(e);case RB.symbol:return"size"===e;case RB.polygon:return"points"===e;case RB.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(vR(l)){const t=gR(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?cb(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(_R(l)){const t=cb(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=pR(l,s,e.datum,t)}))})))}function SR(t,e,i,s){if(!t)return null;if(uR(t))return pR(t,s,e,i);const n={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(vR(h)){const t=gR(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?cb(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(_R(h)){const t=cb(h.field);n[r]=t(e)}else n[r]=pR(h,s,e,i)})),n}class AR{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 kR=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]}};kR._plotMarks={},kR._marks={},kR._components={},kR._graphicComponents={},kR._transforms={},kR._grammars={},kR._glyphs={},kR._animations={},kR._interactions={},kR._graphics={},kR.registerGlyph=(t,e,i,s,n)=>(kR._glyphs[t]=new AR(e,i,s,n),kR._glyphs[t]),kR.registerAnimationType=(t,e)=>{kR._animations[t]=e},kR.getAnimationType=t=>kR._animations[t],kR.registerInteraction=(t,e)=>{kR._interactions[t]=e},kR.registerGraphic=(t,e)=>{kR._graphics[t]=e},kR.getGraphicType=t=>kR._graphics[t],kR.createGraphic=(t,e)=>{const i=kR._graphics[t];return i?i(e):null};const MR=t=>!!RB[t];function TR(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var s;const n=kR.getGraphicType(e)?kR.createGraphic(e,i):kR.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 wR=t=>{t&&(t[UB]=null,t.release(),t.parent&&t.parent.removeChild(t))},CR=["fillOpacity"],ER=(t,e,i)=>{var s;return"fillOpacity"===e?(t.fillOpacity=null!==(s=i.fillOpacity)&&void 0!==s?s:1,["fillOpacity"]):[]};const PR={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"}],[RB.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"}],[RB.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"}],[RB.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 BR=(t,e,i,s)=>{const n={},r=e?Object.keys(e):[],a=_(t)?PR[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||(CR.includes(r)?ER(n,r,e):n[r]=e[r])}))}else r.forEach((t=>{CR.includes(t)?ER(n,t,e):n[t]=e[t]}));return n},RR=(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),LR=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],OR=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(LR);function IR(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)?OR:LR,r=[];let a=null;return t.forEach(((t,e)=>{a&&n.every((e=>RR(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=DR(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function DR(t){const e={};return t?(Object.keys(t).forEach((i=>{"x"!==i&&"y"!==i&&"x1"!==i&&"y1"!==i&&"defined"!==i&&"size"!==i&&"width"!==i&&"height"!==i&&"context"!==i&&(e[i]=t[i])})),e):e}let FR=class{constructor(t){this.data=null,this.states=[],this.diffState=BB.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:{}})));xR(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?BR(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[UB]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?BR(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t)))}updateGraphicItem(){if(!this.graphicItem)return;this.diffState===BB.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&&(wR(this.graphicItem),this.graphicItem[UB]=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=fR(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(pR(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===BB.unChange&&(this.diffState=BB.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&(this.mark.isCollectionMark()&&delete t.defined,Object.assign(e,t)),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==BB.enter&&this.diffState!==BB.update||!this.states.length||this.useStates(this.states),this.mark.markType===RB.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 cl))}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[PB.update],a=e[PB.enter],o=e[PB.exit],l=this.mark.isLargeMode()||n&&!this.mark.getSpec().enableSegments;this.diffState===BB.enter?(a&&xR(this,t,a,s,l),r&&xR(this,t,r,s,l)):this.diffState===BB.update?((n&&a||i)&&xR(this,t,a,s,l),r&&xR(this,t,r,s,l)):this.diffState===BB.exit&&o&&(i&&xR(this,t,a,s,l),xR(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)gb(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[RB.line,RB.area,RB.largeRects,RB.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(s=l.nextAttrs)||void 0===s?void 0:s.points)&&(!0===i||bR(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[PB.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=DR(h),e===RB.line||e===RB.area){const i=function(t,e,i,s){return t&&t.length&&(1!==t.length||e)?t.some((t=>bR(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===RB.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=IR(e.items,e.points,i);if(s)return void s.forEach((e=>{t.push(e)}))}const n=DR(e.items[0]);n.points=e.points,t.push(n)})),t}return s?IR(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=SR(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=IR(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t)}else h.points=i,h.segments=null}else e===RB.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===RB.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}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&&(wR(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 jR{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 zR=(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 HR extends jR{constructor(t,e){super(t,e),this.type=HR.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({},HR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=zR(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()}}HR.type="element-select",HR.defaultOptions={state:WB.selected,trigger:"click"};class VR extends jR{constructor(t,e){super(t,e),this.type=VR.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},VR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=zR(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 NR(t){if(t)return t.type===Pw.Band?t.bandwidth():t.type===Pw.Point?t.step():void 0}VR.type="element-highlight",VR.defaultOptions={highlightState:WB.highlight,blurState:WB.blur,trigger:"pointerover",triggerOff:"pointerout"};class GR{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 WR=()=>{U(HR,GR),kR.registerInteraction(HR.type,HR)},UR=()=>{U(VR,GR),kR.registerInteraction(VR.type,VR)},YR=(t,e)=>mR(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,KR=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,s)=>{const n=t[s];return i[s]=YR(n,e),i}),{}):t.map((t=>YR(t,e))):t;let XR=-1;class $R extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++XR}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(dR(this.spec[e],this.view)),this.spec[e]=t,this.attach(dR(t,this.view)),this.commit(),this}}const qR=(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=dR(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}},ZR=(t,e)=>{const i=kR.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(cR(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(y(e)){const s=e.map((e=>qR(t,e,i)));return{references:s.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:s.map((t=>t.value))}}return qR(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}},JR=(t,e)=>{if(null==t?void 0:t.length){const i=[];let s=[];return t.forEach((t=>{var n;const r=ZR(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},QR={csv:Yr,dsv:Ur,tsv:Kr,json:function(t){if(!_(t))return Y(t);try{return Y(JSON.parse(t))}catch(t){return[]}}};class tL extends $R{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||!QR[e.type])return Y(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return QR[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?dR(t.format,this.view)[0]:null;if(s&&e.push(s),t.values){const s=dR(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=dR(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=mR(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=JR(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=JR(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 eL="window",iL="view",sL={trap:!1},nL="width",rL="height",aL="viewWidth",oL="viewHeight",lL="padding",hL="viewBox",cL="autoFit";function dL(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 uL(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,dL(t,e,n,s)}class pL{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 dL(this.nodes,e,0,this.compare),uL(this.nodes,e,null,this.compare)}return this.nodes.push(t),dL(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)),dL(this.nodes,e,0,this.compare),uL(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,uL(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class gL{constructor(t){this.list=[],this.ids={},this.idFunc=t||db}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 mL{constructor(){this.grammars=[],this.logger=at.getInstance(),this._curRank=0,this._committed=new gL((t=>t.uid)),this._heap=new pL(((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 gL((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 fL=(t,e,i,s,n)=>{const r=t=>{if(n||!t||s&&!s(t)||i.call(null,t),t.markType===RB.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}n&&(!t||s&&!s(t)||i.call(null,t))};r(t)};class vL{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 $d(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Il.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 J_(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 $b(o)),null===(r=this._eventConfig)||void 0===r?void 0:r.gesture){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new Jb(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 _L(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 yL(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 bL(t,e,i,s,n){if(n===eL){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{yL(t,_L(t),!1)}))}));const e=_L(t);yL(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e}class xL extends $R{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?pR(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}},ML=(t,e)=>e&&e.debounce?xt(t,e.debounce):e&&e.throttle?St(t,e.throttle):t;class TL extends FR{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 xR(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[UB]=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?BR(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);this.graphicItem||this.initGraphicItem(),this.diffState===BB.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==BB.enter&&this.diffState!==BB.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.diffState===BB.enter&&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=BR(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=PR[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===RB.shape&&(o.datum=d[0].datum)})),s}}_generateGlyphItems(t,e,i){const s=e.map((t=>Object.assign({},t,{nextAttrs:i})));return YB.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)gb(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[UB]=null})),this.glyphGraphicItems=null),super.release()}}const wL=t=>t.markType===RB.glyph?new TL(t):new FR(t);function CL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(XB,i?t.slice().sort(i):t.slice()),{keys:qB,data:s};const n=fR(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 EL{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?CL(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 PL=(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=bR(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=bR(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 BL=(t,e,i,s,n)=>d(i)?i(t.getDatum(),t,n):i;class RL extends mc{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 LL extends mc{getEndProps(){return this.to}onBind(){var t;const e=null!==(t=this.target.constructor.NOWORK_ANIMATE_ATTR)&&void 0!==t?t:Fd,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)}}vc.mode|=ko.SET_ATTR_IMMEDIATELY;let OL=0;const IL=t=>!u(t)&&(t.prototype instanceof mc||"onBind"in t.prototype&&"onStart"in t.prototype&&"onEnd"in t.prototype&&"onUpdate"in t.prototype);class DL{constructor(t,e,i){this.id=OL++,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||!kR.getAnimationType(e.type))return null;const r=kR.getAnimationType(e.type)(t,n,i);return PL(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?BL(t,0,n[i].from,0,s):void 0,e.to[i]=l?BL(t,0,n[i].to,0,s):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),PL(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=IL(o);return u(o)||IL(o)?h?new o(r.from,r.to,a,t.easing,l):r.to?new LL(r.from,r.to,a,t.easing):void 0:new RL(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 Uc(a,e))}r>0&&t.wait(r)}}function FL(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(jL(i,t[i]))})),e}function jL(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:iR,totalTime:h.totalTime,oneByOne:null!==(i=h.oneByOne)&&void 0!==i?i:oR,loop:null!==(s=h.loop)&&void 0!==s?s:aR,controlOptions:z({},hR,null!==(n=h.controlOptions)&&void 0!==n?n:{}),timeSlices:[{duration:null!==(r=h.duration)&&void 0!==r?r:sR,delay:null!==(a=h.delay)&&void 0!==a?a:nR,delayAfter:null!==(o=h.delayAfter)&&void 0!==o?o:rR,effects:[{type:h.type,channel:h.channel,custom:h.custom,easing:null!==(l=h.easing)&&void 0!==l?l:lR,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:iR,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:oR,loop:null!==(d=t.loop)&&void 0!==d?d:aR,controlOptions:z({},hR,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:nR,delayAfter:null!==(i=t.delayAfter)&&void 0!==i?i:rR,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:lR,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 zL(t,e,i){return d(t)?t.call(null,e.getDatum(),e,i):t}class HL{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 VL{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=FL(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=FL(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!==BB.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 HL(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=jL(eR,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 HL(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===BB.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 DL(s,i,e);if(l.animate(n,r),!l.isAnimating)return;s.diffState===BB.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=pR(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,s,n){const r=[],a=zL(t.startTime,e,n),o=zL(t.totalTime,e,n),l=zL(t.oneByOne,e,n),h=zL(t.loop,e,n);let c=0;t.timeSlices.forEach((t=>{var i;const a=zL(t.delay,e,n),l=zL(t.delayAfter,e,n),h=null!==(i=zL(t.duration,e,n))&&void 0!==i?i:o/s,d=Y(t.effects).map((t=>Object.assign({},t,{customParameters:zL(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===BB.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===BB.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===eR,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===BB.exit&&0===o[BB.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 NL extends $R{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new VL(this,{}),this.differ=new EL([]),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===BB.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(e,i){var s;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===VB.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:$B,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===RB.group)return;const e=CL(null!=t?t:$B,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(BB.update,t,e,i)}encodeState(t,e,i,s){if(t===BB.enter&&(this._isReentered=!0),this.spec.encode[t]){const n=this.spec.encode[t];if(uR(n))this.detach(yR(n,this.view));else{const r=_(e);r&&s||!r&&i?(Object.keys(n).forEach((t=>{this.detach(yR(n[t],this.view))})),this.spec.encode[t]={}):r?this.detach(yR(n[e],this.view)):Object.keys(e).forEach((t=>{this.detach(yR(n[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),_(e)?(this.spec.encode[t][e]=i,this.attach(yR(i,this.view))):uR(e)?(this.spec.encode[t]=e,this.attach(yR(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(yR(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=JR(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=JR(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 YB.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!==BB.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===GB.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&&!uR(n)&&Object.keys(n).forEach((t=>{vR(n[t])&&(e[t]=gR(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];uR(s)||Object.keys(s).forEach((t=>{_R(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[UB];if((null==s?void 0:s.mark)===this){const i=bL(this.view,t,s,0,iL);this.emitGrammarEvent(e,i,s)}},this.initEvent()),this.animate||(this.animate=new VL(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=gR(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!==RB.group){if(!this.graphicItem){const t=TR(this,RB.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||KB.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||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==RB.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=fR(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:()=>XB),a=fR(null!==(n=this.spec.groupBy)&&void 0!==n?n:()=>XB),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===BB.enter))),c=[];this.differ.setCallback(((t,e,i)=>{const s=t;let n;if(u(e))n=this.elementMap.get(s),n&&(n.diffState=BB.exit);else if(u(i)){n=this.elementMap.has(s)?this.elementMap.get(s):wL(this),n.diffState===BB.exit&&(n.diffState=BB.enter,this.animate.getElementAnimators(n,BB.exit).forEach((t=>t.stop("start")))),n.diffState=BB.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=BB.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:$B;l||this.differ.setCurrentData(CL(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]=SR(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[PB.group],s);e.forEach((t=>{this.markType===RB.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._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:TR(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!==RB.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=fR(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:()=>XB),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=wL(this);e.diffState=BB.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=wL(this);i.diffState=BB.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!==RB.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=TR(this,RB.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!==BB.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:PR[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=BB.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&&wR(this.graphicItem),this.detachAll(),super.release()}}let GL=class extends NL{constructor(t,e){super(t,RB.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===RB.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 PR.rect}evaluateJoin(t){if(!this.elements.length){const t=wL(this);t.updateData(XB,$B,(()=>""),this.view),this.elements=[t],this.elementMap.set(XB,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 xR(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[PB.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:TR(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 WL(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 UL(t,e){return Math.min(t<0?t+e:t-1,e)}function YL(t,e,i){let s=UL(t,i),n=UL(e,i);if(k(t)||k(e)?k(t)?k(e)||(s=UL(Math.max(0,n-1),i)):n=UL(s+1,i):(s=1,n=2),s>n){const t=n;n=s,s=t}return{start:s,end:n}}const KL=(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=>WL(t,i))),u=l.map((t=>WL(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}=YL(e,i,r),{start:h,end:c}=YL(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()}))},XL={[LB.axis]:0,[LB.legend]:1,[LB.slider]:2,[LB.player]:3,[LB.datazoom]:4},$L=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=XL[t.componentType])&&void 0!==s?s:1/0},qL=(t,e,i,s)=>{const n=i.clone(),r=t.getSpec().layout,a=mb(r.maxChildWidth,n.width()),o=mb(r.maxChildHeight,n.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=kL(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&&d$L(t)-$L(e)));for(let t=0,e=f.length;t{null==t||t.forEach((t=>{var s;if(t.markType!==RB.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=qL(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(aL,o),i.updateSignal(oL,l),i.updateSignal(lL,h)}else qL(t,n,a,e);else"grid"===r.display&&KL(t,n,a);ZL(n,e,i)}}))};class JL extends NL{constructor(t,e,i){super(t,RB.glyph,i),this.glyphType=e,this.glyphMeta=kR.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(!kR.getGraphicType(RB.glyph))return;const s=kR.createGraphic(RB.glyph,i),n=e.getMarks(),r=Object.keys(n).map((t=>{if(kR.getGraphicType(n[t])){const e=kR.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 QL=Symbol.for("key");class tO{diffGrammar(t,e){return function(t,e,i){const s={enter:[],exit:[],update:[]},n=new EL(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(CL(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!==RB.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==RB.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=CL(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=CL(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=fR(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 EL(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(CL(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:QL})),r=CL(e,(t=>{var e;return null!==(e=s(t))&&void 0!==e?e:QL}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==QL){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=pR(i.animation.delay,n,o,l),d=pR(i.animation.duration,n,o,l),u=pR(i.animation.oneByOne,n,o,l),p=pR(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)?Td:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:wd)(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);Sd(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)?Td:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:wd)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>_d(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>bd(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 xd({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Sc,null!==(l=i.easing)&&void 0!==l?l:Ac))}))}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 Ad({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Sc,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Ac))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Sd(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 eO{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 iO extends eO{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===RB.group&&s.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===RB.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=>{const s=t.mark;s.markType===RB.group&&s.includesChild(e,!1)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===RB.group&&e.includesChild(s,!1)&&(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 sO{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 nO extends NL{addGraphicItem(t,e){const i=t&&t.limitAttrs,s=TR(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?RB.richtext:RB.text,t);return super.addGraphicItem(t,e,s)}release(){super.release()}}nO.markType=RB.text;const rO={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)"}}},aO={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},oO=Object.assign({},rO);oO.axis=Object.assign({},oO.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),oO.circleAxis=Object.assign({},oO.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),oO.grid=Object.assign({},oO.grid,{style:{stroke:"#404349"}}),oO.circleGrid=Object.assign({},oO.circleGrid,{style:{stroke:"#404349"}}),oO.rectLabel=Object.assign({},oO.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),oO.lineLabel=Object.assign({},oO.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),oO.symbolLabel=Object.assign({},oO.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),oO.title=Object.assign({},oO.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const lO={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:aO,components:oO},hO={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:aO,components:rO};let cO=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")}};cO._themes=new Map,cO.registerTheme("default",hO),cO.registerTheme("dark",lO);class dO extends NL{constructor(t,e,i,s){super(t,RB.component,i),this._componentDatum={[XB]: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:kR.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,XB)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[XB]+=1}evaluateJoin(t){return this.spec.key=XB,t?(t[XB]=this._componentDatum[XB],this._componentDatum=t):this._componentDatum={[XB]:this._componentDatum[XB]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}class uO 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[UB],n=bL(0,t,s,0,iL);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(mR(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)):MR(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 xL(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 tL(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=kR.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=kR.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 RB.group:n=new GL(this,s);break;case RB.glyph:n=new JL(this,null==i?void 0:i.glyphType,s);break;case RB.component:n=kR.hasComponent(null==i?void 0:i.componentType)?kR.createComponent(null==i?void 0:i.componentType,this,s,null==i?void 0:i.mode):new dO(this,null==i?void 0:i.componentType,s,null==i?void 0:i.mode);break;case RB.text:n=new nO(this,t,s);break;default:n=kR.hasMark(t)?kR.createMark(t,this,s):new NL(this,t,s)}return this.grammars.record(n),this._dataflow.add(n),n}group(t){return this.mark(RB.group,t)}glyph(t,e){return this.mark(RB.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(RB.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(RB.component,t,{componentType:LB.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(RB.component,t,{componentType:LB.grid,mode:e})}legend(t){return this.mark(RB.component,t,{componentType:LB.legend})}slider(t){return this.mark(RB.component,t,{componentType:LB.slider})}label(t){return this.mark(RB.component,t,{componentType:LB.label})}datazoom(t){return this.mark(RB.component,t,{componentType:LB.datazoom})}player(t){return this.mark(RB.component,t,{componentType:LB.player})}title(t){return this.mark(RB.component,t,{componentType:LB.title})}scrollbar(t){return this.mark(RB.component,t,{componentType:LB.scrollbar})}customized(t,e){const i=kR.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&&AL.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&(wR(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_"+ ++SL;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(cO.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(nL,t.width),this.updateSignal(rL,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=kR.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=VB.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var s,n,r,a,o;return[{id:nL,value:null!==(s=t[nL])&&void 0!==s?s:0},{id:rL,value:null!==(n=t[rL])&&void 0!==n?n:0},{id:lL,value:kL(null!==(a=null!==(r=t[lL])&&void 0!==r?r:e[lL])&&void 0!==a?a:null==i?void 0:i.padding)},{id:aL,update:{callback:(t,e)=>{const i=kL(e[lL]);return e[nL]-i.left-i.right},dependency:[nL,lL]}},{id:oL,update:{callback:(t,e)=>{const i=kL(e[lL]);return e[rL]-i.top-i.bottom},dependency:[rL,lL]}},{id:hL,update:{callback:(t,e)=>{const i=kL(e[lL]);return(t||new Jt).setValue(i.left,i.top,i.left+e[aL],i.top+e[oL])},dependency:[aL,oL,lL]}},{id:cL,value:null!==(o=t[cL])&&void 0!==o?o:e[cL]}]})(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===RB.glyph?{glyphType:t.glyphType}:t.type===RB.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=cO.getTheme(t))&&void 0!==e?e:cO.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(nL);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(rL);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(aL);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(oL);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(lL);if(arguments.length){const i=kL(t);return this.updateSignal(e,i),i}return kL(e.output())}autoFit(t){const e=this.getSignalById(cL);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(hL);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=VB.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===RB.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var e;const i=this._options.doLayout||ZL;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=>{fL(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),fL(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=ZB,morph:o=JB,morphAll:l=QB,animation:h={},enableExitAnimation:c=tR}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:lR,delay:null!==(i=h.delay)&&void 0!==i?i:nR,duration:null!==(s=h.duration)&&void 0!==s?s:sR,oneByOne:null!==(n=h.oneByOne)&&void 0!==n?n:oR,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=VB.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=VB.reevaluate,this._dataflow.evaluate()),this._layoutState=VB.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=>!AL.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 fL(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(nL,t)),e!==this.height()&&(s=!0,this.updateSignal(rL,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]:iL;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):MR(t)?(i.markType=t,i.source=e):i.source=t===eL?eL: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=cR(l,this),v=ML(((t,e)=>{const s=c===iL&&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===eL&&(t=bL(0,t,e,0,eL));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===iL){if(function(t,e,i){const s=null==t?void 0:t[e];return!(!1===s||g(s)&&!s[i])}(this._eventConfig,iL,d))return this.addEventListener(d,v,sL),()=>{this.removeEventListener(d,v)}}else if(c===eL)return P_.addEventListener(d,v),this._eventListeners.push({type:d,source:P_,handler:v}),()=>{P_.removeEventListener(d,v);const t=this._eventListeners.findIndex((t=>t.type===d&&t.source===P_&&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=kR.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 vL(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e;this.grammars=new eO((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new iO((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 mL,this.animate=new sO(this),this._morph=new tO,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,[iL,eL]),e}(this._options.eventConfig),this._theme=this._options.disableTheme?null:cO.getDefaultTheme(),this.parseBuiltIn(),(e=this._options).mode&&P_.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=VB.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!==RB.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=P_.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&P_.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(),kR.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 pO=()=>{fM(),lM(),kR.registerGraphic(RB.path,Ng)},gO=()=>{fM(),uM(),kR.registerGraphic(RB.rect,Tg)},mO=()=>{fM(),aM(),kR.registerGraphic(RB.rule,Ag)},fO=()=>{fM(),_M(),kR.registerGraphic(RB.symbol,bg)},vO=()=>{fM(),bM(),gM(),kR.registerGraphic(RB.text,mp)},_O=()=>{fM(),tM(),kR.registerGraphic(RB.glyph,Cg)},yO=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},bO=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},xO=(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(yb(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},SO=(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&&yb(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},AO=yO(xO),kO=bO(xO);const MO=(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(yb(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},TO=(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&&yb(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},wO=yO(MO),CO=bO(MO);const EO=(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`},PO=(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`},BO=(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)?PO:EO,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)}}:{}},RO=(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}},LO=(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})}},OO=(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 IO extends dO{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 DO=(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 FO extends IO{constructor(t,e,i){super(t,LB.axis,e),this.spec.componentType=LB.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=kR.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=SR(n,e,i,s);const h=pR(this.spec.inside,s,e,i),c=pR(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(DO(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=pR(this.spec.tickCount,s,e,i);switch(this._getAxisComponentType()){case IB.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 IB.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?IB.circleAxis:IB.lineAxis,this._axisComponentType}}FO.componentType=LB.axis;let jO=class extends dO{constructor(t,e){super(t,LB.label,e),this.spec.componentType=LB.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=pR(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=pR(s,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case RB.line:case RB.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case RB.rect:case RB.rect3d:case RB.interval:g=p.rectLabel;break;case RB.symbol:case RB.circle:case RB.cell:g=p.symbolLabel;break;case RB.arc:case RB.arc3d:g=p.arcLabel;break;case RB.polygon:case RB.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=SR(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=SR(i,t,e,d);m.push(z({},f,s))}));else{const t=SR(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}};jO.componentType=LB.label;const zO=()=>{kR.registerGraphicComponent(LB.label,(t=>new $T(t))),kR.registerComponent(LB.label,jO)};class HO extends IO{constructor(t,e,i){super(t,LB.grid,e),this.spec.componentType=LB.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=kR.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=SR(s,t,e,i);const d=pR(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 DB.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 DB.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=pR(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(DO(h,n,s,d,this.spec.layout,!0),c))}this._getGridComponentType()===DB.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=pR(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case DB.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 DB.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=DB.circleAxisGrid:this._gridComponentType=DB.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case IB.circleAxis:this._gridComponentType=DB.circleAxisGrid;break;case IB.lineAxis:default:this._gridComponentType=DB.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()?DB.lineAxisGrid:DB.circleAxisGrid:DB.lineAxisGrid}else this._gridComponentType=DB.lineAxisGrid;return this._gridComponentType}}HO.componentType=LB.grid;const VO=(t,e,i)=>e.filter((e=>t.callback(e,i))),NO=(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 GO(t){return t.reduce(((t,e)=>t+e),0)}const WO={min:$,max:X,average:function(t){return 0===t.length?0:GO(t)/t.length},sum:GO};function UO(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 YO(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 KO(t,e,i,s){return YO(t,e,i,"min",s)}function XO(t,e,i,s){return YO(t,e,i,"max",s)}function $O(t,e,i,s){return YO(t,e,i,"average",s)}function qO(t,e,i,s){return YO(t,e,i,"sum",s)}const ZO=(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=UO;if("min"===n?l=KO:"max"===n?l=XO:"average"===n?l=$O:"sum"===n&&(l=qO),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[]},JO="_mo_hide_";const QO=(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(JO)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(JO,!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(JO,!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},tI=()=>{kR.registerTransform("filter",{transform:VO,markPhase:"beforeJoin"},!0)},eI=()=>{kR.registerTransform("map",{transform:NO,markPhase:"beforeJoin"},!0)},iI=()=>{kR.registerTransform("sampling",{transform:ZO,markPhase:"afterEncode"},!0)},sI=()=>{kR.registerTransform("markoverlap",{transform:QO,markPhase:"afterEncode"},!0)},nI=(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}}},rI=(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}}},aI=(t,e,i)=>{var s,n,r,a;const o=null!==(s=t.getFinalGraphicAttributes())&&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}}},oI=(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}}},lI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("y",!1),i=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1),n=t.getGraphicAttribute("y",!1),r=t.getGraphicAttribute("y1",!1),a=t.getGraphicAttribute("height",!1),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}}}}},hI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("y",!1),i=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("x1",!1),n=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicAttribute("height",!1),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 cI=(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.getGraphicAttribute("x",!1),r=t.getGraphicAttribute("x1",!1),a=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);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 dI=(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.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);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 uI=(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.getGraphicAttribute("y",!1),r=t.getGraphicAttribute("y1",!1),a=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("y",!1),n=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);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 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.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("y",!1),n=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);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)},gI=(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.getFinalGraphicAttributes();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.getFinalGraphicAttributes();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)},mI=(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.getFinalGraphicAttributes();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)},fI=(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.getFinalGraphicAttributes(),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.getFinalGraphicAttributes();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)},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=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.getFinalGraphicAttributes();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)},_I=(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((()=>Object.assign(n)))},yI=(t,e,i)=>({from:{points:_I(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),bI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:_I(t,e)}}),xI=(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),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}})),SI=(t,e,i)=>({from:{points:xI(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),AI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:xI(t,e,i)}}),kI=(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),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,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)=>{var s,n;const{offset:r=0,orient:a,direction:o,point:l}=null!=e?e:{};let h=0,c=0;"negative"===a&&(i.group?(h=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),c=null!==(n=i.groupHeight)&&void 0!==n?n:i.group.getBounds().height(),i.groupWidth=h,i.groupHeight=c):(h=i.width,c=i.height)),h+=r,c+=r;const u=d(l)?l.call(null,t.getDatum(),t,i):l,p=u&&k(u.x)?u.x:h,g=u&&k(u.y)?u.y:c,m=t.getFinalGraphicAttributes();switch(o){case"x":return{from:{x:p},to:{x:null==m?void 0:m.x}};case"y":return{from:{y:g},to:{y:null==m?void 0:m.y}};default:return{from:{x:p,y:g},to:{x:null==m?void 0:m.x,y:null==m?void 0:m.y}}}},CI=(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}}}},EI=(t,e,i)=>{var s,n,r,a;const o=t.getFinalGraphicAttributes();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}}}},PI=(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}}}},BI={symbol:["_mo_hide_","visible"]},RI=(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=BI[t.mark.markType])&&r.forEach((t=>{delete s[t],delete n[t]})),Object.keys(n).forEach((t=>{gb(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}},LI=(t,e,i)=>{var s,n;const r=null!==(n=null===(s=t.getFinalGraphicAttributes())||void 0===s?void 0:s.angle)&&void 0!==n?n:0;let a=0;return a=pt(r/(2*Math.PI),0)?Math.round(r/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(r/(2*Math.PI))*Math.PI*2:Math.floor(r/(2*Math.PI))*Math.PI*2,{from:{angle:a},to:{angle:r}}},OI=(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}}},II=()=>{kR.registerAnimationType("clipIn",nI)},DI=()=>{kR.registerAnimationType("clipOut",rI)},FI=()=>{kR.registerAnimationType("fadeIn",aI)},jI=()=>{kR.registerAnimationType("fadeOut",oI)},zI=()=>{kR.registerAnimationType("growCenterIn",lI)},HI=()=>{kR.registerAnimationType("growCenterOut",hI)},VI=()=>{kR.registerAnimationType("growHeightIn",uI)},NI=()=>{kR.registerAnimationType("growHeightOut",pI)},GI=()=>{kR.registerAnimationType("growWidthIn",cI)},WI=()=>{kR.registerAnimationType("growWidthOut",dI)},UI=()=>{kR.registerAnimationType("growPointsIn",yI)},YI=()=>{kR.registerAnimationType("growPointsOut",bI)},KI=()=>{kR.registerAnimationType("growPointsXIn",SI)},XI=()=>{kR.registerAnimationType("growPointsXOut",AI)},$I=()=>{kR.registerAnimationType("growPointsYIn",MI)},qI=()=>{kR.registerAnimationType("growPointsYOut",TI)},ZI=()=>{kR.registerAnimationType("growAngleIn",gI)},JI=()=>{kR.registerAnimationType("growAngleOut",mI)},QI=()=>{kR.registerAnimationType("growRadiusIn",fI)},tD=()=>{kR.registerAnimationType("growRadiusOut",vI)},eD=()=>{kR.registerAnimationType("moveIn",wI)},iD=()=>{kR.registerAnimationType("moveOut",CI)},sD=()=>{kR.registerAnimationType("scaleIn",EI)},nD=()=>{kR.registerAnimationType("scaleOut",PI)},rD=()=>{kR.registerAnimationType("rotateIn",LI)},aD=()=>{kR.registerAnimationType("rotateOut",OI)},oD=()=>{kR.registerAnimationType("update",RI)};class lD extends NL{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=uR(e)?null:Object.keys(e).reduce(((t,s)=>(vR(e[s])&&(t[s]=gR(e[s].scale,i)),t)),{});this._encoders[t]={callback:(t,i,n)=>{const r=SR(e,t,i,n);if(u(r.size)){const t=s.x?NR(s.x):void 0,e=s.y?NR(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(PR.symbol)}release(){super.release(),this._encoders=null}}lD.markType=RB.cell;const hD=["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 cD,dD,uD;t.ChartEvent=void 0,(cD=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",cD.rendered="rendered",cD.renderFinished="renderFinished",cD.animationFinished="animationFinished",cD.regionSeriesDataFilterOver="regionSeriesDataFilterOver",cD.afterInitData="afterInitData",cD.afterInitEvent="afterInitEvent",cD.afterInitMark="afterInitMark",cD.rawDataUpdate="rawDataUpdate",cD.viewDataFilterOver="viewDataFilterOver",cD.viewDataUpdate="viewDataUpdate",cD.viewDataStatisticsUpdate="viewDataStatisticsUpdate",cD.markDeltaYUpdate="markDeltaYUpdate",cD.viewDataLabelUpdate="viewDataLabelUpdate",cD.scaleDomainUpdate="scaleDomainUpdate",cD.scaleUpdate="scaleUpdate",cD.dataZoomChange="dataZoomChange",cD.drill="drill",cD.layoutStart="layoutStart",cD.layoutEnd="layoutEnd",cD.layoutRectUpdate="layoutRectUpdate",cD.playerPlay="playerPlay",cD.playerPause="playerPause",cD.playerEnd="playerEnd",cD.playerChange="playerChange",cD.playerForward="playerForward",cD.playerBackward="playerBackward",cD.scrollBarChange="scrollBarChange",cD.brushStart="brushStart",cD.brushChange="brushChange",cD.brushEnd="brushEnd",cD.brushClear="brushClear",cD.legendSelectedDataChange="legendSelectedDataChange",cD.legendFilter="legendFilter",cD.legendItemClick="legendItemClick",cD.legendItemHover="legendItemHover",cD.legendItemUnHover="legendItemUnHover",cD.tooltipShow="tooltipShow",cD.tooltipHide="tooltipHide",cD.tooltipRelease="tooltipRelease",cD.afterResize="afterResize",cD.afterRender="afterRender",cD.afterLayout="afterLayout",t.Event_Source_Type=void 0,(dD=t.Event_Source_Type||(t.Event_Source_Type={})).chart="chart",dD.window="window",dD.canvas="canvas",t.Event_Bubble_Level=void 0,(uD=t.Event_Bubble_Level||(t.Event_Bubble_Level={})).vchart="vchart",uD.chart="chart",uD.model="model",uD.mark="mark";const pD=`${hB}_waterfall_default_seriesField`,gD=`${hB}_CORRELATION_X`,mD=`${hB}_CORRELATION_Y`,fD=`${hB}_CORRELATION_SIZE`,vD=`${hB}_MEASURE_CANVAS_ID`,_D=`${hB}_DEFAULT_DATA_INDEX`,yD=`${hB}_DEFAULT_DATA_KEY`,bD=`${hB}_DEFAULT_DATA_SERIES_FIELD`,xD=`${hB}_DEFAULT_SERIES_STYLE_NAME`;var SD;t.AttributeLevel=void 0,(SD=t.AttributeLevel||(t.AttributeLevel={}))[SD.Default=0]="Default",SD[SD.Theme=1]="Theme",SD[SD.Chart=2]="Chart",SD[SD.Base_Series=3]="Base_Series",SD[SD.Series=4]="Series",SD[SD.Mark=5]="Mark",SD[SD.User_Chart=6]="User_Chart",SD[SD.User_Series=7]="User_Series",SD[SD.User_Mark=8]="User_Mark",SD[SD.Built_In=99]="Built_In";const AD=`${hB}_STACK_KEY`,kD=`${hB}_STACK_START`,MD=`${hB}_STACK_END`,TD=`${hB}_STACK_START_PERCENT`,wD=`${hB}_STACK_END_PERCENT`,CD=`${hB}_STACK_START_OffsetSilhouette`,ED=`${hB}_STACK_END_OffsetSilhouette`,PD=`${hB}_STACK_TOTAL`,BD=`${hB}_STACK_TOTAL_PERCENT`,RD=`${hB}_STACK_TOTAL_TOP`,LD=`${hB}_SEGMENT_START`,OD=`${hB}_SEGMENT_END`;var ID,DD;t.LayoutZIndex=void 0,(ID=t.LayoutZIndex||(t.LayoutZIndex={}))[ID.Axis_Grid=50]="Axis_Grid",ID[ID.CrossHair_Grid=100]="CrossHair_Grid",ID[ID.Region=450]="Region",ID[ID.Mark=300]="Mark",ID[ID.Node=400]="Node",ID[ID.Axis=100]="Axis",ID[ID.MarkLine=500]="MarkLine",ID[ID.MarkArea=100]="MarkArea",ID[ID.MarkPoint=500]="MarkPoint",ID[ID.DataZoom=500]="DataZoom",ID[ID.ScrollBar=500]="ScrollBar",ID[ID.Player=500]="Player",ID[ID.Legend=500]="Legend",ID[ID.CrossHair=500]="CrossHair",ID[ID.Indicator=500]="Indicator",ID[ID.Title=500]="Title",ID[ID.Label=500]="Label",ID[ID.Brush=500]="Brush",ID[ID.CustomMark=500]="CustomMark",ID[ID.Interaction=700]="Interaction",t.LayoutLevel=void 0,(DD=t.LayoutLevel||(t.LayoutLevel={}))[DD.Indicator=10]="Indicator",DD[DD.Region=20]="Region",DD[DD.Axis=30]="Axis",DD[DD.DataZoom=40]="DataZoom",DD[DD.Player=40]="Player",DD[DD.ScrollBar=40]="ScrollBar",DD[DD.Legend=50]="Legend",DD[DD.Title=70]="Title",DD[DD.CustomMark=70]="CustomMark";const FD=["linear","radial","conical"],jD={x0:0,y0:0,x1:1,y1:1},zD={x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},HD={x:.5,y:.5,startAngle:0,endAngle:2*Math.PI},VD={linear:jD,radial:zD,conical:HD},ND={label:{name:"label",type:"text"}},GD=`${hB}_rect_x`,WD=`${hB}_rect_x1`,UD=`${hB}_rect_y`,YD=`${hB}_rect_y1`,KD=Object.assign(Object.assign({},ND),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),XD=Object.assign(Object.assign({},ND),{bar3d:{name:"bar3d",type:"rect3d"}}),$D={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},qD=Object.assign(Object.assign({},ND),$D),ZD=Object.assign(Object.assign({},ND),{point:{name:"point",type:"symbol"}}),JD=Object.assign(Object.assign(Object.assign({},ND),$D),{area:{name:"area",type:"area"}}),QD=Object.assign(Object.assign(Object.assign({},ND),$D),{area:{name:"area",type:"area"}}),tF=Object.assign(Object.assign({},ND),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),eF=Object.assign(Object.assign({},ND),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}}),iF=Object.assign(Object.assign({},ND),{rose:{name:"rose",type:"arc"}}),sF=Object.assign(Object.assign({},ND),{area:{name:"area",type:"path"}}),nF=Object.assign(Object.assign({},ND),{group:{name:"group",type:"group"}}),rF=Object.assign(Object.assign({},nF),{track:{name:"track",type:"arc"},progress:{name:"progress",type:"arc"}}),aF=Object.assign(Object.assign({},ND),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),oF=Object.assign(Object.assign({},ND),{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"}}),lF=Object.assign(Object.assign({},ND),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"}}),hF=Object.assign(Object.assign({},ND),{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"}}),cF=Object.assign(Object.assign({},ND),{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"}}),dF=Object.assign(Object.assign({},ND),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),uF=Object.assign(Object.assign({},KD),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),pF=Object.assign(Object.assign({},ND),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),gF=Object.assign(Object.assign({},ND),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),mF=Object.assign(Object.assign({},ND),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}}),fF=Object.assign(Object.assign({},nF),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),vF=Object.assign(Object.assign({},ND),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),_F=Object.assign(Object.assign({},ND),{sunburst:{name:"sunburst",type:"arc"}}),yF=Object.assign(Object.assign({},KD),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),bF=Object.assign(Object.assign({},XD),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),xF=Object.assign(Object.assign({},ND),{circlePacking:{name:"circlePacking",type:"arc"}}),SF=Object.assign(Object.assign({},ND),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}}),AF=Object.assign(Object.assign({},ND),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),kF=Object.assign({},JD),MF=Object.assign(Object.assign({},ND),{liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"symbol"}}),TF=Object.assign(Object.assign({},ND),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});var wF;!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"}(wF||(wF={}));const CF={[oB.bar]:KD,[oB.bar3d]:XD,[oB.line]:qD,[oB.scatter]:ZD,[oB.area]:JD,[oB.radar]:QD,[oB.pie]:tF,[oB.pie3d]:eF,[oB.rose]:iF,[oB.geo]:ND,[oB.map]:sF,[oB.circularProgress]:rF,[oB.link]:aF,[oB.dot]:oF,[oB.wordCloud]:lF,[oB.wordCloud3d]:lF,[oB.funnel]:hF,[oB.funnel3d]:cF,[oB.linearProgress]:dF,[oB.waterfall]:uF,[oB.boxPlot]:pF,[oB.treemap]:gF,[oB.sankey]:mF,[oB.gauge]:fF,[oB.gaugePointer]:vF,[oB.sunburst]:_F,[oB.rangeColumn]:yF,[oB.rangeColumn3d]:bF,[oB.circlePacking]:xF,[oB.heatmap]:SF,[oB.correlation]:AF,[oB.rangeArea]:kF,[oB.liquid]:MF,[oB.venn]:TF};function EF(t){var e,i;const{type:s}=t;return s===oB.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}const PF={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},BF={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function RF(t,e){var i;if(!t)return[];const s=zF(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?FF(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>DF(i)?OF(t,i,e):i)).filter(p)}))):i.map((i=>DF(i)?OF(t,i,e):i)).filter(p):[]}return[]}function LF(t,e){var i,s;return FF(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 OF(t,e,i){var s;const n=zF(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=PF[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=BF[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 IF=(t,e,i)=>{if(e&&DF(t)){const s=OF(e,t,i);if(s)return s}return t};function DF(t){return t&&"palette"===t.type&&!!t.key}function FF(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function jF(t){return y(t)?{dataScheme:t}:t}function zF(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=EF(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 HF extends sC{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(!FF(this._range))return void super.range(this._range);const t=LF(this._range,this._domain);super.range(t)}}const VF={linear:TC,band:rC,point:class extends rC{constructor(t){super(!1),this.type=Pw.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:sC,threshold:BC,colorOrdinal:HF};function NF(t){const e=VF[t];return e?new e:null}function GF(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 WF(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function UF(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function YF(t){return!!_(t)&&(!!t.endsWith("%")&&nb(t.substring(0,t.length-1)))}function KF(t,e,i,s=0){var n,r;return S(t)?t:YF(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 XF(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]=KF(t[s],e.size,i)}))})),o}function $F(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)||YF(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 qF(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const ZF=(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},JF=[{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"]}],QF={default:{dataScheme:JF,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)"}}},tj="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",ej={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:tj,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:tj,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:CB,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"}}}}},ij={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}}},sj=Object.assign(Object.assign({},ij),{label:{space:0}}),nj={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}}}}},rj="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;",aj={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:rj,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:rj,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}}}},oj={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}},lj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}},hj={horizontal:Object.assign(Object.assign({},oj),{rail:{width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:lj}),vertical:Object.assign(Object.assign({},oj),{rail:{width:8,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:lj})},cj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}},dj={horizontal:Object.assign(Object.assign({},oj),{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:cj}),vertical:Object.assign(Object.assign({},oj),{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:cj})},uj={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"}}}}},pj={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"}}}}},gj={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 mj(t,e){return t&&e.key in t?t[e.key]:e.default}function fj(t){return t&&"token"===t.type&&!!t.key}const vj={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%"},_j={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:QF,token:vj,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:ej,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:hj,sizeLegend:dj,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:ij,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:sj,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:pj,markArea:uj,markPoint:gj,polarMarkLine:pj,polarMarkArea:uj,polarMarkPoint:gj,geoMarkPoint:gj,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:aj,crosshair:nj,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},yj={name:"dark",colorScheme:{default:{dataScheme:JF,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}}}}}},bj=(t,e)=>t===e||!d(t)&&!d(e)&&(y(t)&&y(e)?e.every((e=>t.some((t=>bj(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>bj(t[i],e[i])))),xj=(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]={}),xj(t[s],e.slice(1),i))};function Sj(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]=Sj(n,e)}return s}function Aj(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])?kj(t,e,r,i):Mj(t,r,s[r])}}}}function kj(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?Tj({},t[n][e.index],i):i):t[n]=s?Tj({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?Tj({},t[n][r],i):i)}else t.id===e&&(t[n]=s?Tj({},t[n],i):i)}))}function Cj(t,...e){return Tj(Ej(t),...e.map(Ej))}function Ej(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]=jF(s),e}),{}));return t}(t.colorScheme),{series:s}=t,{mark:n,markByName:r}=t;let a;return(n||r)&&(a=Object.keys(CF).reduce(((t,e)=>{var i;const a=null!==(i=null==s?void 0:s[e])&&void 0!==i?i:{};return t[e]=Pj(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 Pj(t,e,i,s){if(!CF[e])return t;const n={};return Object.values(CF[e]).forEach((({type:e,name:r})=>{n[r]=Tj({},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 Bj=["animationThreshold","colorScheme","name","padding"];function Rj(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];Bj.includes(r)?n[r]=a:f(a)?DF(a)?n[r]=IF(a,e,s):fj(a)?n[r]=mj(i,a):n[r]=Rj(a,e,i,s):n[r]=a})),n}const Lj={[_j.name]:_j},Oj=_j.name,Ij=new Map(Object.keys(Lj).map((t=>[t,Lj[t]]))),Dj=new Map(Object.keys(Lj).map((t=>[t,Rj(Lj[t])]))),Fj=new Map(Object.keys(Lj).map((t=>[t,t===Oj]))),jj=(t,e)=>{if(!t)return;const i=Nj(e);Ij.set(t,i),Dj.set(t,Rj(i)),Fj.set(t,!0)},zj=(t=Oj,e=!1)=>(Fj.has(t)&&!Fj.get(t)&&jj(t,Ij.get(t)),e?Dj.get(t):Ij.get(t)),Hj=t=>Ij.delete(t)&&Dj.delete(t)&&Fj.delete(t),Vj=t=>!!_(t)&&Ij.has(t),Nj=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:Oj;return Cj({},zj(i),t)};class Gj{static registerInstance(t){Gj.instances.set(t.id,t)}static unregisterInstance(t){Gj.instances.delete(t.id)}static getInstance(t){return Gj.instances.get(t)}static instanceExist(t){return Gj.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return Gj.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}Gj.instances=new Map;class Wj{static registerTheme(t,e){jj(t,e)}static getTheme(t,e=!1){return zj(t,e)}static removeTheme(t){return Hj(t)}static themeExist(t){return Vj(t)}static getDefaultTheme(){return Wj.themes.get(Oj)}static setCurrentTheme(t){Wj.themeExist(t)&&(Wj._currentThemeName=t,Gj.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return Wj.getTheme(Wj._currentThemeName,t)}static getCurrentThemeName(){return Wj._currentThemeName}}function Uj(t,e){return _(t)?Wj.themeExist(t)?Wj.getTheme(t,e):{}:g(t)?t:{}}function Yj(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]=Yj(t[s],e)}return i}return y(t)?t.map((t=>Yj(t,e))):t}function Kj(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]=Kj(t[s],e)}return i}return y(t)?t.map((t=>Kj(t,e))):t}Wj.themes=Ij,Wj._currentThemeName=Oj;function Xj(t,e){for(let i=0;it.key===e))}function qj(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 Zj(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:{}},iz(t,a,n[o],l,e,r))})),s?Jj(n):n}function Jj(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))):Jj(t[e].nodes);return t}function Qj(t,e){if("values"in t&&t.values.length){const i=JP(t.values,e),s=ZP(t.values,wD);t.values.forEach((t=>{t[PD]=i,t[BD]=s,delete t[RD]}));const n=t.values.reduce(((t,e)=>e[MD]>t[MD]?e:t));n[RD]=!0}else for(const i in t.nodes)Qj(t.nodes[i],e)}function tz(t){if(!t.values.length)return;const e=t.values[t.values.length-1][MD]/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[kD]=s,s+=r[MD],r[MD]=s):(r[kD]=n,n+=r[MD],r[MD]=n),r[AD]=t.key}if(i)for(let i=0;i=0?s:n;r=a>=0?1:-1,l[TD]=0===h?0:Math.min(1,l[kD]/h)*r,l[wD]=0===h?0:Math.min(1,l[MD]/h)*r}}for(const s in t.nodes)ez(t.nodes[s],e,i)}function iz(t,e,i,s,n,r,a){if("values"in e)if(n&&e.values.forEach((t=>t[MD]=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}),iz(t,e.nodes[o],i.nodes[o],s,n,r,l)}}const sz=(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]=rz(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function az(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>lz(t.style(e,i,s,n)):B(t.style)||(e.style=lz(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>lz(t.state[e](i,s,n,r)):B(t.state[e])||(i[e]=lz(t.state[e]))})),e.state=i}return e}function oz(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>lz(t[i](e,s,n,r)):B(t[i])||(e[i]=lz(t[i]))})),e}function lz(t){return(null==t?void 0:t.angle)&&(t.angle=te(t.angle)),t}class hz{static registerChart(t,e){hz._charts[t]=e}static registerSeries(t,e){hz._series[t]=e}static registerComponent(t,e,i){hz._components[t]={cmp:e,alwaysCheck:i}}static registerMark(t,e){hz._marks[t]=e}static registerRegion(t,e){hz._regions[t]=e}static registerTransform(t,e){hz.transforms[t]=e}static registerLayout(t,e){hz._layout[t]=e}static registerAnimation(t,e){hz._animations[t]=e}static registerImplement(t,e){hz._implements[t]=e}static registerChartPlugin(t,e){hz._chartPlugin[t]=e}static registerComponentPlugin(t,e){hz._componentPlugin[t]=e}static createChart(t,e,i){if(!hz._charts[t])return null;return new(0,hz._charts[t])(e,i)}static createChartSpecTransformer(t,e){if(!hz._charts[t])return null;const i=hz._charts[t];return new(0,i.transformerConstructor)(Object.assign({seriesType:i.seriesType},e))}static createRegion(t,e,i){if(!hz._regions[t])return null;return new(0,hz._regions[t])(e,i)}static createRegionSpecTransformer(t,e){if(!hz._regions[t])return null;return new(0,hz._regions[t].transformerConstructor)(e)}static createSeries(t,e,i){if(!hz._series[t])return null;return new(0,hz._series[t])(e,i)}static createSeriesSpecTransformer(t,e){if(!hz._series[t])return null;return new(0,hz._series[t].transformerConstructor)(e)}static createMark(t,e,i){if(!hz._marks[t])return null;const s=new(0,hz._marks[t])(e,i);return"group"===s.type&&s.setInteractive(!1),s}static getComponents(){return Object.values(hz._components)}static getComponentInKey(t){return hz._components[t].cmp}static getLayout(){return Object.values(hz._layout)}static getLayoutInKey(t){return hz._layout[t]}static getSeries(){return Object.values(hz._series)}static getSeriesInType(t){return hz._series[t]}static getRegionInType(t){return hz._regions[t]}static getAnimationInKey(t){return hz._animations[t]}static getImplementInKey(t){return hz._implements[t]}static getSeriesMarkMap(t){return hz._series[t]?hz._series[t].mark:{}}static getChartPlugins(){return Object.values(hz._chartPlugin)}static getComponentPlugins(){return Object.values(hz._componentPlugin)}static getComponentPluginInType(t){return hz._componentPlugin[t]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}}hz._charts={},hz._series={},hz._components={},hz._marks={},hz._regions={},hz._animations={},hz._implements={},hz._chartPlugin={},hz._componentPlugin={},hz.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}},hz.dataParser={csv:Yr,dsv:Ur,tsv:Kr},hz._layout={};const cz=(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))},dz=(t,e,i,s)=>{var n;const r=jw(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:uz(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("_")}`,pz=(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},gz=(t,e)=>{if(!t)return null;if(!rB(t.getRegionsInIndex(),"polar"))return null;const{x:i,y:s}=e,n=pz(t,(t=>"angle"===t.getOrient()),e),r=pz(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&&jw(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=eB({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=iB(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=dz(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&&jw(r.type)){const h=t.getCenter(),c={x:i-t.getLayoutStartPoint().x-h.x,y:s-t.getLayoutStartPoint().y-h.y};let d=eB({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=iB(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 _=dz(f,t,"polar",o);a.push({index:v,value:f,position:r.scale(f),axis:t,data:_})}})),a.length?a:null};function mz(t){return"bottom"===t||"top"===t}function fz(t){return"left"===t||"right"===t}function vz(t){return"z"===t}function _z(t,e){return UF(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function yz(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function bz(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?mz(t)?"linear":"band":mz(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const xz=t=>t.fieldX[0],Sz=t=>t.fieldY[0],Az=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},kz=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},Mz=(t,e)=>t?e?xz:Az:e?Sz:kz,Tz=(t,e,i)=>{var s,n;if(!t)return null;if(!rB(t.getRegionsInIndex(),"cartesian"))return null;const{x:r,y:a}=e,o=null!==(s=pz(t,(t=>mz(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=pz(t,(t=>fz(t.getOrient())),e))&&void 0!==n?n:[],h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{jw(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=wz(s,i,t,Mz(e,jw(s.getScale().type)));n&&u.push(n)}}else{const n=h.size>0;if((n?h:c).has(s)){const r=wz(s,i,t,Mz(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},wz=(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 Cz(t,a,s)},Cz=(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=dz(e,t,"cartesian",null!=i?i:mz(t.getOrient())?xz:Sz);return{index:n,value:e,position:s.scale(e),axis:t,data:r}};class Ez{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:$y)("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:$y)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s;const n=null!==(i=Tz(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(s=gz(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=>jw(t.getScale().type))),r=n.length?n:s.filter((t=>{const e=t.getOrient();return mz(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=Cz(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var Pz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Pz||(Pz={}));const Bz={[Pz.dimensionHover]:class extends Ez{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)=>!cz(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}),tb(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}),tb(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[Pz.dimensionClick]:class extends Ez{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 Rz=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(Bz[t]){const e=new Bz[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(Bz[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}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class Lz{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}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const Oz={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 Iz{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 Lz);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}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 Oz[a]&&(a=Oz[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.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 hD.includes(e)||Object.values(t.VGRAMMAR_HOOK_EVENT).includes(e)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&kR.hasInteraction(e)}}function Dz(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function Fz(t,e,i){t.getParser(e)||t.registerParser(e,i)}const jz=new Map;let zz;function Hz(){zz||(zz=new va,Fz(zz,"geojson",da),Fz(zz,"topojson",pa),Dz(zz,"simplify",Rr))}function Vz(t,e,i={type:"geojson",centroid:!0}){jz.has(t)&&Xy(`map type of '${t}' already exists, will be overwritten.`),Hz();const s=new ya(zz),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}),jz.set(t,s)}function Nz(t){jz.has(t)?jz.delete(t):Xy(`map type of '${t}' does not exists.`)}function Gz(t,e=!1){let i=e;return t.latestData instanceof ya&&(i=!1),i?I(t.latestData):t.latestData.slice()}const Wz=(t,e)=>0===t.length?[]:1===t.length?Gz(t[0],null==e?void 0:e.deep):t.map((t=>Gz(t,null==e?void 0:e.deep)));function Uz(t,e,i){Dz(e=e instanceof va?e:t.dataSet,"copyDataView",Wz);const s=new ya(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:Xz.copyDataView}),s}function Yz(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:$y)(`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:$y)(`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([]),Xy("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 Kz(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var Xz;!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"}(Xz||(Xz={}));const $z=(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 uO(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:tH(this._option.mode),autoFit:!1,eventConfig:{gesture:tb(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())}clear(t,e=!1){const{chart:i}=t;i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=P_.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this._nextRafId&&(P_.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null),this._isRunning||(this.initView(),this._view&&(this._isRunning=!0,null===(e=this._view)||void 0===e||e.run(t),this._isRunning=!1,this._nextRafId&&(P_.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,this._isRunning=!0,null===(i=this._view)||void 0===i||i.run(t),this._isRunning=!1))))}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.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 Qy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function iH(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:$y)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function sH(t){t.crosshair=Y(t.crosshair||{}).map((e=>Tj({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function nH(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&&Qy(e.mode)){let t;t=_(h)?null===document||void 0===document?void 0:document.getElementById(h):h;const{width:e,height:s}=ii(t,i.width,i.height);a=e,o=s}else if(eb(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 rH(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")}),t}function aH(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"}(Jz||(Jz={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(Qz||(Qz={}));class oH{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({},oH.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]))))}}oH.defaultMarkInfo={};class lH{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new oH,this._markReverse=new oH,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement(Jz.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement(Jz.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement(Jz.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement(Jz.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement(Jz.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(Jz.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[Jz.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[Jz.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(Pz.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 hH={};Object.values(Jz).forEach((t=>{hH[t]=!0}));const cH={[Jz.STATE_HOVER]:Jz.STATE_HOVER_REVERSE,[Jz.STATE_SELECTED]:Jz.STATE_SELECTED_REVERSE,[Jz.STATE_DIMENSION_HOVER]:Jz.STATE_DIMENSION_HOVER_REVERSE};function dH(t){return cH[t]}class uH{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=dH(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=dH(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=dH(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=dH(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 pH{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 gH extends pH{constructor(){super(...arguments),this.id=sb(),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 mH extends gH{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,s){super(t),this.grammarType=Zz.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 fH extends pH{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 mH(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 vH extends fH{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 _H extends vH{constructor(){super(...arguments),this.id=sb(),this.stateKeyToSignalName=t=>`${hB}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===qz.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===qz.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?qz.none:qz.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?qz.exit:qz.appear}}}}class yH{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=>Tj({},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 bH extends pH{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=yH,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new oH,this._lastLayoutRect=null,this.id=sb(),this.userId=t.id,this._spec=t,this.effect={},this.event=new Rz(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=`${hB}_${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=hz.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 xH{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=XF($F(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:KF(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:KF(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:KF(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:KF(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:KF(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:KF(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=KF(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=KF(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]=KF(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 SH extends bH{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 xH(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 AH extends yH{_initTheme(t,e){return{spec:t,theme:this._theme}}}class kH extends SH{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=AH,this.modelType="region",this.specKey="region",this.type=kH.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.interaction=new uH,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 _H({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 lH(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 Qz)B(t.stateStyle[Qz[e]])||this.interaction.registerMark(Qz[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 MH(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 TH(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 wH(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 CH(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),wH(c,!0,u,o),s&&TH(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function EH(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),wH(c,!1,u,a),s&&TH(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function BH(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}=MH(t);s.length&&CH(s,e,i,!1,"left"),n.length&&CH(n,e,i,!0,"left"),r.length&&EH(r,e,0,"left")}(e,this,a),s.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=MH(t);s.length&&PH(s,e,i,!1,"top"),n.length&&PH(n,e,i,!0,"top"),r.length&&BH(r,e,0,"top")}(s,this,r),i.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=MH(t);s.length&&CH(s,e,i,!1,"right"),n.length&&CH(n,e,i,!0,"right"),r.length&&EH(r,e,0,"right")}(i,this,a),n.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=MH(t);s.length&&PH(s,e,i,!1,"bottom"),n.length&&PH(n,e,i,!0,"bottom"),r.length&&BH(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:$y)("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}}}RH.type="base";const LH=["line","area","trail"];function OH(t){return LH.includes(t)}class IH extends vH{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(OH)?s:!t.mark||OH(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=>!!hH[t])).map((t=>[t,10])),s=!t.mark||OH(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(hB)));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(hB)));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(Dw(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 DH extends gH{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=Zz.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 FH extends DH{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${hB}_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 jH extends gH{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=Zz.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 IH(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 Rz(s.getOption().eventDispatcher,s.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new FH(t)}stateKeyToSignalName(t){return`${hB}_${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=Jz.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=Jz.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===qz.appear&&this.runAnimationByState(qz.normal)})):this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,(()=>{this.runAnimationByState(qz.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),this._morph&&this._morphKey&&(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 zH extends jH{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].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))}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&&Tj(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(Fw(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=NF(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()):FD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Fw(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=LF(RF(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({},VD[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)FD.includes(null===(o=n.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(n.stroke)(t,e));else{const e=LF(RF(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 HH extends zH{constructor(){super(...arguments),this.type=HH.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)?(Xy("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?(Xy("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})}))}}HH.type="group";const VH=()=>{fM(),iM(),kR.registerGraphic(RB.group,ku),hz.registerMark(HH.type,HH)},NH={type:"clipIn"},GH={type:"fadeIn"};function WH(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 GH;default:return NH}}const UH={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"}},YH={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},KH={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},XH=()=>{hz.registerAnimation("scaleInOut",(()=>YH))},$H=()=>{hz.registerAnimation("fadeInOut",(()=>KH))},qH=(t,e)=>({appear:WH(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:Hc,duration:UH.update.duration,easing:UH.update.easing}],disappear:{type:"clipOut"}}),ZH=()=>{hz.registerAnimation("line",qH)},JH=()=>{uO.useRegisters([UI,YI,KI,XI,$I,qI,II,DI])},QH={measureText:(t,e,i,s)=>((t,e,i)=>GM(t,e,i,{fontFamily:vj.fontFamily,fontSize:vj.fontSize}))(e,i,s).measure(t)};class tV{static instance(){return tV.instance_||(tV.instance_=new tV),tV.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 eV{constructor(){this.id=sb(),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))?Xy("不要重复添加相同的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 iV extends eV{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 sV{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>hz.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>hz.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>hz.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return hz.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>hz.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){hz.registerTransform(t,e)}static registerFunction(t,e){t&&e&&tV.instance().registerFunction(t,e)}static unregisterFunction(t){t&&tV.instance().unregisterFunction(t)}static getFunction(t){return t?tV.instance().getFunction(t):null}static getFunctionList(){return tV.instance().getFunctionNameList()}static registerMap(t,e,i){const s=hz.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=hz.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,jz.get(e);var e}static hideTooltip(t=[]){Gj.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,c;this.id=sb(),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 d=this._option,{dom:u,renderCanvas:p,mode:g,stage:m,poptip:f}=d,v=e(d,["dom","renderCanvas","mode","stage","poptip"]),y=Qy(g);y&&u&&(this._container=_(u)?null===document||void 0===document?void 0:document.getElementById(u):u),p&&(this._canvas=p),m&&(this._stage=m),"node"===g||this._container||this._canvas||this._stage?(y?Cx(ql):"node"===g&&TA(ql),this._viewBox=this._option.viewBox,this._currentThemeName=Wj.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new eH({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:p},Object.assign(Object.assign({mode:this._option.mode,stage:m,pluginList:!1!==f?["poptipForText"]:[]},v),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new Iz(this,this._compiler),this._event=new Rz(this._eventDispatcher,g),this._compiler.initView(),null===(o=this.getStage())||void 0===o||o.setTheme({text:{fontFamily:null===(l=this._currentTheme)||void 0===l?void 0:l.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!y&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),Gj.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=Tj({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=Yj(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;sV.getFunctionList()&&sV.getFunctionList().length&&(t=Kj(t,sV)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=hz.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=hz.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=hz.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 nH(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:cB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:dB})}_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,Fz(this._dataSet,"dataview",ga),Fz(this._dataSet,"array",s),Dz(this._dataSet,"stackSplit",$z),Dz(this._dataSet,"copyDataView",Wz);for(const t in hz.transforms)Dz(this._dataSet,t,hz.transforms[t]);for(const t in hz.dataParser)Fz(this._dataSet,t,hz.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),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;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,null===(s=this._compiler)||void 0===s||s.releaseGrammar(!1===(null===(n=this._option)||void 0===n?void 0:n.animation)||!1===(null===(r=this._spec)||void 0===r?void 0:r.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.reCompile&&(null===(a=this._compiler)||void 0===a||a.clear({chart:this._chart,vChart:this},!this._option.animation||!this._spec.animation),null===(o=this._compiler)||void 0===o||o.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(){var t,e;this._option.animation&&(null===(t=this._chart)||void 0===t||t.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(qz.update,!0)})),null===(e=this._chart)||void 0===e||e.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(qz.update,!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,Gj.unregisterInstance(this)}updateData(t,e,s){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s)}))}_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){return u(this._dataSet)?this:this._chart?(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){if(this._chart)return this._chart.updateFullData(t),e&&this._compiler.render(),this;const i=Y(this._spec.data);return Y(t).forEach((t=>{var e;const{id:s,values:n,parser:r,fields:a}=t,o=i.find((t=>t.name===s));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 s=Yz(t,this._dataSet,i,{onError:null===(e=this._option)||void 0===e?void 0:e.onError});y(this._spec.data)&&this._spec.data.push(s)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i){const s=this._updateSpec(t,e);return s?(this.updateCustomConfigAndRerender(s,!0,{morphConfig:i,transformSpec:s.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){var i,s;const n=this._spec;if(!this._setNewSpec(t,e))return;G(n.theme,this._spec.theme)||this._setCurrentTheme();const r=this._shouldChartResize(n);return null===(s=null===(i=this._compiler)||void 0===i?void 0:i.getVGrammarView())||void 0===s||s.updateLayoutTag(),this._spec.type!==n.type?{reTransformSpec:!0,change:!0,reMake:!0,reCompile:!1,reSize:r}:(this._initChartSpec(this._spec,"render"),rH(this._chart.updateSpec(this._spec),{reTransformSpec:!1,change:r,reMake:!1,reCompile:!1,reSize:r}))}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)||wj(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)||wj(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=Tj({},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=Uj(this._currentThemeName,!0);else if(_(s)&&(!n||_(n))||_(n)&&(!s||_(s))){const t=Cj({},Uj(this._currentThemeName,!0),Uj(s,!0),Uj(n,!0));this._currentTheme=t}else{const t=Cj({},Uj(this._currentThemeName),Uj(s),Uj(n));this._currentTheme=Rj(t)}var r;r=R(this._currentTheme,"component.poptip"),z(eT.poptip,tT,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=!!Qy(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?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return Uj(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){if(!Wj.themeExist(t))return this;const e=this._setCurrentTheme(t);return yield this.updateCustomConfigAndRerender(e,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){if(!Wj.themeExist(t))return this;const e=this._setCurrentTheme(t);return this.updateCustomConfigAndRerender(e,!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}}_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 iH(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(!Qy(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)?null===document||void 0===document?void 0:document.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?qF(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 Xy("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?qF(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Xy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return tV.instance().getFunction(t)}registerFunction(t,e){t&&e&&tV.instance().registerFunction(t,e)}unregisterFunction(t){t&&tV.instance().unregisterFunction(t)}getFunctionList(){return tV.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}_initChartPlugin(){const t=hz.getChartPlugins();t.length>0&&(this._chartPlugin=new iV(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}}}sV.InstanceManager=Gj,sV.ThemeManager=Wj,sV.globalConfig={uniqueTooltip:!0},sV.Utils=QH,sV.vglobal=P_;hz.registerRegion("region",kH),hz.registerLayout("base",RH),VH(),uO.useRegisters([tI,eI]),uO.useRegisters([sD,nD,FI,jI,eD,iD,rD,aD,oD]),UR(),WR(),jj(yj.name,yj),at.getInstance(rt.Error);const nV=(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(oB).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=hz.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=hz.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},rV=(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=nV(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):bj(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const m=Tj({},i),f=d(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:Tj(m,f),hasChanged:!0};const i=Tj({},t,f);xj(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 aV{constructor(t){this.id=sb(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}const oV=t=>{hz.registerChartPlugin(t.type,t)};class lV extends aV{constructor(){super(lV.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[lV.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[lV.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=Sj(this._option.globalInstance.getSpec(),["data",lV.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=Sj(this._baseChartSpec,["data",lV.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=rV(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=Sj(i,["data",lV.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()}}lV.pluginType="chart",lV.specKey="media",lV.type="MediaQueryPlugin";const hV=/\{([^}]+)\}/,cV=/\{([^}]+)\}/g,dV=/:/;class uV extends aV{constructor(){super(uV.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[uV.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)),hz.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=hV.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(cV,((t,i)=>{if(!dV.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}}uV.pluginType="chart",uV.specKey="formatter",uV.type="formatterPlugin";const pV=()=>{oV(uV)};function gV(t){return 2===t.length&&k(t[0])&&k(t[1])&&t[1]>=t[0]}function mV(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 fV(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 vV(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 _V(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 yV(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 bV=(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 RC(v)};class xV extends aV{constructor(){super(xV.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!Dw(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&&gV(c)&&gV(d)))return;const u=mV(t,c),p=mV(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(!vV(u,p))return}else if(0===y&&0===b){if(!vV(p,u))return}else if(_||A)if(_&&!A){if(!fV(u,p))return}else if(A&&!_){if(!fV(p,u))return}else{if(m===b)return;if(m>b){if(!_V(u,p))return}else if(!_V(p,u))return}else{if(0===m&&0===y){if(!yV(u,p))return}else if(0===b&&0===g&&!yV(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){Dz(e.getOption().dataSet,"tickAlign",bV);const t={targetAxis:()=>s,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}xV.pluginType="component",xV.type="AxisSyncPlugin";const SV=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,AV=(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},mm||(mm=pm.CreateGraphic("richtext",{})),mm.setAttributes(a),mm.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}},kV="vchart-tooltip-container",MV={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}};function TV(t,e){return R(e,`component.${t}`)}function wV(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=hz.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const CV={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function EV(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 PV(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 BV(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function RV(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}const LV=(t,e,i)=>{var s;const n=null!==(s="band"===e?TV("axisBand",i):["linear","log","symlog"].includes(e)?TV("axisLinear",i):{})&&void 0!==s?s:{},r=mz(t)?TV("axisX",i):fz(t)?TV("axisY",i):TV("axisZ",i);return Tj({},TV("axis",i),n,r)},OV=(t,e,i)=>{var s;const n=null!==(s="band"===e?TV("axisBand",i):"linear"===e?TV("axisLinear",i):{})&&void 0!==s?s:{},r=TV("angle"===t?"axisAngle":"axisRadius",i);return Tj({},TV("axis",i),n,r)},IV=t=>"band"===t||"ordinal"===t||"point"===t;function DV(t,e){return{id:t,label:t,value:e,rawValue:t}}function FV(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 jV(t,e,i,s){let n=0,r=t.length-1;for(;n<=r;){const a=Math.floor((n+r)/2),o=t[a];if(o[i]<=e&&o[s||i]>=e)return o;o[i]>e?r=a-1:n=a+1}return null}const zV=(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(jw(a.type))A=a.bandwidth(),0===A&&a.step&&(M=a.step());else if(Dw(a.type)){const s=e.fieldX[0],r=e.fieldX2,a=jV(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=EV(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(jw(r.type))k=r.bandwidth(),0===k&&r.step&&(T=r.step());else if(Dw(r.type)){const s=e.fieldY[0],r=e.fieldY2,a=jV(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=EV(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(VV(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&&HV(t,"top",r.label),e.visible&&HV(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(VV(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&&HV(t,"left",a.label),e.visible&&HV(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}},HV=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=wV(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},VV=(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)}))}))},NV=(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=WV(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},GV=(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=WV(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},WV=(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},UV=(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},YV={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"]},KV=(t,e)=>{var i,s;return null!==(s=null===(i=YV[t])||void 0===i?void 0:i[0])&&void 0!==s?s:e},XV=(t,e)=>{var i,s;return null!==(s=null===(i=YV[t])||void 0===i?void 0:i[1])&&void 0!==s?s:e},$V=(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}=zV(3,e,i,s,n,r,a);return o?NV(r,o,d,h):l?GV(a,l,u,c):void 0},qV={fontFamily:vj.fontFamily,spacing:10,wordBreak:"break-word"};function ZV(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:qV),{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 JV=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},QV=(t,e)=>p(e)?t.map((t=>e[t])):void 0,tN=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),eN=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function iN(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=sN(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=>tN(i,s)(t)&&tN(n,r)(t)&&(u(a)||tN([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 sV.globalConfig.uniqueTooltip&&sV.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 sV.globalConfig.uniqueTooltip&&sV.hideTooltip(u.id),d}return"none"}const sN=(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=QV(c,t);let _=QV(d,t);const y=eN(_),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(tN(c,v));if(!y&&(_=QV(d,i),!eN(_)))return;const n=e.type===oB.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=jw(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(tN(c,n));f.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=QV(d,o),!eN(_))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(tN(c,n));if(!y&&(_=QV(d,r),!eN(_)))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===oB.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(tN(c,v))).find((t=>t[g]===m));f.forEach((n=>{if(_=QV(d,i),!eN(_))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},nN=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 rN=(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 aN{constructor(){this.activeTriggerSet={mark:new Set,dimension:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set,dimension:new Set,group:new Set}}}class oN extends aN{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:hN(e.title,{seriesId:this.series.id},!0),content:cN(e.content,{seriesId:this.series.id},!0)}))})),this.spec=a,this.activeType=nN(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 lN=(t,e,i)=>{const s=d(e)?e(t):e;return i?Object.assign(Object.assign({},t),s):Object.assign(Object.assign({},s),t)},hN=(t,e,i)=>p(t)?d(t)?(...s)=>lN(t(...s),e,i):lN(t,e,i):void 0,cN=(t,e,i)=>{const s=p(t)?Y(t).map((t=>d(t)?(...s)=>Y(t(...s)).map((t=>lN(t,e,i))):lN(t,e,i))):void 0;return s},dN=(t,e,i)=>{var s;let n={};switch(t){case"mark":case"group":e&&(n=null!==(s=rN(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=rN(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},uN=(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=pN(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)&&nN(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},pN=ft((t=>t.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(p))),[]))),gN=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},mN=(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}=wV(void 0,s,t,e);i&&r&&(n=i(...r))}return n},vN=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;class _N{}_N.dom=`${hB}_TOOLTIP_HANDLER_DOM`,_N.canvas=`${hB}_TOOLTIP_HANDLER_CANVAS`;const yN=20,bN={key:"其他",value:"..."},xN=(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)},SN=(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=vN(t.title,e,i),{visible:h,value:c,valueTimeFormat:p,valueTimeFormatMode:g,valueStyle:m,hasShape:f,valueFormatter:v}=null!=l?l:{},_=!1!==fN(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:xN(fN(c,t,i,v),p,g),valueStyle:fN(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=yN}=t,x=t.othersLine?Object.assign(Object.assign({},bN),t.othersLine):bN,S=t=>{if(null==t?void 0:t.length)for(const e of t)for(const t of null!=y?y:[]){const s=AN(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=AN(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},AN=(t,e,i)=>{const s=xN(fN(e.key,t,i,e.keyFormatter),e.keyTimeFormat,e.keyTimeFormatMode),n=xN(fN(e.value,t,i,e.valueFormatter),e.valueTimeFormat,e.valueTimeFormatMode),r=!1!==fN(e.visible,t,i)&&(p(s)||p(n)),a=fN(e.isKeyAdaptive,t,i),o=fN(e.spaceRow,t,i),l=fN(e.shapeType,t,i),h=fN(e.shapeColor,t,i),c=fN(e.shapeFill,t,i),d=fN(e.shapeStroke,t,i),u=fN(e.shapeLineWidth,t,i),g=fN(e.shapeHollow,t,i),m=fN(e.keyStyle,t,i),f=fN(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 kN extends aV{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=vN(x.position,b,e),M=null!==(n=vN(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:cB,R=null!==(o=null==P?void 0:P.height)&&void 0!==o?o:dB;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(Qy(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=SV(t,e),j=SV(T,D)}}else O.width=B,O.height=R;const z=j/F;let H,V,N,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=$V(e.dimensionInfo,rB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.x,a=t.end.x)}else W=t;if(L)switch(KV(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=$V(e.dimensionInfo,rB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.y,a=t.end.y)}else U=t;if(L)switch(XV(t)){case"top":V=r-C*z-_;break;case"bottom":V=a+_;break;case"center":V=(r+a)/2-C*z/2;break;case"centerTop":V=(r+a)/2-C*z-_;break;case"centerBottom":V=(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=UV(t,c),V=UV(i,c),N=UV(e,c),G=UV(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=UV(t,c):Y(t),S(e)||d(e)?V=UV(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(N))$=B-w*z-N;else{const t=Z;switch(KV(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(V))q=V;else if(k(G))q=R-C*z-G;else{const t=J;switch(XV(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,Qy(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"===KV(A,"right")?$+=v+w/2:$+=2*v+w)},at=()=>{et()&&($=-D.x/j)},ot=()=>{it()&&(L?$=(Q-D.x)/j-w:"center"===KV(A,"right")?$-=v+w/2:$-=2*v+w)},lt=()=>{it()&&($=(Q-D.x)/j-w)},ht=()=>{st()&&(L?q=-D.y/j:"center"===XV(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"===XV(A,"bottom")?q-=_+C/2:q-=2*_+C)},ut=()=>{nt()&&(q=(tt-D.y)/j-C)};switch(KV(A,"right")){case"center":case"centerLeft":case"centerRight":et()?(rt(),lt()):(ot(),at());break;case"left":rt(),lt();break;case"right":ot(),at()}switch(XV(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({},MV),{offsetX:null!==(t=null==i?void 0:i.x)&&void 0!==t?t:MV.offsetX,offsetY:null!==(e=null==i?void 0:i.y)&&void 0!==e?e:MV.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=$F(d.padding),S=ZV(Object.assign({textAlign:"right"===y?"right":"left"},u),i),A=ZV(Object.assign({textAlign:"right"===y?"right":"left"},m),i),k=ZV(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:JV(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=Tj({},A,ZV(b,void 0,{})),{width:s,height:n,text:r}=AV(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=Tj({},k,ZV(x,void 0,{})),{width:e,height:s,text:n}=AV(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(N){Y=Tj({},S,ZV(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}=AV(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,V=H+(O?T.title.spaceRow:0)}return P+=V,B+=V,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(Qy(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=SV(t,s),u=SV(l,c)}return s*=d,n*=d,Qy(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()}}kN.specKey="tooltip";const MN=(t,e)=>p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",TN=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 wN;const CN=(t=document.body)=>{if(u(wN)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),wN=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return wN};function EN(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}=Tj({},e,t),s={};return s.width=MN(i),s}(C),R=PN(E),L=PN(P),{bottom:O,left:I,right:D,top:F}=$F(h),j="right"===m?"marginLeft":"marginRight";return{align:m,panel:{width:MN(T+2*M),minHeight:MN(g+2*M),paddingBottom:MN(O),paddingLeft:MN(I),paddingRight:MN(D),paddingTop:MN(F),borderColor:k,borderWidth:MN(M),borderRadius:MN(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)?MN(null==r?void 0:r.spaceRow):"0px"},PN(Tj({},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 BN.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=BN.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==Jy?void 0:Jy.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(BN.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}}BN.type="tooltipModel";const RN={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},LN={boxSizing:"border-box"},ON={display:"inline-block",verticalAlign:"top"},IN={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},DN={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},FN={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},jN={lineHeight:"normal",boxSizing:"border-box"};class zN extends BN{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=TN(u),y=t=>new yg({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 HN extends BN{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 VN={overflowWrap:"normal",wordWrap:"normal"};class NN extends BN{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(Tj({},ON,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=Tj({},o?DN:IN,Object.assign(Object.assign(Object.assign({height:MN(l)},VN),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 Tj({},FN,Object.assign(Object.assign(Object.assign({height:MN(s)},VN),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 Tj({},jN,Object.assign(Object.assign({height:MN(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 GN extends BN{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 NN(this.product,this._option,t,e);return i.init(),this.children[i.childIndex]=i,i}setStyle(t){super.setStyle(Tj(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+TN(e)),0);return Object.assign(Object.assign({},t),{width:`${a+CN(this._option.getContainer())}px`,maxHeight:MN(s),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class WN extends BN{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 zN(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 HN(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(Tj({},RN,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 UN="99999999999999";class YN extends BN{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:UN,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 WN(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 GN(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(Tj({},LN,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 KN=t=>{hz.registerComponentPlugin(t.type,t)};class XN extends kN{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(XN.type),this.type=_N.dom,this._tooltipContainer=null==Jy?void 0:Jy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(Jy&&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=EN(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()}))}}XN.type=_N.dom;class $N extends kN{constructor(){super($N.type),this.type=_N.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 XP({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()}}$N.type=_N.canvas;const qN=()=>{KN($N)},ZN=(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},JN={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}},QN=(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=Xj([],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 tG(a,n,o)},tG=(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)=>{nb(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=>{nb(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]=JN[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},eG=(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=>{nb(t[e])||(t[e]=0)}))})),t};class iG extends DH{_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 sG=`${hB}_HIERARCHY_DEPTH`,nG=`${hB}_HIERARCHY_ROOT`,rG=`${hB}_HIERARCHY_ROOT_INDEX`;function aG(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function oG(t,e,i){t&&(i.needDefaultSeriesField&&(t[bD]=i.defaultSeriesField),t[_D]=e,t[yD]=i.getKey(t,e,i))}function lG(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function hG(t,e,i,s=0,n,r){void 0===r&&(r=e),oG(t,e,i),t[sG]=s,t[nG]=n||t[i.categoryField],t[rG]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>hG(e,s,i,t[sG]+1,t[nG],r)))}const cG=["appear","enter","update","exit","disappear","normal"];function dG(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 fG(n)&&delete n.type,n.oneByOne&&(n=pG(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:gG,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=Tj({},o[e],a);return fG(n)&&delete n.type,n.oneByOne&&(n=pG(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:gG,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s.state=s.update,s}function uG(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),vG(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 pG(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 gG(t,e){var i,s;return null!==(i=null==t?void 0:t[_D])&&void 0!==i?i:null===(s=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===s?void 0:s.elementIndex}function mG(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 fG(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function vG(t,e){if(y(t))t.forEach(((i,s)=>{t[s]=e(t[s],s),vG(t[s],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),vG(t[i],e)}class _G extends yH{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=EF(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=Pj(R(a,`series.${h}`),h,l,o),d=R(a,`series.${h}_${r}`);return Tj({},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),c(t.stackOffsetSilhouette)&&(this.stack=t.stackOffsetSilhouette||this.stack),p(t.stackValue)&&(this.stack=!0),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=Tj({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>Tj({},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 yG extends bH{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:`${hB}_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=_G,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=function(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)}(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)&&(Dz(this._rawData.dataSet,"invalidTravel",eG),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=Yz(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=Uz(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=Uz(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new iG(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;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){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];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):this._rawStatisticsCache[t]=tG(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t]}}return e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))&&(this._rawStatisticsCache[t].min=$(this._rawStatisticsCache[t].values),this._rawStatisticsCache[t].max=X(this._rawStatisticsCache[t].values)),this._rawStatisticsCache[t]}_statisticViewData(){Dz(this._dataSet,"dimensionStatistics",QN);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&&Xj(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){Dz(this._dataSet,"dimensionStatistics",QN);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=Xj(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&Xj(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)&&(Dz(this._rawData.dataSet,"addVChartProperty",ZN),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:aG.bind(this),call:oG}},!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=dG({},uG(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"}}:tb(s)||eb(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=Tj(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=Tj(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:Jz.STATE_HOVER_REVERSE,highlightState:Jz.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:Jz.STATE_SELECTED_REVERSE,state:Jz.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 t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:bD;this.getMarksWithoutRoot().forEach((t=>{const s={},n={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(s[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{n[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:xD,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][i]]:!0===s[t[i]]});const a={};Object.keys(n).forEach((e=>{a[e]=s=>{var n,a;let o;if(Array.isArray(s)){if(0===s.length)return;o=null===(n=r[s[0][i]])||void 0===n?void 0:n[e]}return o=null===(a=r[s[i]])||void 0===a?void 0:a[e],o||t.getAttribute(e,s)}})),this.setMarkStyle(t,a,xD)}))}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 oN(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=null!=i?i:{data:!0}).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((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||Kz(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()}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:bD,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new HF).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return RF(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:bD}}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()}`),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,Tj({},h,d||a[T.name]))}return T}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:yD}_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!==MD&&t!==wD&&t!==kD&&t!==TD||(t=this.getStackValueField()),null!==(e=qj(this.getRawData(),t))&&void 0!==e?e:t}getMarkInfoList(){var t;const e=super.getMarkInfoList();return e.length?e:Object.values(null!==(t=CF[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=>nb(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:bD]}}function bG(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();Dw(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 xG(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}}}yG.mark=ND,yG.transformerConstructor=_G;class SG extends yG{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);Dw(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:`${hB}_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(MD),this.setFieldX2(kD)):(this.setFieldY(MD),this.setFieldY2(kD))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(wD),this.setFieldX2(TD)):(this.setFieldY(wD),this.setFieldY2(TD))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(ED),this.setFieldX2(CD)):(this.setFieldY(ED),this.setFieldY2(CD))}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)&&(bG("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 AG="monotone",kG="linear";class MG{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($D.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:kG,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===AG?"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($D.point,{morph:mG(this._spec,$D.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:`${hB}_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(Pz.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:Jz.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[$D.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(Pz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,Tj({},this._spec[$D.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:Jz.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 TG extends zH{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)&&(Fw(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);let c=this._styleConvert(h);a&&"angle"===l&&(c=this.convertAngleToRadian(c)),this.setAttribute(l,c,e,i,s)})),o&&this.setEnableSegments(o)}}class wG extends TG{constructor(){super(...arguments),this.type=wG.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)===oB.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}wG.type="line";const CG=()=>{hz.registerMark(wG.type,wG),fM(),aM(),kR.registerGraphic(RB.line,Ag),JH()};class EG extends zH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class PG extends EG{constructor(){super(...arguments),this.type=PG.type}}PG.type="symbol";const BG=()=>{hz.registerMark(PG.type,PG),fO()};class RG extends _G{_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 LG extends eV{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function OG(t,e,i,s){switch(t){case r.cartesianBandAxis:return LV(_z(i,["z"]),"band",e);case r.cartesianLinearAxis:return LV(_z(i,["z"]),"linear",e);case r.cartesianLogAxis:return LV(_z(i,["z"]),"log",e);case r.cartesianSymlogAxis:return LV(_z(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return LV(_z(i),void 0,e);case r.polarBandAxis:return OV(i.orient,"band",e);case r.polarLinearAxis:return OV(i.orient,"linear",e);case r.polarAxis:return OV(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=TV(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>mz(t.orient)));let d;d=p(c)?Tj({},IV(c.type)?a:o,l):l;const u=n.find((t=>fz(t.orient)));let g;return g=p(u)?Tj({},jw(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=TV(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>"angle"===t.orient));let d;d=p(c)?Tj({},IV(c.type)?a:o,l):l;const u=n.find((t=>"radius"===t.orient));let g;return g=p(u)?Tj({},jw(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 IG(i,TV(t,e));default:return TV(t,e)}}const IG=(t,e)=>{var i;const s=Tj({},e,e[yz(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class DG extends yH{getTheme(t,e){return OG(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({},$F(e)),{[s]:0}))}}class FG extends SH{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 LG(this)}constructor(e,i){super(e,i),this.name="component",this.modelType="component",this.transformerConstructor=DG,this._delegateEvent=(e,i,s,n=null,r=null)=>{var a,o;i instanceof ec||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 _H({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}}}FG.transformerConstructor=DG;class jG extends zH{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(RB.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}jG.type="component";const zG=()=>{hz.registerMark(jG.type,jG)},HG=t=>t;class VG extends FG{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()?DB.circleAxisGrid:DB.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=dG(null===(o=hz.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 DH(this._option,t)]}collectData(t,e){const i=[];return sB(this._regions,(s=>{var n;let r=this.collectSeriesField(t,s);if(r=y(r)?Dw(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 sB(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=nB(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()})),sB(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(sB(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;tthis._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=az(s=t.domainLine)).startSymbol=az(s.startSymbol),s.endSymbol=az(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 lz(Tj({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:lz(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)=>lz(t[i](e.rawValue,s,e,n,r)):B(t[i])||(e[i]=lz(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 lz(Tj({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:lz(t.tick.style)),t.tick.state&&(i.tick.state=oz(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 lz(Tj({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:lz(t.subTick.style)),t.subTick.state&&(i.subTick.state=oz(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=CV[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?te(p):null,textStyle:Tj({},d,lz(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:lz(h.style)}),h.state&&(i.title.state.shape=oz(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:lz(o.style)}),o.state&&(i.title.state.background=oz(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=oz(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=lz(t.background.style)),t.background.state&&(i.panel.state=oz(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 lz(Tj({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:lz(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:lz(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=wV(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){Fz(this._option.dataSet,"scale",HG),Dz(this._option.dataSet,"ticks",UC);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)}}VG.specKey="axes";const NG=()=>{kR.registerGraphicComponent(IB.lineAxis,((t,e)=>new Cw(t,e))),kR.registerGraphicComponent(IB.circleAxis,(t=>new Rw(t))),kR.registerComponent(LB.axis,FO),kR.registerGraphicComponent(DB.lineAxisGrid,((t,e)=>new qC(t,e))),kR.registerGraphicComponent(DB.circleAxisGrid,((t,e)=>new JC(t,e))),kR.registerComponent(LB.grid,HO),zG(),hz.registerAnimation("axis",(()=>({appear:{custom:Ow},update:{custom:Lw},exit:{custom:Wc}})))},GG=[xV];class WG extends VG{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),sB(this._regions,(t=>{const e=this.getOrient();mz(e)?t.setXAxisHelper(this.axisHelper()):fz(e)?t.setYAxisHelper(this.axisHelper()):vz(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=Tj({x:t.x,y:t.y},this._axisStyle,n);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(Tj({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=mz(this.getOrient()),n=t=>{var e;return(s?!mz(t.getOrient()):mz(t.getOrient()))&&Dw(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=_z(i,["z"]),vz(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(!BV(e))return null;const{axisType:t,componentName:s}=bz(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=>fz(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(!BV(t))return;const{axisType:s,componentName:n}=bz(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=hz.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=[];mz(this.getOrient())?k(e)&&(o=this._inverse?[e-n,s]:[s,e-n]):vz(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(GG.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){mz(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&&!mz(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),!vz(this.getOrient())&&this._spec.innerOffset){const t=this._spec;fz(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=KF(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=KF(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=mz(this.getOrient())?t.fieldX:vz(this.getOrient())?t.fieldZ:t.fieldY,Dw(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:Dw(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&&(mz(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=mz(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 sB(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]:mz(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:vz(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();sB(this._regions,(e=>{mz(t)?(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):fz(t)?(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):vz(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=mz(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=mz(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=Tj(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 DV(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}=PV(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>=UG?10:n>=YG?5:n>=KG?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 $G extends WG{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new TC}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}}$G.type=r.cartesianLinearAxis,$G.specKey="axes",U($G,XG);const qG=()=>{NG(),hz.registerComponent($G.type,$G)};class ZG{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=DV(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=>DV(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 JG extends WG{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new rC}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{NG(),hz.registerComponent(JG.type,JG)};class tW extends $G{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),sB(this._regions,(t=>{mz(this.getOrient())?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=Tj({},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 DH(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=>DV(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=>DV(e.value,this._getNormalizedValue([e.value],t))))),s}transformScaleDomain(){}}tW.type=r.cartesianTimeAxis,tW.specKey="axes";class eW extends $G{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new EC}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(){}}eW.type=r.cartesianLogAxis,eW.specKey="axes",U(eW,XG);class iW extends $G{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new PC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}transformScaleDomain(){}}iW.type=r.cartesianSymlogAxis,iW.specKey="axes",U(iW,XG);class sW extends SG{constructor(){super(...arguments),this.type=oB.line,this.transformerConstructor=RG,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(dG(null===(i=hz.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),uG("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=xG(this);this._symbolMark.setAnimationConfig(dG(null===(s=hz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),uG("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]}}sW.type=oB.line,sW.mark=qD,sW.transformerConstructor=RG,U(sW,MG);class nW{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)=>{Kz(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 rW{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)=>{rb(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{Xj(e,[{key:t,operations:Dw(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&&Xj(e,[{key:i.field,operations:Dw(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?NF("colorOrdinal"):NF(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(rb(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),rb(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(!rb(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=Dw(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=Dw(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;Dw(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(Dw(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=Dw(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)));Dw(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 aW{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=Zj(t,!0);for(const e in a)for(const i in a[e].nodes)ez(a[e].nodes[i],t.getStackInverse(),n);if(r)for(const t in a)for(const e in a[t].nodes)tz(a[t].nodes[e]);s&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&Qj(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 oW extends pH{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=sb(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:cB,height:dB},this._viewRect={width:cB,height:dB},this._viewBox={x1:0,y1:0,x2:cB,y2:dB},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=$F(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new Rz(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new nW(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._spec.background&&"object"==typeof this._spec.background&&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 aW(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=function(t){if(!t)return null;if("string"==typeof t)return{fill:t,fillOpacity:1};if("object"!=typeof t)return null;const e=H(t,["x","y","width","height","x1","y1","image"]);return e.background=t.image,e}(this._spec.background);t&&(this._backgroundMark=hz.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({},t),{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=hz.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 bH)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 zH))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof zH)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&&Kz(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=nH(this._spec,this._option,{width:cB,height:dB})),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=RF(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new rW(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){rH(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=RF(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{rH(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{var s,n;const r=i.specKey||i.type,a=null!==(s=this._spec[r])&&void 0!==s?s:{};y(a)?(e[r]=e[r]||{specCount:a.length,componentCount:0},e[r].componentCount++,rH(t,i.updateSpec(null!==(n=a[i.getSpecIndex()])&&void 0!==n?n:{},a))):rH(t,i.updateSpec(a))}));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()];rH(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=XF(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(Jz.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(Jz.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(Jz.STATE_SELECTED)}clearHovered(){this.clearState(Jz.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===Pz.dimensionHover||s===Pz.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>jw(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=>{r?i[t.series.fieldY[0]]=s:i[t.series.fieldX[0]]=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 lW=(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 hW{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);xj(t,r,l.spec),xj(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}));xj(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=lW(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=lW(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(hz.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(hz.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=hz.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=hz.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=hz.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 cW extends hW{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")&&Tj(i,aH(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 dW extends cW{_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),sH(t)}}class uW extends oW{constructor(){super(...arguments),this.transformerConstructor=dW,this.type="line",this.seriesType=oB.line,this._canStack=!0}}uW.type="line",uW.seriesType=oB.line,uW.transformerConstructor=dW;class pW extends TG{constructor(){super(...arguments),this.type=pW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}pW.type="area";const gW=()=>{hz.registerMark(pW.type,pW),fM(),qk(),kR.registerGraphic(RB.area,Ug),JH()};class mW extends oN{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 fW=()=>{hz.registerAnimation("area",qH),ZH(),XH()};class vW extends RG{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=Tj({},m.style,g.style),l.state=Tj({},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 _W extends SG{constructor(){super(...arguments),this.type=oB.area,this.transformerConstructor=vW,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(_W.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===AG?"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 GF(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 GF(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(dG(null===(e=hz.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),uG("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(dG(null===(i=hz.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),uG("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=xG(this);this._symbolMark.setAnimationConfig(dG(null===(s=hz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),uG("point",this._spec,this._markAttributeContext),t))}}initTooltip(){this._tooltipHelper=new mW(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}}}_W.type=oB.area,_W.mark=JD,_W.transformerConstructor=vW,U(_W,MG);class yW extends cW{_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),sH(t)}}class bW extends oW{constructor(){super(...arguments),this.transformerConstructor=yW,this.type="area",this.seriesType=oB.area,this._canStack=!0}}bW.type="area",bW.seriesType=oB.area,bW.transformerConstructor=yW;function xW(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 SW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:xW(t,e)}),AW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:xW(t,e)}),kW={type:"fadeIn"},MW={type:"growCenterIn"};function TW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return kW;case"scaleIn":return MW;default:return SW(t)}}class wW extends zH{constructor(){super(...arguments),this.type=wW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}wW.type="rect";const CW=()=>{hz.registerMark(wW.type,wW),gO(),uO.useRegisters([VI,NI,GI,WI,zI,HI])};function EW(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[GD]):this._spec.barMinHeight?this._calculateRectPosition(t,!1):GF(this._dataToPosX(t),e),this._getBarXEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[WD]):GF(this._dataToPosX1(t),e),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[UD]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):GF(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[YD]):GF(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({},RW.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{morph:mG(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(RW.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(Dz(this._option.dataSet,"addVChartProperty",ZN),s){const t=([t],{scaleDepth:e})=>{var i;let s=[{}];const n=this.getDimensionField(),r=u(e)?n.length:Math.min(n.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};Dz(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:aG.bind(this),call:oG}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new iG(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=YD,s=UD,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=WD,s=GD,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=Zj(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)EW(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=GF(this[n](t),o),d=GF(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[kD],n=t[MD],r=t[TD],h=t[wD];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]),{[kD]:i,[MD]:s}),a?{[TD]:o,[wD]:l}:void 0);t.push(Tg(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=>GF(this._dataToPosY(t),a),y1:t=>GF(this._dataToPosY1(t),a)}:{y:t=>GF(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=>GF(this._dataToPosX(t),r),x1:t=>GF(this._dataToPosX1(t),r)}:{x:t=>GF(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=xG(this);this._barMark.setAnimationConfig(dG(null===(e=hz.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),uG(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;if(void 0!==this._spec.barWidth&&r===n)return ZF(this._spec.barWidth,a);const o=void 0!==this._spec.barMinWidth,l=void 0!==this._spec.barMaxWidth;let h=a;return o&&(h=Math.max(h,ZF(this._spec.barMinWidth,a))),l&&(h=Math.min(h,ZF(this._spec.barMaxWidth,a))),h}_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=ZF(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=Dw(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}}RW.type=oB.bar,RW.mark=KD,RW.transformerConstructor=BW;const LW=()=>{iI(),CW(),hz.registerAnimation("bar",((t,e)=>({appear:TW(t,e),enter:SW(t,!1),exit:AW(t,!1),disappear:AW(t)}))),QG(),qG(),hz.registerSeries(RW.type,RW)};class OW extends cW{_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),sH(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 IW extends oW{constructor(){super(...arguments),this.transformerConstructor=OW,this.type="bar",this.seriesType=oB.bar,this._canStack=!0}}IW.type="bar",IW.seriesType=oB.bar,IW.transformerConstructor=OW;class DW extends zH{constructor(){super(...arguments),this.type=DW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}DW.type="rect3d";class FW extends RW{constructor(){super(...arguments),this.type=oB.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d"}}FW.type=oB.bar3d,FW.mark=XD;class jW extends OW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}class zW extends IW{constructor(){super(...arguments),this.transformerConstructor=jW,this.type="bar3d",this.seriesType=oB.bar3d}}zW.type="bar3d",zW.seriesType=oB.bar3d,zW.transformerConstructor=jW;const HW=[10,20],VW=Pw.Linear,NW="circle",GW=Pw.Ordinal,WW=["circle","square","triangle","diamond","star"],UW=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class YW extends _G{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class KW extends SG{constructor(){super(...arguments),this.type=oB.scatter,this.transformerConstructor=YW,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=`${hB}_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=`${hB}_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:VW,defaultRange:HW},"size")}getShapeAttribute(t,e){return u(e)?NW:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:GW,defaultRange:WW},"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(KW.mark.point,{morph:mG(this._spec,KW.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=xG(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(dG(null===(i=hz.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),uG("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:NW},Jz.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},Jz.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},Jz.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},Jz.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},Jz.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]}}KW.type=oB.scatter,KW.mark=ZD,KW.transformerConstructor=YW;const XW=()=>{BG(),hz.registerAnimation("scatter",((t,e)=>Object.assign({appear:UW(0,e)},YH))),QG(),qG(),hz.registerSeries(KW.type,KW)};class $W extends cW{_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 qW extends oW{constructor(){super(...arguments),this.transformerConstructor=$W,this.type="scatter",this.seriesType=oB.scatter,this._canStack=!0}}qW.type="scatter",qW.seriesType=oB.scatter,qW.transformerConstructor=$W;Ln();const ZW={},JW=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function QW(t,e){t&&_(t)||lb("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(ZW[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 JW.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}(i,e)),ZW[i]||null}const tU={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(tU).forEach((t=>{QW(t,tU[t])}));const eU="Feature",iU="FeatureCollection";function sU(t){const e=Y(t);return 1===e.length?e[0]:{type:iU,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===iU?t.features:Y(t).filter((t=>!u(t))).map((t=>t.type===eU?t:{type:eU,geometry:t}))}(e))),[])}}const nU=JW.concat(["pointRadius","fit","extent","size"]);function rU(t,e){let i=[];return t?(Object.keys(t).forEach((s=>{nU.includes(s)&&(i=i.concat(dR(t[s],e)))})),i):i}let aU=class extends $R{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(dR(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(dR(t,this.view)),this.commit(),this}size(t){return u(this.spec.size)||this.detach(dR(this.spec.size,this.view)),this.spec.size=t,this.attach(dR(t,this.view)),this.commit(),this}extent(t){return u(this.spec.extent)||this.detach(dR(this.spec.extent,this.view)),this.spec.extent=t,this.attach(dR(t,this.view)),this.commit(),this}fit(t){return u(this.spec.fit)||this.detach(dR(this.spec.fit,this.view)),this.spec.fit=t,this.attach(dR(t,this.view)),this.commit(),this}configure(t){return this.detach(rU(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(rU(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=QW((t||"mercator").toLowerCase());return e||lb("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),JW.forEach((t=>{u(this.spec[t])||function(t,e,i){d(t[e])&&t[e](i)}(this.projection,t,pR(this.spec[t],e,QW))})),u(this.spec.pointRadius)||this.projection.path.pointRadius(pR(this.spec.pointRadius,e,QW)),!(u(this.spec.fit)||u(this.spec.extent)&&u(this.spec.size))){const t=sU(pR(this.spec.fit,e,QW));this.spec.extent?this.projection.fitExtent(pR(this.spec.extent,e,QW),t):this.spec.size&&this.projection.fitSize(pR(this.spec.size,e,QW),t)}return this.projection}output(){return this.projection}};const oU=(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 lU extends yG{constructor(){super(...arguments),this.type=oB.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=`${hB}_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 hU=`${hB}_MAP_LOOK_UP_KEY`,cU=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[_D]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[hU]=e.nameMap[n]:t[hU]=n})),t.features);class dU extends oN{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 uU extends zH{constructor(){super(...arguments),this.type=uU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}uU.type="path";const pU=()=>{hz.registerMark(uU.type,uU),pO()};class gU{constructor(t){this.projection=QW(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 mU{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 fU{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 vU(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:mU}:tb(e)||eb(e)?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:fU}:null}const _U={debounce:xt,throttle:St};class yU{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=tb(this._renderMode)||eb(this._renderMode),vU(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return vU(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;u(n)||De({x:r,y:a},this._getRegionOrSeriesLayout(e),!1)&&(i&&i({zoomDelta:n,zoomX:r,zoomY:a},s),this._eventObj.emit("zoom",{scale:s.zoomDelta,scaleCenter:{x:s.zoomX,y:s.zoomY},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,_U[o]((t=>{this._zoomableTrigger.clearZoom()}),l)),h.on(...c,_U[o]((t=>{this._zoomEventDispatch(t,i,s)}),l))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||vU(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||vU(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,_U[o]((t=>{this._zoomableTrigger.clearScroll()}),l)),h.on(...c,_U[o]((t=>this._scrollEventDispatch(t,i,s)),l))}initScrollEventOfSeries(t,e,i){vU(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||vU(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||vU(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||vU(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=_U[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)}),l),_=_U[o]((t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1;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 bU(t,e){return`${hB}_${e}_${t}`}class xU extends FG{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:bU(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),e&&(e.zoomDelta=l),this.zoom(l,[t.zoomX,t.zoomY]),l},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=Tj(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},s=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,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 gU(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===oB.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),sB(this._regions,(t=>{var e;if(t.type===oB.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===oB.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[hU],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}}xU.type=r.geoCoordinate,U(xU,yU);const SU=()=>{hz.registerComponent(xU.type,xU)};class AU extends _G{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class kU extends lU{constructor(){super(...arguments),this.type=oB.map,this.transformerConstructor=AU,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 !`),jz.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),Dz(this._dataSet,"copyDataView",Wz),Dz(this._dataSet,"map",cU),Dz(this._dataSet,"lookup",oU);const i=jz.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:Xz.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:hU,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 iG(this._option,s)}initMark(){this._pathMark=this._createMark(kU.mark.area,{morph:mG(this._spec,kU.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:bD])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:bD]):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(dG(null===(t=hz.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),uG("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new dU(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[_D]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[_D],{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 _D}getActiveMarks(){return[this._pathMark]}}kU.type=oB.map,kU.mark=sF,kU.transformerConstructor=AU;const MU=()=>{kR.registerGrammar("projection",aU,"projections"),SU(),pU(),hz.registerSeries(kU.type,kU),hz.registerImplement("registerMap",Vz),hz.registerImplement("unregisterMap",Nz),$H()},TU=(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[RD]=!0:delete t[RD]})),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=wU([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}=CU(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=wU(a,t,n,r,h,l,i,e),r.push(n)})),r};function wU(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}=CU(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===pD)&&(t[pD]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function CU(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?Xy("total.collectCountField error"):n=e[a].start;o<0?Xy("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 EU=(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},PU={type:"fadeIn"},BU={type:"growCenterIn"};function RU(t,e){switch(e){case"fadeIn":return PU;case"scaleIn":return BU;default:return SW(t,!1)}}class LU extends zH{constructor(){super(...arguments),this.type=LU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}LU.type="rule";const OU=()=>{hz.registerMark(LU.type,LU),mO()},IU=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:DU(t.map((t=>t.latestData)).flat(),e.fields,i)}};function DU(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)=>DU(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class FU{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"}),Dz(e,"dimensionTree",IU),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 jU extends BW{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel")}}const zU={rect:WU,symbol:NU,arc:YU,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=NU(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1);return e},stackLabel:KU,line:XU,area:XU,rect3d:WU,arc3d:YU,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function HU(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}=wV(i,s,o.text,e);return h&&(o.text=h(...c,{series:a})),o}function VU(t){return d(t)?e=>t(e.data):t}function NU(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=VU(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:GU(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function GU(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function WU(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=VU(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:UU(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function UU(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 YU(t){var e;const{labelSpec:i}=t,s=null!==(e=VU(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 KU(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=HU(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),mp(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 XU(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 $U extends RW{constructor(){super(...arguments),this.type=oB.waterfall,this.transformerConstructor=jU,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 FU(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=pD)}getSeriesKeys(){return this._seriesField===pD?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),Dz(this._dataSet,"waterfallFillTotal",EU),Dz(this._dataSet,"waterfall",TU),(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=Uz(this.getViewData(),this._dataSet,{name:`${hB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new iG(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:kD,endAs:MD,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=xG(this);this._barMark.setAnimationConfig(dG(null===(i=hz.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),uG("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(dG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),uG("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($U.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){if(!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible))return super.initLabelMarkStyle(t),void(this._labelMark=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 KU(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?GF(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):GF(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))}}$U.type=oB.waterfall,$U.mark=uF,$U.transformerConstructor=jU;const qU=()=>{OU(),CW(),hz.registerAnimation("waterfall",((t,e)=>({appear:RU(t,e),enter:SW(t,!1),exit:AW(t,!1),disappear:AW(t,!1)}))),$H(),QG(),qG(),hz.registerSeries($U.type,$U)},ZU=`${hB}_BOX_PLOT_OUTLIER_VALUE`;var JU;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(JU||(JU={}));const QU=(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={[ZU]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class tY extends oN{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===JU.OUTLIER)return this.series.getOutliersField();if(t===JU.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case JU.MIN:return this.series.getMinField();case JU.MAX:return this.series.getMaxField();case JU.MEDIAN:return this.series.getMedianField();case JU.Q1:return this.series.getQ1Field();case JU.Q3:return this.series.getQ3Field();case JU.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===JU.OUTLIER)return e[ZU];if(t===JU.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case JU.MIN:return e[this.series.getMinField()];case JU.MAX:return e[this.series.getMaxField()];case JU.MEDIAN:return e[this.series.getMedianField()];case JU.Q1:return e[this.series.getQ1Field()];case JU.Q3:return e[this.series.getQ3Field()];case JU.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[ZU])}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.getContentKey(JU.OUTLIER),value:this.getContentValue(JU.OUTLIER),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(JU.MAX),value:this.getContentValue(JU.MAX),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(JU.Q3),value:this.getContentValue(JU.Q3),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(JU.MEDIAN),value:this.getContentValue(JU.MEDIAN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(JU.Q1),value:this.getContentValue(JU.Q1),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(JU.MIN),value:this.getContentValue(JU.MIN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(JU.SERIES_FIELD),value:this.getContentValue(JU.SERIES_FIELD),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]}}}class eY extends zH{constructor(){super(...arguments),this.type=eY.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}}eY.type="boxPlot";const iY=()=>{hz.registerMark(eY.type,eY),kR.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(SO).registerChannelEncoder("x",((t,e,i,s,n,r)=>r&&yb(r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,s,n,r)=>r&&yb(r.direction)?{shaft:{y:e,y1:e}}:null)).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&yb(r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&yb(r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&yb(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&&yb(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&&yb(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&&yb(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}}))),kR.registerAnimationType("boxplotScaleIn",AO),kR.registerAnimationType("boxplotScaleOut",kO),_O(),gO(),mO(),kR.registerGlyph("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(TO).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&yb(r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&yb(r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&yb(r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&yb(r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&yb(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}}))),kR.registerAnimationType("barBoxplotScaleIn",wO),kR.registerAnimationType("barBoxplotScaleOut",CO),_O(),gO(),mO()};class sY extends SG{constructor(){super(...arguments),this.type=oB.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(sY.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(sY.mark.outlier,{progressive:t,key:_D,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,Jz.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"},Jz.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=>GF(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>GF(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>GF(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>GF(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>GF(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},Jz.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=>GF(e(this.getDatumPositionValues(t,ZU),{bandPosition:this._bandPosition}),s)}:{x:this.dataToPositionX.bind(this),y:t=>GF(e(this.getDatumPositionValues(t,ZU),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,Jz.STATE_NORMAL,t.AttributeLevel.Series)}}initData(){if(super.initData(),!this._data)return;Dz(this._dataSet,"foldOutlierData",QU),Dz(this._dataSet,"addVChartProperty",ZN);const t=new ya(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${hB}_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:aG.bind(this),call:oG}},!1),this._outlierDataView=new iG(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=xG(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=hz.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(uG("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(dG(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(dG(null===(a=hz.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new tY(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]}}sY.type=oB.boxPlot,sY.mark=pF;class nY extends zH{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=nY.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})}}nY.type="text";const rY=()=>{hz.registerMark(nY.type,nY),vO(),fM(),gM(),kR.registerGraphic(RB.richtext,zg)};function aY(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 oY extends oN{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 lY=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),hY={type:"fadeIn"},cY=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function dY(t,e){return"fadeIn"===e?hY:lY(t)}class uY extends BW{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 pY extends RW{constructor(){super(...arguments),this.type=oB.rangeColumn,this._barMarkType="rect",this._barName=oB.bar,this.transformerConstructor=uY}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(pY.mark.bar,{morph:mG(this._spec,pY.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(pY.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(pY.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}});aY(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}});aY(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=xG(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(dG(null===(i=hz.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),uG("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(dG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),uG("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(dG(null===(n=hz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),uG("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new oY(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)}}pY.type=oB.rangeColumn,pY.mark=yF,pY.transformerConstructor=uY;const gY=()=>{CW(),rY(),hz.registerAnimation("rangeColumn",((t,e)=>({appear:dY(t,e),enter:lY(t),exit:cY(t),disappear:cY(t)}))),$H(),QG(),qG(),hz.registerSeries(pY.type,pY)};class mY extends pY{constructor(){super(...arguments),this.type=oB.rangeColumn3d,this._barMarkType="rect3d",this._barName=oB.bar3d}}mY.type=oB.rangeColumn3d,mY.mark=bF;class fY extends oN{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 vY extends _W{constructor(){super(...arguments),this.type=oB.rangeArea}initMark(){var t;const{customShape:e,stateSort:i}=null!==(t=this._spec.area)&&void 0!==t?t:{};this._areaMark=this._createMark(vY.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 fY(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))}}vY.type=oB.rangeArea,vY.mark=kF;class _Y extends yG{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=EB,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:[]};Dw(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:[]};Dw(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)&&bG(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 yY=(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[_B],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[_B]*t;g(e,b,i),b+=i}))}return 0!==m&&(i[i.length-1][l]=r),i};function bY(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const xY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:bY(t,!0,qz.appear)}),SY={type:"fadeIn"},AY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:bY(t,!0,qz.enter)}),kY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:bY(t,!0,qz.exit)}),MY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:bY(t,!0,qz.exit)});function TY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return SY;case"growRadius":return xY(Object.assign(Object.assign({},t),{growField:"radius"}));default:return xY(Object.assign(Object.assign({},t),{growField:"angle"}))}}class wY extends zH{constructor(t,e){super(t,e),this.type=CY.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[AB])[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 CY extends wY{constructor(){super(...arguments),this.type=CY.type}}CY.type="arc";const EY=()=>{fM(),Xk(),kR.registerGraphic(RB.arc,Xg),uO.useRegisters([QI,tD,ZI,JI]),hz.registerMark(CY.type,CY)};class PY extends _G{_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=Tj({},this._theme,i,t);const n=(t,e)=>Tj({},"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 BY extends _Y{constructor(){super(...arguments),this.transformerConstructor=PY,this._pieMarkName="pie",this._pieMarkType="arc",this._startAngle=TB,this._endAngle=wB,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this.dataToCentralPosition=t=>{const e=t[AB];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;Dz(this._dataSet,"pie",yY),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:bB,asEndAngle:xB,asRatio:yB,asMiddleAngle:AB,asRadian:MB,asQuadrant:kB,asK:SB}},!1);const e=new ya(this._dataSet,{name:`${hB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new iG(this._option,e)}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},BY.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{morph:mG(this._spec,this._pieMarkName),defaultMorphElementKey:this._seriesField,key:yD,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 aB(bB)(t)}endAngleScale(t){return aB(xB)(t)}initMarkStyle(){const e=this._pieMark;e&&this.setMarkStyle(e,{x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:WF(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:WF(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:aB(mB).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[AB];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===qz.appear)return this._startAngle;if(i===qz.disappear)return this._endAngle;const n=[qz.disappear,qz.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[_D];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[_D]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[_D])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[_D])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+se({x:0,y:0},a,e[AB]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+se({x:0,y:0},a,e[AB]).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[AB]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+se({x:0,y:0},a,e[AB]).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]}}BY.transformerConstructor=PY,BY.mark=tF;class RY extends BY{constructor(){super(...arguments),this.type=oB.pie}}RY.type=oB.pie;const LY=()=>{EY(),hz.registerAnimation("pie",((t,e)=>({appear:TY(t,e),enter:AY(t),exit:kY(t),disappear:MY(t)}))),hz.registerSeries(RY.type,RY)};class OY extends wY{constructor(){super(...arguments),this.type=OY.type,this._support3d=!0}}OY.type="arc3d";class IY extends PY{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class DY extends BY{constructor(){super(...arguments),this.type=oB.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=IY}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[AB];return"inside"===i.position?ee(e):0},this.setMarkStyle(e,Object.assign(Object.assign({},s),{z:100}),void 0,t.AttributeLevel.Mark)}}DY.type=oB.pie3d,DY.mark=eF,DY.transformerConstructor=IY;const FY=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)=>e.getGraphicAttribute("innerRadius")},outerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("outerRadius")}}}},jY={type:"fadeIn"},zY=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),HY=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),VY=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function NY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return jY;case"growAngle":return FY(Object.assign(Object.assign({},t),{growField:"angle"}));default:return FY(Object.assign(Object.assign({},t),{growField:"radius"}))}}class GY extends _Y{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(MD),this.setInnerRadiusField(kD)}setValueFieldToPercent(){this.setRadiusField(wD),this.setInnerRadiusField(TD)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}class WY extends _G{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}const UY=(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:CB,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:EB,layoutRadius:e.layoutRadius}};class YY extends VG{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(!RV(e))return null;const{axisType:i,componentName:s,startAngle:n,endAngle:r,center:a,outerRadius:o,layoutRadius:l}=UY(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(!RV(e))return;const{axisType:a,componentName:o,startAngle:l,endAngle:h,center:c,outerRadius:d,layoutRadius:u}=UY(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=hz.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=TB,this._endAngle=wB,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),sB(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:EV(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(){sB(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 Dw(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:Dw(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:KF(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:KF(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=>DV(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=EB,e=0;const i=this.getChart().getSpec();return sB(this.getRegions(),(s=>{const n=s;if(r=n.type,[oB.rose,oB.radar,oB.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(Tj({},this._axisStyle,s)),this._gridMark){this._gridMark.getProduct().encode(Tj({},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)}}YY.type=r.polarAxis,YY.specKey="axes";class KY extends YY{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new TC}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}}KY.type=r.polarLinearAxis,KY.specKey="axes",U(KY,XG);const XY=()=>{NG(),hz.registerComponent(KY.type,KY)};class $Y extends YY{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new rC}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(){}}$Y.type=r.polarBandAxis,$Y.specKey="axes",U($Y,ZG);const qY=()=>{NG(),hz.registerComponent($Y.type,$Y)};class ZY extends GY{constructor(){super(...arguments),this.type=oB.rose,this.transformerConstructor=WY,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(ZY.mark.rose,{morph:mG(this._spec,ZY.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=>GF(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=GF(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(dG(null===(i=hz.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),uG("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}ZY.type=oB.rose,ZY.mark=iF,ZY.transformerConstructor=WY;const JY=()=>{hz.registerSeries(ZY.type,ZY),EY(),hz.registerAnimation("rose",((t,e)=>({appear:NY(t,e),enter:zY(t),exit:HY(t),disappear:VY(t)}))),qY(),XY()};class QY extends mc{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);k(t*e)||(this.valid=!1),this._fromAngle=t,this._fromRadius=e;const{angle:i,radius:s}=this._pointToCoord(this.to);k(i*s)||(this.valid=!1),this._toAngle=i,this._toRadius=s}onUpdate(t,e,i){if(!1!==this.valid)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 tK extends Hc{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}),r=re(s.angle),a=re(n.angle),o=this._pointToCoord(e),l=this._pointToCoord({x:e.x1,y:e.y1}),h=re(o.angle),c=re(l.angle),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 eK=t=>({type:"in"===t?"fadeIn":"fadeOut"});function iK(t,e,i){return"fadeIn"===e?eK(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function sK(t,e,i){return"fadeIn"===e?eK(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 nK=(t,e)=>({custom:Nc,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 rK extends GY{constructor(){super(...arguments),this.type=oB.radar,this.transformerConstructor=RG,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(rK.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:kG,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):TB,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(dG(null===(s=hz.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),uG("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=hz.getAnimationInKey(e);t.setAnimationConfig(dG(null==i?void 0:i(n,r),uG(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}}}rK.type=oB.radar,rK.mark=QD,rK.transformerConstructor=RG,U(rK,MG);const aK=()=>{hz.registerSeries(rK.type,rK),sI(),gW(),CG(),BG(),hz.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:iK(t,e,"in"),enter:iK(t,e,"in"),exit:iK(t,e,"out"),disappear:"clipIn"===e?void 0:iK(t,e,"out"),update:[{options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:tK,customParameters:t,duration:UH.update.duration,easing:UH.update.easing}]}))),hz.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:sK(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:sK(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:QY,customParameters:t,duration:UH.update.duration,easing:UH.update.easing}]}))),hz.registerAnimation("radarGroup",((t,e)=>({appear:nK(t,"in"),disappear:nK(t,"out")}))),Xk(),qY(),XY()};class oK extends oN{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 lK=(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},hK={fill:"#bbb",fillOpacity:.2};class cK extends SG{constructor(){super(...arguments),this.type=oB.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]])),Dz(this._option.dataSet,"objFlat",lK),Dz(this._option.dataSet,"copyDataView",Wz),Fz(this._option.dataSet,"dataview",ga),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:Xz.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(Tj(hK,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(cK.mark.group),this._containerMark=this._createMark(cK.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(cK.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(cK.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(cK.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(cK.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(cK.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(cK.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:bD}}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 HF).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:bD}}initTooltip(){this._tooltipHelper=new oK(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]}}cK.type=oB.dot,cK.mark=oF;class dK extends oN{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 uK=(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 pK extends SG{constructor(){super(...arguments),this.type=oB.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(),Dz(this._option.dataSet,"linkDotInfo",uK),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:Xz.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(pK.mark.group),this._containerMark=this._createMark(pK.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(pK.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(pK.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:bD}}initInteraction(){const t=[];this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new dK(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]}}pK.type=oB.link,pK.mark=aF;class gK extends _Y{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()?kD:LD],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()?MD: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):TB;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?te(r):wB,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=GF(this.angleAxisHelper.dataToPosition([t[kD]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=GF(this.angleAxisHelper.dataToPosition([t[MD]]),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(gK.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 Xg(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[Tg({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 vK=()=>{hz.registerAnimation("circularProgress",((t,e)=>({appear:fK(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class _K extends _G{constructor(){super(...arguments),this._supportStack=!0}}class yK extends gK{constructor(){super(...arguments),this.type=oB.circularProgress,this.transformerConstructor=_K,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(yK.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(yK.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()?kD:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?MD: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(dG(null===(i=hz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),uG("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(dG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),uG("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}yK.type=oB.circularProgress,yK.mark=rF,yK.transformerConstructor=_K;function bK(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const xK=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:bK(t)}),SK={type:"fadeIn"};function AK(t,e){return!1===e?{}:"fadeIn"===e?SK:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:bK(t)}))(t)}class kK extends oN{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 MK extends SG{constructor(){super(...arguments),this.type=oB.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(MK.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 GF(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 GF(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 GF(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 GF(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(MK.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 GF(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 GF(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(MK.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=GF(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(Tg({x:i,y:0,height:r,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=GF(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(Tg({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(dG(null===(i=hz.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),uG("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(dG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),uG("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new kK(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}MK.type=oB.linearProgress,MK.mark=dF;const TK=()=>{CW(),hz.registerAnimation("linearProgress",((t,e)=>({appear:AK(t,e),enter:{type:"grow"},disappear:xK(t)}))),$H(),hz.registerSeries(MK.type,MK)},wK=[0],CK=[20,40],EK=[200,500],PK={shrink:!1,enlarge:!1,fontSizeLimitMin:0},BK=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],RK=`${hB}_WORD_CLOUD_WEIGHT`,LK=`${hB}_WORD_CLOUD_TEXT`;class OK extends yG{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=CK}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:EK,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:wK,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)?LK:this._nameField,this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:PK},this._spec.wordCloudConfig),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:wK,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=!BK.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(OK.mark.word,{key:yD,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(dG(hz.getAnimationInKey("wordCloud")(n,s),uG("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 HF).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:bD])}}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 TC,o=this._fontWeightRange;if(r){const[e,i]=pb(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:RK,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:LK,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:Qy(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[r,a],shape:this._maskShape,dataIndexKey:yD,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:RK}: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:yD,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:RK}: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)}}OK.mark=lF;function IK(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)||UH.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 FK(){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 jK(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 zK=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function HK(t){return d(t)?t:function(){return t}}class VK{constructor(t){var e,i,s;switch(this.options=z({},VK.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=(s=this.options.shape,DK[s]?DK[s]():DK.circle()),this.getText=null!==(e=HK(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=HK(this.options.fontWeight),this.getTextFontSize=HK(this.options.fontSize),this.getTextFontStyle=HK(this.options.fontStyle),this.getTextFontFamily=HK(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>zK(10,50);break;case"random-light":this.getTextColor=()=>zK(50,90);break;default:this.getTextColor=HK(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 GK extends VK{constructor(t){var e;super(z({},GK.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<=GK.defaultOptions.minFontSize&&(this.options.minFontSize=GK.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=NK[this.options.spiral])&&void 0!==e?e:NK.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=HK(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}=jK(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(P_.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(KK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(YK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}KK(p,this._size)&&(p=XK(p,this._size))}else if(KK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||UK(p,i))&&(!i||!WK(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 WK(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 UK(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,KK=(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 XK(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}=jK(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)}qK.defaultOptions={enlarge:!1};const JK={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},QK=(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?tX(t.fontFamily):"sans-serif",d=t.fontStyle?tX(t.fontStyle):"normal",u=t.fontWeight?tX(t.fontWeight):"normal",p=t.rotate?tX(t.rotate):0,g=tX(t.text),m=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",f=t.padding?tX(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||JK,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?tX(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=iX(sX(t,l),C);w=i=>e(t(i))}let E=GK;"fast"===t.layoutType?E=qK:"grid"===t.layoutType&&(E=$K);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()},tX=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],eX=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),iX=(t,e)=>{if(t[0]===t[1])return t=>e[0];const i=eX(t[0]),s=eX(t[1]),n=Math.min(i,s),r=Math.max(i,s);return t=>(eX(t)-n)/(r-n)*(e[1]-e[0])+e[0]},sX=(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 nX(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{kR.registerTransform("wordcloud",{transform:QK,markPhase:"beforeJoin"},!0),rY(),hz.registerAnimation("wordCloud",((t,e)=>({appear:IK(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),hz.registerSeries(rX.type,rX)};(class extends OK{constructor(){super(...arguments),this.type=oB.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(OK.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(dG(null===(e=hz.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}})),uG("word",this._spec,this._markAttributeContext)))}}).type=oB.wordCloud3d;const oX=(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},lX=(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},hX=`${hB}_FUNNEL_TRANSFORM_RATIO`,cX=`${hB}_FUNNEL_REACH_RATIO`,dX=`${hB}_FUNNEL_HEIGHT_RATIO`,uX=`${hB}_FUNNEL_VALUE_RATIO`,pX=`${hB}_FUNNEL_LAST_VALUE_RATIO`,gX=`${hB}_FUNNEL_NEXT_VALUE_RATIO`,mX=`${hB}_FUNNEL_LAST_VALUE`,fX=`${hB}_FUNNEL_CURRENT_VALUE`,vX=`${hB}_FUNNEL_NEXT_VALUE`,_X=`${hB}_FUNNEL_TRANSFORM_LEVEL`,yX=20;class bX extends oN{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[cX])).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 xX extends zH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class SX extends xX{constructor(){super(...arguments),this.type=SX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}SX.type="polygon";const AX=()=>{hz.registerMark(SX.type,SX),fM(),cM(),kR.registerGraphic(RB.polygon,Zg),uO.useRegisters([UI,YI])};class kX extends _G{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class MX extends yG{constructor(){super(...arguments),this.type=oB.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=kX,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;Dz(this._dataSet,"funnel",oX),Dz(this._dataSet,"funnelTransform",lX);const t=new ya(this._dataSet,{name:`${hB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new iG(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:fX,asTransformRatio:hX,asReachRatio:cX,asHeightRatio:dX,asValueRatio:uX,asNextValueRatio:gX,asLastValueRatio:pX,asLastValue:mX,asNextValue:vX,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:_X}})}initMark(){var t,e,i,s,n,r,a,o,l,h,c,d;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},MX.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,morph:mG(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({},MX.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(MX.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(MX.mark.outerLabelLine,{themeSpec:e,markSpec:t,depend:[this._funnelOuterLabelMark.label],noSeparateStyle:!0})}}initTooltip(){this._tooltipHelper=new bX(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*aB(cX).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(dG(null===(s=hz.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),uG("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(dG(hz.getAnimationInKey("fadeInOut")(),uG(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(dG(hz.getAnimationInKey("funnel")({},o),uG(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(dG(null===(a=hz.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),uG("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[pX])/2:this._getSecondaryAxisLength(t[uX])/2,n=this._getSecondaryAxisLength(t[uX])/2):(s=this._getSecondaryAxisLength(t[uX])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[gX])/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[_X])}_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[yD]===t[yD]));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?yX: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{AX(),rY(),OU(),hz.registerSeries(MX.type,MX),hz.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},KH))),hz.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Gc,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Gc,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),$H()};class wX extends xX{constructor(){super(...arguments),this.type=wX.type}}wX.type="pyramid3d";class CX extends kX{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class EX extends MX{constructor(){super(...arguments),this.type=oB.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=CX}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},EX.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({},EX.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(EX.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(EX.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())}}EX.type=oB.funnel3d,EX.mark=cF,EX.transformerConstructor=CX;const PX=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},BX=t=>{const e=t.mark.elements.filter((t=>t.diffState===BB.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}))},RX=(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]},LX=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=BX(i),a=RX(r,s,n);return PX(e.startAngle,a)*(n-s)+s},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=BX(i),a=RX(r,s,n);return PX(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}}}),OX=t=>{const e=$(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),i=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[e,i]},IX=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=BX(i),a=OX(r);return PX(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=BX(i),a=OX(r);return PX(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}}}),DX=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},FX=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):FX(t.children,e,i)))})),e};function jX(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=VX(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}},NX=(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=NX(t.children,e,t,n))})),s},GX=(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=GX(t.children,e,t,n)),n=e(t,s,i,n)})),n},WX={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:jX,slice:zX,sliceDice:function(t,e,i,s,n){(t.depth%2==1?zX:jX)(t,e,i,s,n)}};class UX{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({},UX.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?cb(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?HX(this.options.aspectRatio):null!==(e=WX[this.options.splitType])&&void 0!==e?e:WX.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=VX(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)}))}}UX.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const YX=(t,e)=>{const i=new UX(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 FX(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},KX={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class XX{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];jX(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),KX);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({},XX.defaultOpionts,t):Object.assign({},XX.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?cb(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+mb(this.options.center[0],t.width),s=t.y0+mb(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=>mb(t,n))):mb(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>mb(t,n))):mb(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=mb(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=VX(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)}}}XX.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const $X=4294967296;function qX(t,e){let i,s;if(QX(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function QX(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 s$(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 n$(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 r$(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 a$(t){return{_:t,next:null,prev:null}}function o$(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];s$(n,s,r);let a,o,l,h,c,d,u,p=a$(s),g=a$(n),m=a$(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=VX(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)%$X)/$X}(),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:d$.defaultOpionts.nodeSort;NX([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)NX([o],l$(h)),GX([o],h$(this._getPadding,.5,a)),NX([o],c$(1,this._maxDepth));else{const t=Math.min(s.width,s.height);NX([o],l$(d$.defaultOpionts.setRadius)),GX([o],h$(ub,1,a)),c&&GX([o],h$(this._getPadding,o.radius/t,a)),NX([o],c$(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}d$.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const u$=(t,e={})=>{if(!t)return[];const i=[];return FX(t,i,e),i},p$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new XX(i).layout(t,{width:s,height:n})};class g$ extends oN{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var m$;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(m$||(m$={}));const f$=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===m$.DrillDown){return Y(sz(t,n,s,"children"))}if(i.type===m$.DrillUp){const e=nz(t,n,s,"children");if(e)return Y(e)}return t};class v${_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=vU(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;Dz(t,"drillFilter",f$),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:m$.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:m$.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:m$.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:m$.DrillUp},model:this}),r}}class _$ extends _Y{constructor(){super(...arguments),this.type=oB.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:nG),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:yD},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),Dz(this._dataSet,"sunburstLayout",p$),Dz(this._dataSet,"flatten",u$),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:sG,operations:["max","min","values"]},{key:nG,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(Dz(t.dataSet,"addVChartProperty",ZN),t.transform({type:"addVChartProperty",options:{beforeCall:lG.bind(this),call:hG}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t,e;if(!1===this._sunburst.visible)return;const i=this._createMark(_$.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()},Jz.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(_$.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},Jz.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new g$(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(dG(null===(e=hz.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),uG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(dG(null===(e=hz.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),uG(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]}}_$.type=oB.sunburst,_$.mark=_F,U(_$,v$);const y$=()=>{hz.registerSeries(_$.type,_$),EY(),rY(),$H(),hz.registerAnimation("sunburst",((t,e)=>({appear:DX(0,e),enter:LX(t),exit:IX(t),disappear:IX(t)})))},b$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new d$(i).layout(t,{width:s,height:n})};class x$ extends oN{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const S$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"};class A$ extends SG{constructor(){super(...arguments),this.type=oB.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:nG),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:yD},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),Dz(this._dataSet,"circlePackingLayout",b$),Dz(this._dataSet,"flatten",u$),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)||(Dz(t.dataSet,"addVChartProperty",ZN),t.transform({type:"addVChartProperty",options:{beforeCall:lG.bind(this),call:hG}}))}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(A$.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},Jz.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(A$.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"},Jz.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:sG,operations:["max","min","values"]},{key:nG,operations:["values"]}])}initTooltip(){this._tooltipHelper=new x$(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(dG(null===(i=hz.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),uG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(dG(null===(e=hz.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),uG(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]}}A$.type=oB.circlePacking,A$.mark=xF,U(A$,v$);const k$=()=>{hz.registerSeries(A$.type,A$),EY(),rY(),XH(),hz.registerAnimation("circlePacking",((t,e)=>({appear:S$(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},M$=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=M$(t.children):t.value=0),e+=Math.abs(t.value)})),e};function T$(t){return t.depth}function w$(t,e){return e-1-t.endDepth}const C$=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),E$=(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},P$={left:T$,right:w$,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:T$,end:w$},B$=yt(0,1);class R${constructor(t){this._ascendingSourceBreadth=(t,e)=>C$(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>C$(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},R$.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?cb(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):P$[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)};bb(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))),bb(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=[];M$(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}`;if(n[r])return n[r].value+=wt(t.value),void n[r].datum.push(t);const a={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[t],value:t.value,parents:t.parents.map((t=>t.key))};i.push(a),s[t.source].sourceLinks.push(a),s[t.target].targetLinks.push(a),n[r]=a})),{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=[E$(s[t.source]),E$(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=Math.min(n>0?Math.max(this.options.nodeGap,n):this.options.nodeGap,this._viewBox.height/e);a=()=>i,this._gapY=i,this.options.equalNodeHeight?o=this._viewBox.height/e-i:r=t.reduce(((t,e)=>{const s=e.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-(e.length-1)*i)/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,n,0),p=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.max(e.value?i*B$(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&&(o/=i.length-1,n+o>0)){n+=o,this._gapY=Math.min(n);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(C$),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(C$),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 R$(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]:[]},O$=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&O$(t,e.children,i)}))},I$=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},D$=(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 R$(e),r=[];return r.push(n.layout(s,i)),r},F$=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:[]},j$=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 z$ extends oN{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 H$=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),V$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:H$(t),N$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class G$ extends zH{constructor(){super(...arguments),this.type=G$.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}}G$.type="linkPath";const W$=()=>{kR.registerGlyph("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(BO).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),kR.registerAnimationType("linkPathGrowIn",RO),kR.registerAnimationType("linkPathGrowOut",LO),kR.registerAnimationType("linkPathUpdate",OO),_O(),pO(),hz.registerMark(G$.type,G$)};class U$ extends SG{constructor(){super(...arguments),this.type=oB.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=[Jz.STATE_SANKEY_EMPHASIS,Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:s})}else n.target===e.key?i.includes(n.source)||i.push(n.source):(t.removeState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState(Jz.STATE_SANKEY_EMPHASIS),e.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS)):(t.removeState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(Jz.STATE_SANKEY_EMPHASIS),void s.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(Jz.STATE_SANKEY_EMPHASIS),void s.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:h.value/r.value});s.removeState(Jz.STATE_SANKEY_EMPHASIS),s.addState(Jz.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=[Jz.STATE_SANKEY_EMPHASIS,Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS),void t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS),void t.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:o.value/i.value});t.removeState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.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){Dz(this._dataSet,"sankeyLayout",D$),Dz(this._dataSet,"sankeyFormat",I$),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:Xz.sankeyLayout});const{dataSet:a}=this._option;Dz(a,"sankeyNodes",F$),Dz(a,"flatten",u$);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:aG.bind(this),call:oG}},!1),this._nodesSeriesData=new iG(this._option,o),Dz(a,"sankeyLinks",j$);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:aG.bind(this),call:oG}},!1),this._linksSeriesData=new iG(this._option,l)}}initMark(){var t,e,i,s;const n=this._createMark(U$.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(U$.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(U$.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},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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(dG(null===(i=hz.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(r,a),uG("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(dG(null===(s=hz.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(r,a),uG("link",this._spec,this._markAttributeContext))),this._labelMark&&this._labelMark.setAnimationConfig(dG(null===(n=hz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),uG("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([Jz.STATE_SANKEY_EMPHASIS_REVERSE,Jz.STATE_SANKEY_EMPHASIS]),e.includes(t.getDatum().key)||t.addState(Jz.STATE_SANKEY_EMPHASIS_REVERSE)}))}initTooltip(){this._tooltipHelper=new z$(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 HF;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 O$(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]}}U$.type=oB.sankey,U$.mark=mF;const Y$=()=>{kR.registerTransform("sankey",{transform:L$,markPhase:"beforeJoin"},!0),CW(),W$(),rY(),hz.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:V$(t,e)},KH))),hz.registerAnimation("sankeyLinkPath",((t,e)=>({appear:N$(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),$H(),hz.registerSeries(U$.type,U$)},K$=(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=u$(n);return i=QN([{latestData:r}],e),i};class X$ extends oN{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}get defaultShapeType(){return"square"}}const $$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class q$ extends _G{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}class Z$ extends SG{constructor(){super(...arguments),this.type=oB.treemap,this.transformerConstructor=q$,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:nG),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:yD},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&&[nG,"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)&&(Dz(this._rawData.dataSet,"addVChartProperty",ZN),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:lG.bind(this),call:hG}}))}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){Dz(this._dataSet,"hierarchyDimensionStatistics",K$),Dz(this._dataSet,"flatten",u$);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:sG,operations:["max","min","values"]},{key:nG,operations:["values"]}])}initMark(){var t,e,i,s;const n=this._createMark(Z$.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(Z$.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()},Jz.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()},Jz.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},Jz.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},Jz.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},Jz.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},Jz.STATE_NORMAL,t.AttributeLevel.Series))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(dG(null===(e=hz.getAnimationInKey("treemap"))||void 0===e?void 0:e(),uG(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 X$(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]}}Z$.type=oB.treemap,Z$.mark=gF,Z$.transformerConstructor=q$,U(Z$,v$),U(Z$,yU);const J$=()=>{CW(),rY(),hz.registerAnimation("treemap",((t,e)=>({appear:$$(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),$H(),kR.registerTransform("treemap",{transform:YX,markPhase:"beforeJoin"},!0),hz.registerSeries(Z$.type,Z$)},Q$={type:"fadeIn"};function tq(t,e){return"fadeIn"===e?Q$:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class eq extends _G{constructor(){super(...arguments),this._supportStack=!1}}class iq extends gK{constructor(){super(...arguments),this.type=oB.gaugePointer,this.transformerConstructor=eq,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(iq.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},iq.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(iq.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(dG(null===(i=hz.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),uG("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}iq.type=oB.gaugePointer,iq.mark=vF,iq.transformerConstructor=eq;const sq=()=>{hz.registerSeries(iq.type,iq),pU(),CW(),hz.registerAnimation("gaugePointer",((t,e)=>{const i=tq(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),qY(),XY()};class nq extends _G{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class rq extends gK{constructor(){super(...arguments),this.type=oB.gauge,this.transformerConstructor=nq,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();Dz(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[OD]=t[this._angleField[0]],t[LD]=e>0?i[e-1][OD]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(rq.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(rq.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[LD])?this.angleAxisHelper.dataToPosition([t[LD]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[OD]])}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(dG(null===(i=hz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),uG("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}rq.type=oB.gauge,rq.mark=fF,rq.transformerConstructor=nq;class aq extends EG{constructor(){super(...arguments),this.type=aq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}aq.type="cell";const oq=()=>{hz.registerMark(aq.type,aq),fM(),_M(),kR.registerGraphic(RB.cell,bg),kR.registerMark(RB.cell,lD)};function lq(t){return!1===t?{}:{type:"fadeIn"}}class hq extends oN{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return p(i)&&"dimension"===t&&(i.visible=!1),i}}class cq extends _G{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class dq extends SG{constructor(){super(...arguments),this.type=oB.heatmap,this.transformerConstructor=cq}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(dq.mark.cell,{morph:mG(this._spec,dq.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(dq.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=xG(this);this._cellMark.setAnimationConfig(dG(null===(i=hz.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),uG("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 hq(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]}}dq.type=oB.heatmap,dq.mark=SF,dq.transformerConstructor=cq;const uq=()=>{rY(),oq(),hz.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},KH),{appear:lq(e)}))),QG(),qG(),hz.registerSeries(dq.type,dq)},pq=(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=mb(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=mb(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+mb(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+mb(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=cb(e.field),C=t.map(w),[E,P]=pb(C),B=E===P?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(P-E),R=u(e.radiusField)?w:cb(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?pb(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=gq(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),mq({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},mq=(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,[_D]:null==n?void 0:n[_D],[bD]:null==n?void 0:n[bD]}};class vq extends zH{constructor(){super(...arguments),this.type=vq.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}}vq.type="ripple";const _q=()=>{hz.registerMark(vq.type,vq),kR.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}}))),_O(),fO()},yq=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class bq extends _G{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class xq extends _Y{constructor(){super(...arguments),this.type=oB.correlation,this.transformerConstructor=bq,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;Dz(this._dataSet,"correlation",pq);const s=new va;Fz(s,"dataview",ga),Dz(s,"correlationCenter",fq);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 iG(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(xq.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:_D,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(xq.mark.ripplePoint,{key:_D,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});a&&(this._ripplePointMark=a);const o=this._createMark(xq.mark.centerPoint,{key:_D,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[gD],y:t=>t[mD],size:t=>t[fD],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},Jz.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},Jz.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},Jz.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)},Jz.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(dG(null===(e=hz.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),uG("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()}}xq.type=oB.correlation,xq.mark=AF,xq.transformerConstructor=bq;const Sq=()=>{BG(),_q(),hz.registerSeries(xq.type,xq),hz.registerAnimation("correlation",((t,e)=>Object.assign({appear:yq(0,e)},YH)))};class Aq extends zH{constructor(){super(...arguments),this.type=Aq.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}}Aq.type="liquid";const kq=(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/2):t;class Mq extends oN{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 Tq extends yG{constructor(){super(...arguments),this.type=oB.liquid,this.transformerConstructor=RG,this._liquidBackgroundMark=null,this._liquidOutlineMark=null}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){super.setAttrFromSpec(),this._marginSpec=$F(this._spec.outlineMargin),this._paddingSpec=$F(this._spec.outlinePadding),this.setValueField(this._spec.valueField)}rawDataUpdate(t){super.rawDataUpdate(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(Tq.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(Tq.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidMark=this._createMark(Tq.mark.liquid,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_getPosAndSizeFormRegion(t=!1){const{top:e=0,bottom:i=0,left:s=0,right:n=0}=this._marginSpec,{top:r=0,bottom:a=0,left:o=0,right:l=0}=this._paddingSpec,{width:h,height:c}=this._region.getLayoutRect();return t?{x:h/2+(s-n)/2,y:c/2+(e-i)/2,size:Math.min(h-(s+n),c-(e+i))}:{x:h/2+(s+l-(n+l))/2,y:c/2+(e+r-(i+a))/2,size:Math.min(h-(s+n+o+l),c-(e+i+r+a))}}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),x:()=>this._getPosAndSizeFormRegion(!0).x,y:()=>this._getPosAndSizeFormRegion(!0).y,size:()=>this._getPosAndSizeFormRegion(!0).size,symbolType:()=>{var t;return kq(null!==(t=this._spec.maskShape)&&void 0!==t?t:"circle",this._getPosAndSizeFormRegion(!0).size)}},"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:()=>{var t;const{x:e,y:i,size:s}=this._getPosAndSizeFormRegion();return[bg({x:e,y:i,size:s,symbolType:kq(null!==(t=this._spec.maskShape)&&void 0!==t?t:"circle",s),fill:!0})]}},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setInteractive(!1)}_initLiquidMarkStyle(){const e=this._liquidMark;e&&this.setMarkStyle(e,{dx:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,y:()=>{const{y:t,size:e}=this._getPosAndSizeFormRegion();return t-e/2+e-e*this._heightRatio},height:()=>{const{size:t}=this._getPosAndSizeFormRegion();return t*this._heightRatio},fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new Mq(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}initInteraction(){this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i;const s={y:{from:()=>{const{y:t,size:e}=this._getPosAndSizeFormRegion();return t-e/2+e},to:()=>{const{y:t,size:e}=this._getPosAndSizeFormRegion();return t-e/2+e-e*this._heightRatio}},height:{from:0,to:()=>{const{size:t}=this._getPosAndSizeFormRegion();return t*this._heightRatio}}},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(dG(null===(i=hz.getAnimationInKey("liquid"))||void 0===i?void 0:i(s,n),uG("liquid",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=DM(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]}}Tq.type=oB.liquid,Tq.mark=MF,Tq.transformerConstructor=RG;const wq=t=>Y(t).join(",");class Cq extends oN{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>wq(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>wq(null==t?void 0:t[this.series.getDimensionField()[0]])}}class Eq extends _G{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}class Pq extends yG{constructor(){super(...arguments),this.type=oB.venn,this.transformerConstructor=Eq,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:yD)}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(Pq.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(Pq.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()},Jz.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},Jz.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},Jz.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=>wq(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)}},Jz.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=>wq(t.sets)},Jz.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new Cq(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:wq(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return wq(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[wq(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(wq(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(dG(null===(e=hz.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),uG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(dG(null===(e=hz.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),uG(t.name,this._spec,this._markAttributeContext)))}))}}Pq.type=oB.venn,Pq.mark=TF,Pq.transformerConstructor=Eq;class Bq extends hW{_isValidSeries(t){return t===oB.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 Rq extends oW{constructor(){super(...arguments),this.transformerConstructor=Bq,this.type="map",this.seriesType=oB.map}}Rq.type="map",Rq.seriesType=oB.map,Rq.transformerConstructor=Bq;class Lq extends hW{_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 Oq extends Lq{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=PV(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,Tj({},s,l)),n&&Object.assign(o,Tj({},n,o))}}class Iq extends Lq{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 Dq extends Lq{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 Fq extends oW{constructor(){super(...arguments),this.transformerConstructor=Dq}}Fq.transformerConstructor=Dq;class jq extends Fq{constructor(){super(...arguments),this.transformerConstructor=Dq,this.type="pie",this.seriesType=oB.pie}}jq.type="pie",jq.seriesType=oB.pie,jq.transformerConstructor=Dq;class zq extends Dq{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class Hq extends Fq{constructor(){super(...arguments),this.transformerConstructor=zq,this.type="pie3d",this.seriesType=oB.pie3d}}Hq.type="pie3d",Hq.seriesType=oB.pie3d,Hq.transformerConstructor=zq;class Vq extends Iq{_getDefaultSeriesSpec(t){var e,i,s;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:EB,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:EB,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=>Tj({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}class Nq extends oW{constructor(){super(...arguments),this.transformerConstructor=Vq,this.type="rose",this.seriesType=oB.rose,this._canStack=!0}}Nq.type="rose",Nq.seriesType=oB.rose,Nq.transformerConstructor=Vq;class Gq extends Iq{_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:Tj({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=>Tj({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class Wq extends oW{constructor(){super(...arguments),this.transformerConstructor=Gq,this.type="radar",this.seriesType=oB.radar,this._canStack=!0}}Wq.type="radar",Wq.seriesType=oB.radar,Wq.transformerConstructor=Gq;class Uq extends hW{_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")&&Tj(e,aH(this.type,t))})),this._transformAxisSpec(t)}}class Yq extends oW{constructor(){super(...arguments),this.transformerConstructor=Uq,this.type="common",this._canStack=!0}}Yq.type="common",Yq.transformerConstructor=Uq;class Kq extends cW{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 Xq extends oW{constructor(){super(...arguments),this.transformerConstructor=Kq,this._canStack=!0}}Xq.transformerConstructor=Kq;class $q extends Kq{transformSpec(t){super.transformSpec(t),sH(t)}}class qq extends Xq{constructor(){super(...arguments),this.transformerConstructor=$q,this.type="histogram",this.seriesType=oB.bar}}qq.type="histogram",qq.seriesType=oB.bar,qq.transformerConstructor=$q;class Zq extends Xq{constructor(){super(...arguments),this.transformerConstructor=$q,this.type="histogram3d",this.seriesType=oB.bar3d}}Zq.type="histogram3d",Zq.seriesType=oB.bar3d,Zq.transformerConstructor=$q;class Jq extends Oq{_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 Qq extends oW{constructor(){super(...arguments),this.transformerConstructor=Jq,this.type="circularProgress",this.seriesType=oB.circularProgress,this._canStack=!0}}Qq.type="circularProgress",Qq.seriesType=oB.circularProgress,Qq.transformerConstructor=Jq;class tZ extends Oq{_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:oB.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===oB.gauge||t.type===oB.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===oB.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 eZ extends oW{constructor(){super(...arguments),this.transformerConstructor=tZ,this.type="gauge",this.seriesType=oB.gaugePointer}}eZ.type="gauge",eZ.seriesType=oB.gaugePointer,eZ.transformerConstructor=tZ;class iZ extends hW{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class sZ extends oW{constructor(){super(...arguments),this.transformerConstructor=iZ,this.type="wordCloud",this.seriesType=oB.wordCloud}}sZ.transformerConstructor=iZ;class nZ extends iZ{_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 rZ extends sZ{constructor(){super(...arguments),this.transformerConstructor=nZ,this.type="wordCloud",this.seriesType=oB.wordCloud}}rZ.type="wordCloud",rZ.seriesType=oB.wordCloud,rZ.transformerConstructor=nZ;class aZ extends iZ{_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 oZ extends sZ{constructor(){super(...arguments),this.transformerConstructor=aZ,this.type="wordCloud3d",this.seriesType=oB.wordCloud3d}}oZ.type="wordCloud3d",oZ.seriesType=oB.wordCloud3d,oZ.transformerConstructor=aZ;class lZ extends hW{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 hZ extends oW{constructor(){super(...arguments),this.transformerConstructor=lZ,this.type="funnel",this.seriesType=oB.funnel}}hZ.type="funnel",hZ.seriesType=oB.funnel,hZ.transformerConstructor=lZ;class cZ extends oW{constructor(){super(...arguments),this.transformerConstructor=lZ,this.type="funnel3d",this.seriesType=oB.funnel3d}}cZ.type="funnel3d",cZ.seriesType=oB.funnel3d,cZ.transformerConstructor=lZ;class dZ extends cW{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=PV(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=PV(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class uZ extends oW{constructor(){super(...arguments),this.transformerConstructor=dZ,this.type="linearProgress",this.seriesType=oB.linearProgress,this._canStack=!0}}uZ.type="linearProgress",uZ.seriesType=oB.linearProgress,uZ.transformerConstructor=dZ;class pZ extends cW{_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),sH(t)}}class gZ extends oW{constructor(){super(...arguments),this.transformerConstructor=pZ,this.type="rangeColumn",this.seriesType=oB.rangeColumn}}gZ.type="rangeColumn",gZ.seriesType=oB.rangeColumn,gZ.transformerConstructor=pZ;class mZ extends cW{_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 fZ extends oW{constructor(){super(...arguments),this.transformerConstructor=mZ,this.type="rangeColumn3d",this.seriesType=oB.rangeColumn3d}}fZ.type="rangeColumn3d",fZ.seriesType=oB.rangeColumn3d,fZ.transformerConstructor=mZ;class vZ extends hW{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:CB,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=oB.sunburst;return s.type=n,s[n]=t[n],s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class _Z extends oW{constructor(){super(...arguments),this.transformerConstructor=vZ,this.type="sunburst",this.seriesType=oB.sunburst}}_Z.type="sunburst",_Z.seriesType=oB.sunburst,_Z.transformerConstructor=vZ;class yZ extends hW{_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=oB.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class bZ extends oW{constructor(){super(...arguments),this.transformerConstructor=yZ,this.type="circlePacking",this.seriesType=oB.circlePacking}}bZ.type="circlePacking",bZ.seriesType=oB.circlePacking,bZ.transformerConstructor=yZ;class xZ extends hW{_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 SZ extends oW{constructor(){super(...arguments),this.transformerConstructor=xZ,this.type="treemap",this.seriesType=oB.treemap}}SZ.type="treemap",SZ.seriesType=oB.treemap,SZ.transformerConstructor=xZ;class AZ extends OW{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),sH(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}class kZ extends IW{constructor(){super(...arguments),this.transformerConstructor=AZ,this.type="waterfall",this.seriesType=oB.waterfall}}kZ.type="waterfall",kZ.seriesType=oB.waterfall,kZ.transformerConstructor=AZ;class MZ extends cW{_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"}]),sH(t)}}class TZ extends oW{constructor(){super(...arguments),this.transformerConstructor=MZ,this.type="boxPlot",this.seriesType=oB.boxPlot}}TZ.type="boxPlot",TZ.seriesType=oB.boxPlot,TZ.transformerConstructor=MZ;class wZ extends hW{_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 CZ extends oW{constructor(){super(...arguments),this.transformerConstructor=wZ,this.type="sankey",this.seriesType=oB.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)}))}}CZ.type="sankey",CZ.seriesType=oB.sankey,CZ.transformerConstructor=wZ;class EZ extends cW{_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),sH(t)}}class PZ extends oW{constructor(){super(...arguments),this.transformerConstructor=EZ,this.type="rangeArea",this.seriesType=oB.rangeArea}}PZ.type="rangeArea",PZ.seriesType=oB.rangeArea,PZ.transformerConstructor=EZ;class BZ extends cW{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}class RZ extends oW{constructor(){super(...arguments),this.transformerConstructor=BZ,this.type="heatmap",this.seriesType=oB.heatmap}}RZ.type="heatmap",RZ.seriesType=oB.heatmap,RZ.transformerConstructor=BZ;class LZ extends hW{_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=oB.correlation;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class OZ extends oW{constructor(){super(...arguments),this.transformerConstructor=LZ,this.type="correlation",this.seriesType=oB.correlation}}OZ.type="correlation",OZ.seriesType=oB.correlation,OZ.transformerConstructor=LZ;function IZ(t){var e,i;const s=Object.assign({},t);return B(t.style)||(s.textStyle=lz(t.style)),B(t.textStyle)||Tj(s.textStyle,lz(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&lz(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&lz(s.background.style),s}const DZ=(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},FZ=(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:bD;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 jZ extends FG{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:()=>{sB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),sB(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=UF(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 DH(this._option,e),this._initSelectedData(),sB(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)||(sB(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(Tj({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(Tj({},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(Tj({},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}}jZ.specKey="legends";class zZ extends jZ{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),sB(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:Xz.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){Dz(this._option.dataSet,"discreteLegendFilter",FZ),Dz(this._option.dataSet,"discreteLegendDataMake",DZ);const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return sB(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(!rb(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=qj(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=IZ(s)),B(n.focusIconStyle)||lz(n.focusIconStyle),n.shape&&(n.shape=az(n.shape)),n.label&&(n.label=az(n.label)),n.value&&(n.value=az(n.value)),n.background&&(n.background=az(n.background)),YF(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),YF(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),YF(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)||lz(r.railStyle),B(r.sliderStyle)||lz(r.sliderStyle)):(B(r.textStyle)||lz(r.textStyle),r.handler&&az(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(Tj(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 uP}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(rP.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(rP.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(rP.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}=wV(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=wV(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}zZ.specKey="legends",zZ.type=r.discreteLegend;const HZ=(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[]},VZ=(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)?rz(t,+e,+i):t.filter((t=>t[o]>=e&&t[o]<=i))}return t};function NZ(t){return"color"===t||"size"===t}const GZ={color:vP,size:yP},WZ=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],UZ=[2,10];class YZ extends jZ{static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!y(e))return NZ(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)=>{NZ(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),sB(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData},level:Xz.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(){Dz(this._option.dataSet,"continuousLegendFilter",VZ),Dz(this._option.dataSet,"continuousLegendDataMake",HZ);const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>nB(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=qj(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!rb(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=qj(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?WZ:UZ);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=Tj({},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=IZ(s)),w.showHandler=!1!==n.visible,B(n.style)||(w.handlerStyle=lz(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),B(r.style)||(w.railStyle=lz(r.style)),B(a.style)||(w.trackStyle=lz(a.style)),w.startText=az(o),w.endText=az(l),w.handlerText=az(h),B(c)||(w.sizeBackground=lz(c)),d.visible&&!B(d.style)&&(Tj(w,d.style),p(d.padding)&&(w.padding=d.padding)),w}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return GZ[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))}}}YZ.specKey="legends",YZ.type=r.continuousLegend;class KZ{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=Tz(n,a,!0))&&void 0!==e?e:[],...null!==(i=gz(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(!jw(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=nN(s).includes(t):p(e.visible)||p(e.activeType)?d.visible=nN(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)&&(pN(s).every((t=>{var e;return!nN(null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec).includes("dimension")}))?d.visible=!1:p(e.visible)||p(e.activeType)?d.visible=nN(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=dN(t,i,s),m=uN(t,i,s),f=Tj({},I(e[t]),m),v=g.title,_=mN(void 0,f,u.shape,void 0,v);p(f.title)?f.title=hN(f.title,Object.assign(Object.assign({},v),_)):f.title=hN(v,_,!0);const y=Y(g.content);if(p(f.content)){const t=gN(y);f.content=cN(f.content,(e=>mN(e,f,u.shape,t)))}else f.content=cN(y,(t=>mN(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=SN(a,t,e),l=!!p(o)&&!1!==vN(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 XZ extends KZ{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 $Z extends KZ{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 qZ extends KZ{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 ZZ=t=>p(t)&&!y(t),JZ=t=>p(t)&&y(t);class QZ extends DG{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:s}=super._initTheme(t,e);return i.style=Tj({},this._theme,i.style),{spec:i,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h,c,d;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=nN(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:eb(this._option.mode)||!Qy(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=null===(d=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===d?void 0:d.getElementById(t.parentElement)):Qy(this._option.mode)&&(t.parentElement=null==Jy?void 0:Jy.body)}}class tJ extends FG{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=QZ,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._getMouseOutHandler=t=>e=>{var i,s,n;if(this._alwaysShow)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=Qy(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(!t&&this._clickLock)return;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&&ZZ(this._cacheInfo)?a.mark=this._showTooltipByMouseEvent("mark",i,e,t,!0):r&&JZ(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),t&&this._clickLock&&(this._clickLock=!1))},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(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));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&sV.globalConfig.uniqueTooltip&&l&&sV.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._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?_N.canvas:_N.dom,n=hz.getComponentPluginInType(t);n||$y("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 $Z(this),dimension:new XZ(this),group:new qZ(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)),(tb(i)||eb(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)))}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=iN(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(JZ(t)){if(ZZ(this._cacheInfo))return!1;const e=this._cacheInfo;if(!(e.length===t.length&&t.every(((t,i)=>cz(t,e[i])))))return!1}else{if(JZ(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}}tJ.type=r.tooltip,tJ.transformerConstructor=QZ,tJ.specKey="tooltip";var eJ,iJ;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(eJ||(eJ={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(iJ||(iJ={}));const sJ={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class nJ extends FG{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=>{this._handleIn(t),this._clickLock=this._hasActive&&this._spec.lockAfterClick,this._clickLock&&S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._clickLock=!1,this._handleOutEvent()}),this.triggerOff))},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"}:tb(e)||eb(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=this.trigger||"hover",e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;if(y(t)){const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return[{click:"click"===t,in:i[t],out:e(t)}]}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)=>{sJ[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||t.yField)&&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){mz(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=>{jw(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[0],s=e.series.dataToPosition(e.datum[0]);(p(t.dimType)?"y"===t.dimType:fz(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=s.y:r=s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=e.x,a=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=rB(this._regions,"cartesian");if(!e)return;const{x:i,y:s,offsetWidth:n,offsetHeight:r,bandWidth:a,bandHeight:o}=zV(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=NV(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=GV(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 uT(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(n=new pT(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 QM(e)),null==s||s.add(t)),FV(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}rJ.specKey="crosshair",rJ.type=r.cartesianCrosshair;class aJ extends nJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return e.categoryField||e.valueField?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.polarCrosshair}]:void 0;const i=[];return e.forEach(((t,e)=>{(t.categoryField||t.valueField)&&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=>{jw(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=rB(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:"",Tj(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=EV(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=EV(s.getSpec())),c.angle=a.angle,c.axis=s,Tj(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}=wV(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}=wV(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 uT(Object.assign(Object.assign({},l),{lineStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===o&&(t=new mT(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 fT(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex+1})):new gT(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 QM(e),null==s||s.add(t),i(t)),FV(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair]}}aJ.specKey="crosshair",aJ.type=r.polarCrosshair;const oJ=(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)},lJ=(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 hJ extends FG{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 sB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),sB(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=_z(t),this._isHorizontal="horizontal"===yz(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=>!Dw(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(Dw(this._stateScale.type));this._stateScale.domain(e,!0),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={};sB(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=Dw(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 sB(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;Fz(s,"dataview",ga),Dz(s,"dataFilterComputeDomain",lJ);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 DH(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(Dw(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&&Dw(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,Dw(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=Dw(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 rC,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||(Dz(this._option.dataSet,"dataFilterWithNewDomain",oJ),sB(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:()=>Dw(this._stateScale.type)},level:Xz.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(Dw(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&&jw(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,jw(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(hJ,yU);class cJ extends DG{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=Tj({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 dJ extends hJ{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=cJ,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 TC;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(!Dw(t.type)||e[0]!==e[1])&&(!jw(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 rE(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:lz(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:lz(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:lz(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:lz(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:lz(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:lz(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:lz(g.style)},selectedBackgroundStyle:lz(this._spec.selectedBackground.style),dragMaskStyle:lz(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:Tj(lz(null===(l=m.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},lz(null===(h=m.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:Tj(lz(null===(c=f.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},lz(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}=wV(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()}}dJ.type=r.dataZoom,dJ.transformerConstructor=cJ,dJ.specKey="dataZoom";class uJ extends hJ{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 EM(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=$P(this._start,e)&&$P(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=lz(t.style)),B(null==e?void 0:e.style)||(s.sliderStyle=lz(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}uJ.type=r.scrollBar,uJ.specKey="scrollBar";const pJ=(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 gJ extends FG{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!==gJ.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(){Dz(this._option.dataSet,"indicatorFilter",pJ);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 DH(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=Tj({},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({},lz(e.style)),{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?ZF(this._spec.offsetX,this._computeLayoutRadius()):0,dy:this._spec.offsetY?ZF(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({},lz(this._spec.title.style)),{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 SP(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}}gJ.type=r.indicator,gJ.specKey="indicator";const mJ=["sum","average","min","max","variance","standardDeviation","median"];function fJ(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=X(s);return er}function vJ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&fJ(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=YF(t.x)?xJ(t.x,n)+r.x:l.getXAxisHelper().dataToPosition([t.x])+r.x,h}function _J(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&fJ(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=YF(t.y)?xJ(t.y,n)+r.y:l.getYAxisHelper().dataToPosition([t.y])+r.y,h}function yJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&fJ(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 bJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&fJ(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 xJ(t,e){return Number(t.substring(0,t.length-1))*e/100}function SJ(t){return mJ.includes(t)}function AJ(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=vJ(t,m,n,d,h,a),i=_J(t,f,n,d,c,a);u.push([{x:e,y:i}])}else if(e){const e=vJ(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=_J(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 kJ(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=yJ(t,l,n,r),i=bJ(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=yJ(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=bJ(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function MJ(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=YF(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=YF(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])&&fJ(_,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])&&fJ(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 TJ(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])&&fJ(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])&&fJ(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 wJ(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 YF(e)&&(e=xJ(e,r)),e+=s,YF(i)&&(i=xJ(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 YF(e)&&(e=xJ(e,s)),YF(i)&&(i=xJ(i,n)),{x:e,y:i}}))}function CJ(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 EJ(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},lz(r.style)):t.shape={visible:!1},!1!==s.visible?(t.panel=Object.assign({visible:!0},BJ(lz(s.style),i)),p(s.padding)&&(t.padding=ei(s.padding))):(t.panel={visible:!1},t.padding=0),n&&(t.textStyle=BJ(lz(n),i)),t}return{visible:!1}}function PJ(t,e){for(const i in t)d(t[i])&&(t[i]=t[i](e));return t}function BJ(t,e){return d(t)?t(e):t}function RJ(t,e){return d(t)?t(e):t}function LJ(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 OJ(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 IJ(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 DJ(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function FJ(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=>zJ(i,t,e))):s.x=zJ(i,t,e)}if(p(e.y)){const i=e.y;y(i)?s.y=i.map((i=>zJ(i,t,e))):s.y=zJ(i,t,e)}if(p(e.angle)){const i=e.angle;y(i)?s.angle=i.map((i=>zJ(i,t,e))):s.angle=zJ(i,t,e)}if(p(e.radius)){const i=e.radius;y(i)?s.radius=i.map((i=>zJ(i,t,e))):s.radius=zJ(i,t,e)}if(p(e.areaName)){const i=e.areaName;s.areaName=zJ(i,t,e)}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),i.push(s)})),i}const jJ={min:(t,e)=>qP(t[0].latestData,e.field),max:(t,e)=>ZP(t[0].latestData,e.field),sum:function(t,e){return JP(t[0].latestData,e.field)},average:function(t,e){return QP(t[0].latestData,e.field)},variance:function(t,e){return tB(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(tB(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 zJ(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 jJ[i](e,{field:s})}return t}class HJ extends FG{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)&&SJ(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])&&SJ(t[h])?i.x={field:h,aggrType:t[h]}:i.x=Y(h).map((e=>t[e])),_(t[c])&&SJ(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])&&SJ(t[o])?i.angle={field:o,aggrType:t[o]}:i.angle=Y(o).map((e=>t[e])),_(t[l])&&SJ(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=rB(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=KF(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=KF(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 VJ(t,e){return function(t,e,i){const{predict:s}=_b(t,(t=>t[e]),(t=>t[i])),n=qP(t,e),r=ZP(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 NJ(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 GJ extends HJ{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}=OJ(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:BJ(lz(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:EJ(y,this._markerData),state:{line:PJ(null!==(a=null===(r=this._spec.line)||void 0===r?void 0:r.state)&&void 0!==a?a:{},this._markerData),lineStartSymbol:PJ(null!==(l=null===(o=this._spec.startSymbol)||void 0===o?void 0:o.state)&&void 0!==l?l:{},this._markerData),lineEndSymbol:PJ(null!==(c=null===(h=this._spec.endSymbol)||void 0===h?void 0:h.state)&&void 0!==c?c:{},this._markerData),label:PJ(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:PJ(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:lz(b.style)}):S.startSymbol={visible:!1},x.visible?S.endSymbol=Object.assign(Object.assign({},x),{visible:!0,style:lz(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}=CJ([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}=OJ(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;Dz(this._option.dataSet,"markerAggregation",FJ),Dz(this._option.dataSet,"markerRegression",VJ),Dz(this._option.dataSet,"markerFilter",NJ);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}}GJ.specKey="markLine";class WJ extends GJ{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new UE(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:_}=OJ(e);let y=[];if(u||m||g||f||v||a&&l||a&&h){const t=AJ(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=MJ(i,r,d,e.coordinatesOffset):c&&(y=wJ(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(YF(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}=OJ(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}}}WJ.type=r.markLine,WJ.coordinateType="cartesian";class UJ extends GJ{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=OJ(this._spec);return e||i?new XE(t):new UE(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}=OJ(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=kJ(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=TJ(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}=OJ(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}}}UJ.type=r.polarMarkLine,UJ.coordinateType="polar";class YJ extends FG{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=UF(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 bP(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}}YJ.type=r.title,YJ.specKey=r.title;class KJ extends HJ{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=IJ(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:BJ(lz(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:EJ(u,this._markerData),state:{area:PJ(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData),label:PJ(null===(o=this._spec.label)||void 0===o?void 0:o.state,this._markerData),labelBackground:PJ(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}=CJ([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}=IJ(t);if(!(e||i||s||n||r||a||o))return null;const{options:l}=this._computeOptions(),h=this._getRelativeDataView();Dz(this._option.dataSet,"markerAggregation",FJ),Dz(this._option.dataSet,"markerFilter",NJ);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}}KJ.specKey="markArea";class XJ extends KJ{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new KE(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}=IJ(e),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t;let u=[],g=[];if(l){g=AJ(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=AJ(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[...t,e[1],e[0]])}else h?u=MJ(i,r,d,e.coordinatesOffset):c&&(u=wJ(e.positions,r,e.regionRelative));return{points:u}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=IJ(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}}}XJ.type=r.markArea,XJ.coordinateType="cartesian";class $J extends KJ{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=IJ(this._spec);return i||e||s?new $E(t):new KE(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}=IJ(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=kJ(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=TJ(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}=IJ(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}}}$J.type=r.polarMarkArea,$J.coordinateType="polar";const qJ=t=>lz(Object.assign({},t)),ZJ=t=>Object.assign(Object.assign({},t),{style:Object.assign({},lz(t.style))}),JJ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,m;const f=qJ(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=qJ(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:{},lz(Object.assign({},y)));var y;const b=ZJ(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=ZJ(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=ZJ(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=ZJ(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},QJ=t=>"left"===t||"right"===t,tQ=t=>"top"===t||"bottom"===t;class eQ extends FG{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({},JJ(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({},JJ(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 DP(t):this._playerComponent=new zP(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=QJ(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=QJ(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(PP.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(PP.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(PP.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(PP.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(PP.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(PP.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=QJ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=tQ(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)):QJ(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))):tQ(this._orient)?this._maxSize():t.height}_computeDx(t){return QJ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return tQ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}}eQ.specKey="player",eQ.type=r.player;class iQ extends FG{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)))}}iQ.type=r.label;class sQ extends nY{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}}sQ.type="text",sQ.constructorType="label";const nQ=()=>{hz.registerMark(sQ.constructorType,sQ),vO()};class rQ extends DG{_initTheme(t,e){return{spec:t,theme:this._theme}}}class aQ extends iQ{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=rQ,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),sB(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=Tj({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=zU[t])&&void 0!==i?i:zU.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}:HU(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}}aQ.type=r.label,aQ.specKey="label",aQ.transformerConstructor=rQ;class oQ extends iQ{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[PD]},"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 Tj({textStyle:{pickable:!0===this._spec.interactive},position:lQ(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[RD]))},a))}})).encode((e=>HU({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 lQ(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}oQ.type=r.totalLabel,oQ.specKey="totalLabel";class hQ extends HJ{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=DJ(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:RJ(E.offsetX,this._relativeSeries.getRegion()),offsetY:RJ(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:BJ(B.style,this._markerData)},state:{line:PJ(null!==(h=null===(l=this._spec.itemLine.line)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData),lineStartSymbol:PJ(null!==(d=null===(c=this._spec.itemLine.startSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData),lineEndSymbol:PJ(null!==(p=null===(u=this._spec.itemLine.endSymbol)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData),symbol:PJ(null!==(m=null===(g=this._spec.itemContent.symbol)||void 0===g?void 0:g.state)&&void 0!==m?m:{},this._markerData),image:PJ(null!==(v=null===(f=this._spec.itemContent.image)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData),text:PJ(null!==(y=null===(_=this._spec.itemContent.text)||void 0===_?void 0:_.state)&&void 0!==y?y:{},this._markerData),textBackground:PJ(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:PJ(null!==(A=null===(S=this._spec.itemContent.richText)||void 0===S?void 0:S.state)&&void 0!==A?A:{},this._markerData),customMark:PJ(null!==(M=null===(k=this._spec.itemContent.customMark)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData),targetItem:PJ(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=lz(BJ(L.style,this._markerData))),(null==O?void 0:O.style)&&(F.itemContent.imageStyle=BJ(O.style,this._markerData)),R&&(F.itemContent.textStyle=EJ(R,this._markerData)),(null==I?void 0:I.style)&&(F.itemContent.richTextStyle=BJ(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:lz(z.style)}):{visible:!1};return new ZE(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}=CJ([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:LJ(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:LJ(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}=DJ(t);if(!(p(t.coordinate)||e||i||s))return;Dz(this._option.dataSet,"markerAggregation",FJ),Dz(this._option.dataSet,"markerFilter",NJ);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}}hQ.specKey="markPoint";class cQ extends hQ{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=AJ(i,s,s,s,o)[0][0]:r?l=MJ(i,s,o,e.coordinatesOffset)[0]:a&&(l=wJ([e.position],s,e.regionRelative)[0]),{point:l}}_computeOptions(){const t=this._spec,{doXYProcess:e}=DJ(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}}}cQ.type=r.markPoint,cQ.coordinateType="cartesian";class dQ extends hQ{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=kJ(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}])]}}}dQ.type=r.polarMarkPoint,dQ.coordinateType="polar";class uQ extends hQ{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}])]}}}uQ.type=r.geoMarkPoint,uQ.coordinateType="geo";const pQ="inBrush",gQ="outOfBrush";class mQ extends FG{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),pQ,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),gQ,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 GP(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:lz(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(FP.drawStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(FP.moveStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(FP.drawing,(s=>{this._needInitOutState&&"single"===o&&this._initMarkBrushState(i,gQ),this._needInitOutState=!1,this._needDisablePickable=!0,this._handleBrushChange(t.ChartEvent.brushChange,e,s),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(FP.moving,(i=>{this._handleBrushChange(t.ChartEvent.brushChange,e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(FP.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(FP.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(FP.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({},lz(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(pQ),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(pQ),i.addState(gQ),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(pQ),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(pQ),i.addState(gQ),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(pQ),i.removeState(gQ),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}}}mQ.type=r.brush,mQ.specKey="brush";class fQ extends FG{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,`${hB}_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=dG({},uG(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}}}fQ.type=r.customMark,fQ.specKey="customMark";function vQ(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 _Q(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function yQ(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:_Q(t.rect),anchorCandidates:MQ(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=>vQ(t,r)));if(n.anchorCandidates)if(a&&(null===(e=n.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;tvQ(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 bQ(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=AQ(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(!AQ(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],xQ(SQ(t.point,l)))):t.point;n&&(s.x=n.x,s.y=n.y);const r=xQ(SQ(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=kQ(t.rect,a,0),t}));return yQ(h)}function xQ(t){return t>180?t-360:t}function SQ(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function AQ(t,e){for(let i=0;i{const{x:r,y:a}=kQ(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,s);n.push({x:r,y:a})})),n}class TQ extends FG{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:Xz.copyDataView},!1),this._data=new DH(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 ZE({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=$F(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=ku({});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=Tg(lz(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=bg(lz(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=mp(lz(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=mp(lz(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=kQ(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:lz(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]}))):yQ(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}}TQ.type=r.mapLabel,TQ.specKey="mapLabel";class wQ{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=>CQ(t))),a=n.filter((t=>!CQ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>CQ(t))),h=o.filter((t=>!CQ(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 CQ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}wQ.type="grid";sV.useRegisters([()=>{iI(),sI(),CG(),BG(),ZH(),XH(),QG(),qG(),hz.registerSeries(sW.type,sW),hz.registerChart(uW.type,uW)},()=>{iI(),sI(),CG(),gW(),BG(),fW(),QG(),qG(),hz.registerSeries(_W.type,_W),hz.registerChart(bW.type,bW)},()=>{LW(),hz.registerChart(IW.type,IW)},()=>{XW(),hz.registerChart(qW.type,qW)},()=>{LY(),hz.registerChart(jq.type,jq)},()=>{JY(),hz.registerChart(Nq.type,Nq)},()=>{aK(),hz.registerChart(Wq.type,Wq)},()=>{LW(),hz.registerChart(qq.type,qq)},()=>{MU(),hz.registerChart(Rq.type,Rq)},()=>{sq(),hz.registerSeries(rq.type,rq),EY(),vK(),XY(),hz.registerChart(eZ.type,eZ)},()=>{aX(),hz.registerChart(rZ.type,rZ)},()=>{TX(),hz.registerChart(hZ.type,hZ)},()=>{qU(),hz.registerChart(kZ.type,kZ)},()=>{iY(),BG(),XH(),QG(),qG(),hz.registerSeries(sY.type,sY),hz.registerChart(TZ.type,TZ)},()=>{hz.registerSeries(yK.type,yK),EY(),vK(),$H(),qY(),XY(),hz.registerChart(Qq.type,Qq)},()=>{TK(),hz.registerChart(uZ.type,uZ)},()=>{gY(),hz.registerChart(gZ.type,gZ)},()=>{gW(),QG(),qG(),hz.registerSeries(vY.type,vY),hz.registerChart(PZ.type,PZ)},()=>{y$(),hz.registerChart(_Z.type,_Z)},()=>{k$(),hz.registerChart(bZ.type,bZ)},()=>{J$(),hz.registerChart(SZ.type,SZ)},()=>{Y$(),hz.registerChart(CZ.type,CZ)},()=>{uq(),hz.registerChart(RZ.type,RZ)},()=>{Sq(),hz.registerChart(OZ.type,OZ)},()=>{hz.registerChart(Yq.type,Yq)},qG,QG,()=>{NG(),hz.registerComponent(tW.type,tW)},()=>{NG(),hz.registerComponent(eW.type,eW)},()=>{NG(),hz.registerComponent(iW.type,iW)},qY,XY,()=>{hz.registerComponent(zZ.type,zZ)},()=>{hz.registerComponent(YZ.type,YZ)},()=>{hz.registerComponent(tJ.type,tJ)},()=>{hz.registerComponent(rJ.type,rJ)},()=>{hz.registerComponent(aJ.type,aJ)},()=>{hz.registerComponent(dJ.type,dJ)},()=>{hz.registerComponent(uJ.type,uJ)},()=>{hz.registerComponent(gJ.type,gJ)},SU,()=>{hz.registerComponent(WJ.type,WJ),WE()},()=>{hz.registerComponent(XJ.type,XJ),YE()},()=>{hz.registerComponent(cQ.type,cQ),qE()},()=>{hz.registerComponent(UJ.type,UJ),XE._animate=TE,WE()},()=>{hz.registerComponent($J.type,$J),$E._animate=CE,YE()},()=>{hz.registerComponent(dQ.type,dQ),qE()},()=>{hz.registerComponent(uQ.type,uQ),qE()},()=>{hz.registerComponent(YJ.type,YJ)},()=>{hz.registerComponent(eQ.type,eQ)},()=>{zO(),nQ(),zG(),hz.registerComponent(aQ.type,aQ,!0)},()=>{zO(),nQ(),zG(),hz.registerComponent(oQ.type,oQ,!0)},()=>{hz.registerComponent(mQ.type,mQ)},()=>{hz.registerComponent(fQ.type,fQ)},()=>{hz.registerComponent(TQ.type,TQ)},()=>{ql.load(cT)},()=>{hz.registerLayout(wQ.type,wQ)},qN,pV,UR,WR]),sV.useRegisters([()=>{cA(ql)}]),t.ARC_END_ANGLE=xB,t.ARC_K=SB,t.ARC_MIDDLE_ANGLE=AB,t.ARC_QUADRANT=kB,t.ARC_RADIAN=MB,t.ARC_RATIO=yB,t.ARC_START_ANGLE=bB,t.ARC_TRANSFORM_VALUE=_B,t.AxisSyncPlugin=xV,t.BASE_EVENTS=hD,t.CORRELATION_SIZE=fD,t.CORRELATION_X=gD,t.CORRELATION_Y=mD,t.CanvasTooltipHandler=$N,t.DEFAULT_CHART_HEIGHT=dB,t.DEFAULT_CHART_WIDTH=cB,t.DEFAULT_CONICAL_GRADIENT_CONFIG=HD,t.DEFAULT_DATA_INDEX=_D,t.DEFAULT_DATA_KEY=yD,t.DEFAULT_DATA_SERIES_FIELD=bD,t.DEFAULT_GRADIENT_CONFIG=VD,t.DEFAULT_LABEL_ALIGN=pB,t.DEFAULT_LABEL_LIMIT=uB,t.DEFAULT_LABEL_TEXT=gB,t.DEFAULT_LABEL_VISIBLE=mB,t.DEFAULT_LABEL_X=fB,t.DEFAULT_LABEL_Y=vB,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_GRADIENT_CONFIG=jD,t.DEFAULT_MEASURE_CANVAS_ID=vD,t.DEFAULT_RADIAL_GRADIENT_CONFIG=zD,t.DEFAULT_SERIES_STYLE_NAME=xD,t.DomTooltipHandler=XN,t.Factory=hz,t.FormatterPlugin=uV,t.GradientType=FD,t.MediaQuery=lV,t.POLAR_DEFAULT_RADIUS=EB,t.POLAR_END_ANGLE=270,t.POLAR_END_RADIAN=wB,t.POLAR_START_ANGLE=CB,t.POLAR_START_RADIAN=TB,t.PREFIX=hB,t.SEGMENT_FIELD_END=OD,t.SEGMENT_FIELD_START=LD,t.STACK_FIELD_END=MD,t.STACK_FIELD_END_OffsetSilhouette=ED,t.STACK_FIELD_END_PERCENT=wD,t.STACK_FIELD_KEY=AD,t.STACK_FIELD_START=kD,t.STACK_FIELD_START_OffsetSilhouette=CD,t.STACK_FIELD_START_PERCENT=TD,t.STACK_FIELD_TOTAL=PD,t.STACK_FIELD_TOTAL_PERCENT=BD,t.STACK_FIELD_TOTAL_TOP=RD,t.ThemeManager=Wj,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=sV,t.WaterfallDefaultSeriesField=pD,t.builtinThemes=Lj,t.computeActualDataScheme=LF,t.darkTheme=yj,t.dataScheme=JF,t.default=sV,t.defaultThemeName=Oj,t.getActualColor=IF,t.getColorSchemeBySeries=zF,t.getDataScheme=RF,t.getMergedTheme=Nj,t.getTheme=zj,t.hasThemeMerged=Fj,t.isColorKey=DF,t.isProgressiveDataColorScheme=FF,t.isTokenKey=fj,t.lightTheme=_j,t.queryColorFromColorScheme=OF,t.queryToken=mj,t.registerCanvasTooltipHandler=qN,t.registerChartPlugin=oV,t.registerDomTooltipHandler=()=>{KN(XN)},t.registerFormatPlugin=pV,t.registerMediaQuery=()=>{oV(lV)},t.registerTheme=jj,t.removeTheme=Hj,t.themeExist=Vj,t.themes=Ij,t.token=vj,t.transformColorSchemeToStandardStruct=jF,t.version="1.11.5",t.vglobal=P_,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/openinula-vchart/package.json b/packages/openinula-vchart/package.json index 304c77ff3e..8a9e538ebe 100644 --- a/packages/openinula-vchart/package.json +++ b/packages/openinula-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/openinula-vchart", - "version": "1.11.4", + "version": "1.11.5", "sideEffects": false, "description": "The openinula version of VChart 4.x", "keywords": [ @@ -28,7 +28,7 @@ "build": "bundle --clean" }, "dependencies": { - "@visactor/vchart": "workspace:1.11.4", + "@visactor/vchart": "workspace:1.11.5", "@visactor/vutils": "~0.18.9", "@visactor/vrender-core": "0.19.11", "@visactor/vrender-kits": "0.19.11", diff --git a/packages/react-vchart/package.json b/packages/react-vchart/package.json index 7de4205403..5e094f4ec6 100644 --- a/packages/react-vchart/package.json +++ b/packages/react-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/react-vchart", - "version": "1.11.4", + "version": "1.11.5", "sideEffects": false, "description": "The react version of VChart 4.x", "keywords": [ @@ -28,7 +28,7 @@ "build": "bundle --clean" }, "dependencies": { - "@visactor/vchart": "workspace:1.11.4", + "@visactor/vchart": "workspace:1.11.5", "@visactor/vutils": "~0.18.9", "@visactor/vrender-core": "0.19.11", "@visactor/vrender-kits": "0.19.11", diff --git a/packages/taro-vchart/package.json b/packages/taro-vchart/package.json index e87b2645c4..93b812661c 100644 --- a/packages/taro-vchart/package.json +++ b/packages/taro-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/taro-vchart", - "version": "1.11.4", + "version": "1.11.5", "description": "Taro VChart 图表组件", "sideEffects": false, "main": "lib/src/index.js", @@ -42,7 +42,7 @@ }, "license": "MIT", "dependencies": { - "@visactor/vchart": "workspace:1.11.4" + "@visactor/vchart": "workspace:1.11.5" }, "devDependencies": { "@internal/eslint-config": "workspace:*", diff --git a/packages/tt-vchart/src/vchart/index.js b/packages/tt-vchart/src/vchart/index.js index 41b0b39258..3af0f794b1 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 V(t){return Object.prototype.toString.call(t)}function N(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(V(t)!==V(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=N(t),n=N(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 Vt(t){return t>1?0:t<-1?Et:Math.acos(t)}function Nt(t){return t>=1?Pt:t<=-1?-Pt:Math.asin(t)}function Gt(t,e,i,s,n){let r,a;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 Ve,Ne,Ge,We;function Ue(t){return Ve=1/0,Ne=1/0,Ge=-1/0,We=-1/0,t.forEach((t=>{Ve>t.x&&(Ve=t.x),Get.y&&(Ne=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},Vi=Math.sqrt,Ni=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=Vi(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=Ns},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=Vs,Rs=Os=t,Ls=Is=e}function Vs(t,e){Fs.add(Is*t-Os*e),Os=t,Is=e}function Ns(){Vs(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=Vi(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=Vi(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(Vi(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 Vn=16,Nn=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=Vi(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()):Vi(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 Ni((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)*Vi(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 Vr(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 Vr(s).parse(t)},Yr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Lr.DSV,Nr(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",Va="Function",Na="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 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 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 No(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 No("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){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"linearClosed":return ll(t,i)}}class cl 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 dl=["l",0,0,0,0,0,0,0];function ul(t,e,i){const s=dl[0]=t[0];if("a"===s||"A"===s)dl[1]=e*t[1],dl[2]=i*t[2],dl[3]=t[3],dl[4]=t[4],dl[5]=t[5],dl[6]=e*t[6],dl[7]=i*t[7];else if("h"===s||"H"===s)dl[1]=e*t[1];else if("v"===s||"V"===s)dl[1]=i*t[1];else for(let s=1,n=t.length;s{at.getInstance().warn("空函数")}}),Cl=Object.assign(Object.assign({},bl),{points:[],cornerRadius:0,closePath:!0}),El=Object.assign(Object.assign({},bl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},bl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const Pl=Object.assign(Object.assign({},bl),{symbolType:"circle",size:10,keepDirIn3d:!0}),Bl=Object.assign(Object.assign(Object.assign({},bl),vl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Rl=Object.assign(Object.assign(Object.assign({},bl),vl),{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}),Ll=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},bl),{fill:!0,cornerRadius:0}),Ol=Object.assign(Object.assign({},Ll),{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 Il=new class{},Dl={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"}},Fl=!0,jl=!1,zl=/\w|\(|\)|-/,Hl=/[.?!,;:/,。?!、;:]/,Vl=/\S/;function Nl(t,e,i,s,n){if(!e||e<=0)return 0;const r=Il.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=Gl(t,a)),a}function Gl(t,e){let i=e;for(;zl.test(t[i-1])&&zl.test(t[i])||Hl.test(t[i]);)if(i--,i<=0)return e;return i}function Wl(t,e){const i=Il.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 Ul=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Yl=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=Bl.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=Gl(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=Gl(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}};Yl=Ul([Oa()],Yl);var Kl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Xl=Symbol.for("TextMeasureContribution");let $l=class extends Yl{};$l=Kl([Oa()],$l);const ql=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 Va: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===Da&&(t.cache=e,t.activated=!0)}},Zl=Symbol.for("CanvasFactory"),Jl=Symbol.for("Context2dFactory");function Ql(t){return ql.getNamed(Zl,Il.global.env)(t)}const th=1e-4,eh=Math.sqrt(3),ih=1/3;function sh(t){return t>-vh&&tvh||t<-vh}const rh=[0,0],ah=[0,0],oh=[0,0];function lh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function hh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function ch(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 dh(t){return(t%=Rt)<0&&(t+=Rt),t}function uh(t,e,i,s,n,r){if(r>e&&r>s||rn?o:0}function ph(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 fh(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(sh(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 yh=[-1,-1,-1],bh=[-1,-1];function xh(){const t=bh[0];bh[0]=bh[1],bh[1]=t}function Sh(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(sh(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,ih):Math.pow(i,ih),s=s<0?-Math.pow(-s,ih):Math.pow(s,ih);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+eh*Math.sin(e)))/(3*a),h=(-o+i*(s-eh*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,yh);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&xh(),p=ch(e,s,r,o,bh[0]),u>1&&(g=ch(e,s,r,o,bh[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(sh(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,yh);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=hh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);yh[0]=-l,yh[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>=yh[0]+t&&a<=yh[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=yh[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 Mh(t){return Math.round(t/Et*1e8)/1e8%2*Et}function Th(t,e){let i=Mh(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-Mh(i-n)):e&&i1&&(i||(h+=uh(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;wh[0]=S,wh[1]=A,Th(wh,Boolean(a[6])),S=wh[0],A=wh[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(fh(c,d,f,v,e,s,n))return!0}else h+=uh(c,d,f,v,s,n)||0;c=f,d=v;break;case po.C:if(i){if(gh(c,d,f,v,_,y,b,x,e,s,n))return!0}else h+=Sh(c,d,f,v,_,y,b,x,s,n)||0;c=b,d=x;break;case po.Q:if(i){if(ph(c,d,f,v,_,y,e,s,n))return!0}else h+=Ah(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+=uh(c,d,o,l,s,n),i){if(mh(f,v,_,k,k+M,T,e,w,n))return!0}else h+=kh(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(fh(u,p,o,p,e,s,n)||fh(o,p,o,l,e,s,n)||fh(o,l,u,l,e,s,n)||fh(u,l,u,p,e,s,n))return!0}else h+=uh(o,p,o,l,s,n),h+=uh(u,l,u,p,s,n);break;case po.Z:if(i){if(fh(c,d,u,p,e,s,n))return!0}else h+=uh(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},Bh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Rh=Symbol.for("VWindow"),Lh=Symbol.for("WindowHandlerContribution");let Oh=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&&(ql.getNamed(Lh,t.env).configure(this,t),this.actived=!0)},this._uid=ba.GenAutoIncrementId(),this.global=Il.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)}};Oh=Ph([Oa(),Bh("design:paramtypes",[])],Oh);var Ih=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fh=function(t,e){return function(i,s){e(i,s,t)}};let jh=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=Il.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=Eh.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:vl.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:vl.fontFamily,fontSize:vl.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=ql.get(Rh),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 zh;jh=Ih([Oa(),Fh(0,Ra(qa)),Fh(0,Ia(Xl)),Dh("design:paramtypes",[Object])],jh),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(zh||(zh={}));const Hh=new oe;let Vh=class{constructor(){this.matrix=new oe}init(t){return this.mode=zh.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=zh.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Hh.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(Hh.a,Hh.b,Hh.c,Hh.d,Hh.e,Hh.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Hh.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(Hh.a,Hh.b,Hh.c,Hh.d,Hh.e,Hh.f),this}scale(t,e,i){return this.mode===zh.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===zh.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Hh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Hh.a,Hh.b,Hh.c,Hh.d,Hh.e,Hh.f),this}translate(t,e){return this.mode===zh.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===zh.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Vh=Ih([Oa(),Dh("design:paramtypes",[])],Vh);const Nh={arc:xl,area:Sl,circle:Al,line:Tl,path:wl,symbol:Pl,text:Bl,rect:El,polygon:Cl,richtext:Rl,richtextIcon:Ol,image:Ll,group:kl,glyph:Ml},Gh=Object.keys(Nh);function Wh(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Uh={arc:Object.assign({},Nh.arc),area:Object.assign({},Nh.area),circle:Object.assign({},Nh.circle),line:Object.assign({},Nh.line),path:Object.assign({},Nh.path),symbol:Object.assign({},Nh.symbol),text:Object.assign({},Nh.text),rect:Object.assign({},Nh.rect),polygon:Object.assign({},Nh.polygon),richtext:Object.assign({},Nh.richtext),richtextIcon:Object.assign({},Nh.richtextIcon),image:Object.assign({},Nh.image),group:Object.assign({},Nh.group),glyph:Object.assign({},Nh.glyph)};class Yh{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Gh.forEach((t=>{this._defaultTheme[t]=Object.create(Uh[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;Gh.forEach((s=>{const n=Object.create(Uh[s]);t&&t[s]&&Wh(n,t[s]),i[s]&&Wh(n,i[s]),e[s]&&Wh(n,e[s]),this.combinedTheme[s]=n})),e.common&&Gh.forEach((t=>{Wh(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 Kh=new Yh;function Xh(t,e){return t.glyphHost?Xh(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)):Kh.getTheme()}return null}(t)||t.attachedThemeGraphic&&Xh(t.attachedThemeGraphic)||Kh.getTheme()}var $h=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=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 $h(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 Qh))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(sc(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 Qh))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=sc(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 Qh))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=sc(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 Qh))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=sc(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 Qh))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=ic.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(sc(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(sc(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,sc(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 Qh))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"):sc(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 tc))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=ic.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 nc(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 Qh,this.rootWheelEvent=new tc,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 lc{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return lc.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 hc{static Avaliable(){return!0}avaliable(){return hc.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 cc{static Avaliable(){return!!Il.global.getRequestAnimationFrame()}avaliable(){return cc.Avaliable()}tick(t,e){Il.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var dc;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(dc||(dc={}));class uc{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-uc.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*uc.bounceIn(2*t):.5*uc.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}}}uc.quadIn=uc.getPowIn(2),uc.quadOut=uc.getPowOut(2),uc.quadInOut=uc.getPowInOut(2),uc.cubicIn=uc.getPowIn(3),uc.cubicOut=uc.getPowOut(3),uc.cubicInOut=uc.getPowInOut(3),uc.quartIn=uc.getPowIn(4),uc.quartOut=uc.getPowOut(4),uc.quartInOut=uc.getPowInOut(4),uc.quintIn=uc.getPowIn(5),uc.quintOut=uc.getPowOut(5),uc.quintInOut=uc.getPowInOut(5),uc.backIn=uc.getBackIn(1.7),uc.backOut=uc.getBackOut(1.7),uc.backInOut=uc.getBackInOut(1.7),uc.elasticIn=uc.getElasticIn(1,.3),uc.elasticOut=uc.getElasticOut(1,.3),uc.elasticInOut=uc.getElasticInOut(1,.3*1.5);class pc{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 gc=new pc;class mc{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(){}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 fc extends mc{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let vc=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]:gc;this.id=t,this.timeline=e,this.status=Ao.INITIAL,this.tailAnimate=new _c(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.duration===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 fc((()=>{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 _c(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()}};vc.mode=ko.NORMAL,vc.interpolateMap=new Map;class _c{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 yc(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?uc[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?uc[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 yc(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 yc{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 bc=200,xc="cubicOut",Sc=1e3,Ac="quadInOut";var kc;!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"}(kc||(kc={}));const Mc=[!1,!1,!1,!1],Tc=[0,0,0,0],wc=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Tc[0]=t[0],Tc[2]=t[0],Tc[1]=t[1],Tc[3]=t[1],Tc):t:t:0,Cc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Ec=[1,2,3,0,1,2,3,0];function Pc(t,e,i,s){for(;t>=Rt;)t-=Rt;for(;t<0;)t+=Rt;for(;t>e;)e+=Rt;Cc[0].x=i,Cc[1].y=i,Cc[2].x=-i,Cc[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]:Ic.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)}}Ic.TimeOut=1e3/60;const Dc=new Ic,Fc=(t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class jc extends mc{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 zc;!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"}(zc||(zc={}));class Hc extends mc{constructor(t,e,i,s,n){super(t,e,i,s,n),this.newPointAnimateType="appear"===(null==n?void 0:n.newPointAnimateType)?"appear":"grow"}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}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?[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=Bc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),i.points=this.points}}class Vc extends mc{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 Nc extends Vc{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=Il.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 Gc extends Vc{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=Il.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 Wc extends mc{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 Uc extends mc{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?uc[n]:n;e=r(e),s.onUpdate(t,e,i)})),this.updating=!1)}}function Yc(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 Kc(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 Qc(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 td(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 sd(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}))),ad=(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]},od=(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 ad(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return ad(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);od(n[0],s,i),od(n[1],e-s,i)}};var ld;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(ld||(ld={}));class hd{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ld.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===ld.Color1){const e=hd.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];hd.store1[t]=e,hd.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=hd.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&&(hd.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],hd.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===ld.Color1){if(hd.store1[t])return;hd.store1[t]=i,hd.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(hd.store255[t])return;hd.store255[t]=i,hd.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function cd(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 dd(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)=>ud(y(t)?t[r]:t,y(e)?e[r]:e,i,s))):ud(t,e,i,s,n)}function ud(t,e,i,s,n){if(!t||!e)return t&&cd(t)||e&&cd(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=hd.Get(t,ld.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=hd.Get(e,ld.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:cd(a)})))});return o?dd(r,l,i,s,n):dd(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:md(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:md(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:md(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),cd(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)}hd.store255={},hd.store1={};const pd=[0,0,0,0],gd=[0,0,0,0];function md(t,e,i){return hd.Get(t,ld.Color255,pd),hd.Get(e,ld.Color255,gd),`rgba(${Math.round(pd[0]+(gd[0]-pd[0])*i)},${Math.round(pd[1]+(gd[1]-pd[1])*i)},${Math.round(pd[2]+(gd[2]-pd[2])*i)},${pd[3]+(gd[3]-pd[3])*i})`}const fd=(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=dd(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},vd=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?Qc(t):[],n=Qc(e);i&&s&&(i.fromTransform&&td(s,i.fromTransform.clone().getInverse()),td(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})))},yd=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],bd=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!yd.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]?hd.Get(t[n],ld.Color255):t[n],to:"string"==typeof r?hd.Get(r,ld.Color255):r,key:n}):i.push({from:t[n],to:r,key:n}),s=!0)})),s?i:null};class xd extends mc{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;vd(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&fd(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Sd=(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=_d(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=bd(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 xd({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Sc,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Ac)),c};class Ad extends mc{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;vd(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&&fd(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const kd=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Lc.includes(t))(i)||(e[i]=t[i])})),e},Md=(t,e,i)=>{const s=kd(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=Il.graphicService.creator.rect({x:0,y:0,width:a,height:o});n.appendChild(i),e.push(i)}))}},Td=(t,e,i)=>{const s=[],n=i?null:kd(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:kd(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=id(t.attribute),n=sd(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(Il.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=sd(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(Il.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=sd(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(Il.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 nd(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 nd(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(Il.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:rd(i)}];const s=[];return od(i,e,s),s})(t,e).forEach((t=>{s.push(Il.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 od(r,e,h),h})(t,e).forEach((t=>{s.push(Il.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=Qc(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(Il.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(Il.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Md(t,s,e),s};class Cd{static GetImage(t,e){var i;const s=Cd.cache.get(t);s?"fail"===s.loadState?Il.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):Cd.loadImage(t,e)}static GetSvg(t,e){var i;let s=Cd.cache.get(t);s?"fail"===s.loadState?Il.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"},Cd.cache.set(t,s),s.dataPromise=Il.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=Cd.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"},Cd.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Il.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Il.global.loadBlob(t):"json"===e&&(i.dataPromise=Il.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Cd.isLoading&&Cd.toLoadAueue.length){Cd.isLoading=!0;const t=Cd.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Cd.cache.set(i,n),n.dataPromise=Il.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((()=>{Cd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Cd.loading()})).catch((t=>{console.error(t),Cd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Cd.loading()}))}}),0)}static loadImage(t,e){const i=Ed(t,Cd.toLoadAueue);if(-1!==i)return Cd.toLoadAueue[i].marks.push(e),void Cd.loading();Cd.toLoadAueue.push({url:t,marks:[e]}),Cd.loading()}static improveImageLoading(t){const e=Ed(t,Cd.toLoadAueue);if(-1!==e){const t=Cd.toLoadAueue.splice(e,1);Cd.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Ed(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;Dd.x=n+(null!==(i=t.scrollX)&&void 0!==i?i:0),Dd.y=r+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else Dd.x=n,Dd.y=r;return Dd}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Il.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Il.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]:Rd;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Rd;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(Il.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:bc,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:xc),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 Bd.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(Bd),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=pl.x,y:e=pl.y,scaleX:i=pl.scaleX,scaleY:s=pl.scaleY,angle:n=pl.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),Il.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(pl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Pd.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),Il.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=dd(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=dd(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=dd(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 Xh(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:Il.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 cl).fromString(t):this.pathProxy=new cl,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",Il.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new ec(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)}}}jd.mixin(rc);class zd{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 Hd(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Vd(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 Nd=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class Gd{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=Vd(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Hd(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Vd(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 zd(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 zd(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 Wd(t,e){return Ud(t)}function Ud(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 Zd=0;function Jd(){return Zd++}var Qd;function tu(t){const e=[];let i=0,s="";for(let n=0;neu.set(t,!0)));const iu=new Map;function su(t){if(eu.has(t))return!0;if(iu.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>iu.set(t,!0)));const nu=Jd(),ru=Jd(),au=Jd(),ou=Jd(),lu=Jd(),hu=Jd(),cu=Jd(),du=Jd(),uu=Jd(),pu=Jd();Jd();const gu=Jd();Jd();const mu=Jd(),fu=Jd(),vu=Jd(),_u=Symbol.for("GraphicService"),yu=Symbol.for("GraphicCreator"),bu={"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"},xu=Object.keys(bu);var Su;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Su||(Su={}));let Au=class t extends jd{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=hu,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 Yh),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Yh)}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;Il.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),Il.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=pl.x,y:e=pl.y,dx:i=pl.dx,dy:s=pl.dy,scaleX:n=pl.scaleX,scaleY:r=pl.scaleY,angle:a=pl.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=Xh(this).group;this._AABBBounds.clear();const i=Il.graphicService.updateGroupAABBBounds(t,e,this._AABBBounds,this),{boundsPadding:s=e.boundsPadding}=t,n=wc(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(),Il.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Il.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,Il.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{Il.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),Il.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=Il.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 ku(t){return new Au(t)}Au.NOWORK_ANIMATE_ATTR=Fd;class Mu extends Au{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 Yh,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=>{Il.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=>{Il.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 Tu=Symbol.for("TransformUtil"),wu=Symbol.for("GraphicUtil"),Cu=Symbol.for("LayerService"),Eu=Symbol.for("StaticLayerHandlerContribution"),Pu=Symbol.for("DynamicLayerHandlerContribution"),Bu=Symbol.for("VirtualLayerHandlerContribution");var Ru,Lu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)};let Iu=Ru=class{static GenerateLayerId(){return`${Ru.idprefix}_${Ru.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Il.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(Eu):"dynamic"===t?ql.get(Pu):ql.get(Bu),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 Mu(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Ru.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)}};Iu.idprefix="visactor_layer",Iu.prefix_count=0,Iu=Ru=Lu([Oa(),Ou("design:paramtypes",[])],Iu);var Du=new xa((t=>{t(io).to(ao).inSingletonScope(),t(Rh).to(Oh),t(wu).to(jh).inSingletonScope(),t(Tu).to(Vh).inSingletonScope(),t(Cu).to(Iu).inSingletonScope()}));function Fu(t,e){return!(!t&&!e)}function ju(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function zu(t,e,i){return i&&t*e>0}function Hu(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Vu(t,e){return t*e>0}function Nu(t,e,i,s){return t*e>0&&0!==i&&0!==s}function Gu(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 Uu(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(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:m,outerEndAngle:f,innerEndAngle:v,innerStartAngle:_}=t.getParsePadAngle(o,l),y=u,b=u,x=u,S=u,A=Math.max(b,y),k=Math.max(x,S);let M=A,T=k;const w=n*It(m),C=n*jt(m),E=r*It(v),P=r*jt(v);let B,R,L,O;if((k>Ct||A>Ct)&&(B=n*It(f),R=n*jt(f),L=r*It(_),O=r*jt(_),hCt){const t=Ft(y,M),r=Ft(b,M),o=Wu(L,O,w,C,n,t,Number(c)),l=Wu(B,R,E,P,n,r,Number(c));M0&&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+B,s+n*jt(f))}else!a||a[0]?(e.moveTo(i+w,s+C),e.arc(i,s,n,m,f,!c)):e.moveTo(i+n*It(f),s+n*jt(f));if(!(r>Ct)||g<.001)!a||a[1]?e.lineTo(i+E,s+P):e.moveTo(i+E,s+P),d=!0;else if(T>Ct){const t=Ft(S,T),n=Ft(x,T),o=Wu(E,P,B,R,r,-n,Number(c)),l=Wu(w,C,L,O,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),T0&&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+L,s+O)}else!a||a[1]?e.lineTo(i+E,s+P):e.moveTo(i+E,s+P),!a||a[2]?e.arc(i,s,r,v,_,c):e.moveTo(i+r*It(_),s+r*jt(_))}return a?a[3]&&e.lineTo(i+n*It(o),s+n*jt(o)):e.closePath(),d}class Yu{static GetCanvas(){try{return Yu.canvas||(Yu.canvas=Il.global.createCanvas({})),Yu.canvas}catch(t){return null}}static GetCtx(){if(!Yu.ctx){const t=Yu.GetCanvas();Yu.ctx=t.getContext("2d")}return Yu.ctx}}class Ku extends le{static getInstance(){return Ku._instance||(Ku._instance=new Ku),Ku._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=Yu.GetCanvas(),s=Yu.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 Ku(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Xu{static GetSize(t){for(let e=0;e=t)return Xu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Xu.GenKey(t,e,i,s,n),l=Xu.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=Xu.GenKey(t,e,i,s,n);Xu.cache[l]?Xu.cache[l].push({width:a,height:o,pattern:r}):Xu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}Xu.cache={},Xu.ImageSize=[20,40,80,160,320,640,1280,2560];const $u=Symbol.for("ArcRenderContribution"),qu=Symbol.for("AreaRenderContribution"),Zu=Symbol.for("CircleRenderContribution"),Ju=Symbol.for("GroupRenderContribution"),Qu=Symbol.for("ImageRenderContribution"),tp=Symbol.for("PathRenderContribution"),ep=Symbol.for("PolygonRenderContribution"),ip=Symbol.for("RectRenderContribution"),sp=Symbol.for("SymbolRenderContribution"),np=Symbol.for("TextRenderContribution"),rp=Symbol.for("InteractiveSubRenderContribution"),ap=["radius","startAngle","endAngle",...Rd];class op extends jd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=ou}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=Xh(this).circle;this._AABBBounds.clear();const i=this.attribute,s=Il.graphicService.updateCircleAABBBounds(i,Xh(this).circle,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=wc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xh(this).circle[t]}needUpdateTags(t){return super.needUpdateTags(t,ap)}needUpdateTag(t){return super.needUpdateTag(t,ap)}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 cl;return o.arc(0,0,n,r,a),o}clone(){return new op(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return op.NOWORK_ANIMATE_ATTR}}function lp(t){return new op(t)}function hp(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 cp(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function dp(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)}op.NOWORK_ANIMATE_ATTR=Fd;class up{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=vu,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=Xh(this).text;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=this.attribute,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}updateWrapAABBBounds(t){var e,i,s,n;const r=Xh(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=Fc(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=Il.graphicUtil.textMeasure,k=new up(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===Qd.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=cp(x,o),M=dp(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=Xh(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=Fc(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 _=Il.graphicUtil.textMeasure,y=new up(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=Xh(this).text,a=Il.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=Fc(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=cp(x,o),e=this.cache.verticalList.length*b,i=dp(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=>tu(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===Qd.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=cp(x,o),M=this.cache.verticalList.length*b,T=dp(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 Xh(this).text[t]}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pp;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pp;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function mp(t){return new gp(t)}gp.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Fd),gp.baselineMapAlign={top:"left",bottom:"right",middle:"center"},gp.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class fp{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 vp(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 _p=new class extends fp{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 vp(t,e/2,i,s,n)}drawOffset(t,e,i,s,n,r){return vp(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 yp=new class extends fp{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 bp(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 xp=new class extends fp{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 bp(t,e/2,i,s,n)}drawFitDir(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)}};function Sp(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Ap=new class extends fp{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Sp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Sp(t,e/2+n,i,s)}};class kp extends fp{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 Mp=new kp;var Tp=new class extends kp{constructor(){super(...arguments),this.type="triangle"}};const wp=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Cp=Math.sin(Bt/10)*wp,Ep=-Math.cos(Bt/10)*wp;function Pp(t,e,i,s){const n=Cp*e,r=Ep*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 Bp=new class extends fp{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 Pp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Pp(t,e/2+n,i,s)}};const Rp=zt(3);function Lp(t,e,i,s){const n=e,r=n/Rp,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 Op=new class extends fp{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 Lp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Lp(t,e/2+n,i,s)}};function Ip(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 Dp=new class extends fp{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Ip(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Ip(t,e/2+n,i,s)}};function Fp(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var jp=new class extends fp{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}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)}};const zp=-.5,Hp=zt(3)/2,Vp=1/zt(12);function Np(t,e,i,s){const n=e/2,r=e*Vp,a=n,o=e*Vp+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(zp*n-Hp*r+i,Hp*n+zp*r+s),t.lineTo(zp*a-Hp*o+i,Hp*a+zp*o+s),t.lineTo(zp*l-Hp*h+i,Hp*l+zp*h+s),t.lineTo(zp*n+Hp*r+i,zp*r-Hp*n+s),t.lineTo(zp*a+Hp*o+i,zp*o-Hp*a+s),t.lineTo(zp*l+Hp*h+i,zp*h-Hp*l+s),t.closePath(),!1}var Gp=new class extends fp{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 Np(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Np(t,e/2+n,i,s)}};var Wp=new class extends fp{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 Up=new class extends fp{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 Yp=new class extends fp{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 Kp=zt(3);function Xp(t,e,i,s){const n=e*Kp;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var $p=new class extends kp{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Xp(t,e/2/Kp,i,s)}drawOffset(t,e,i,s,n){return Xp(t,e/2/Kp+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 Zp=new class extends fp{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 Jp(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 Qp=new class extends fp{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 Jp(t,e/4,i,s)}drawOffset(t,e,i,s,n){return Jp(t,e/4+n,i,s)}};function tg(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 eg=new class extends fp{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 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-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var sg=new class extends fp{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 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,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var rg=new class extends fp{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return ng(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return ng(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 ag(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var og=new class extends fp{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return ag(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return ag(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 lg(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 hg=new class extends fp{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 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-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function cg(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function dg(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var ug=new class extends fp{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)?dg(t,e,i,s):cg(t,e,i,s)}drawOffset(t,e,i,s,n){return S(e)?dg(t,e+2*n,i,s):cg(t,[e[0]+2*n,e[1]+2*n],i,s)}};const pg=new Qt;class gg{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;pg.x1=s.bounds.x1*t,pg.y1=s.bounds.y1*t,pg.x2=s.bounds.x2*t,pg.y2=s.bounds.y2*t,e.union(pg)}))}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 mg={};[_p,yp,xp,Ap,$p,Tp,Bp,Op,Dp,jp,Gp,Wp,Up,Mp,Yp,Zp,Qp,eg,sg,ug,rg,og,hg].forEach((t=>{mg[t.type]=t}));const fg={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"},vg=new Qt,_g=["symbolType","size",...Rd];let yg=class t extends jd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=fu}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=Xh(this).symbol;let{symbolType:i=e.symbolType}=this.attribute,s=mg[i];if(s)return this._parsedPath=s,s;if(s=t.userSymbolMap[i],s)return this._parsedPath=s,s;if(i=fg[i]||i,!0===((n=i).startsWith("{const e=(new cl).fromString(t.d),i={};xu.forEach((e=>{t[e]&&(i[bu[e]]=t[e])})),r.push({path:e,attribute:i}),vg.union(e.bounds)}));const a=vg.width(),o=vg.height(),l=1/Dt(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new gg(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var n;const r=(new cl).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 gg(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=Xh(this).symbol;this._AABBBounds.clear();const i=this.attribute,s=Il.graphicService.updateSymbolAABBBounds(i,Xh(this).symbol,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=wc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xh(this).symbol[t]}needUpdateTags(t){return super.needUpdateTags(t,_g)}needUpdateTag(t){return super.needUpdateTag(t,_g)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new cl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new cl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function bg(t){return new yg(t)}yg.userSymbolMap={},yg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Fd);const xg=["segments","points","curveType",...Rd];let Sg=class t extends jd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=du}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=Rc(i,s,e))}doUpdateAABBBounds(){const t=Xh(this).line;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateLineAABBBounds(e,Xh(this).line,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xh(this).line[t]}needUpdateTags(t){return super.needUpdateTags(t,xg)}needUpdateTag(t){return super.needUpdateTag(t,xg)}toCustomPath(){const t=this.attribute,e=new cl,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 Ag(t){return new Sg(t)}Sg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Fd);const kg=["width","x1","y1","height","cornerRadius",...Rd];class Mg extends jd{constructor(t){super(t),this.type="rect",this.numberType=gu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}doUpdateAABBBounds(){const t=Xh(this).rect;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateRectAABBBounds(e,Xh(this).rect,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xh(this).rect[t]}needUpdateTags(t){return super.needUpdateTags(t,kg)}needUpdateTag(t){return super.needUpdateTag(t,kg)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:s,height:n}=id(t),r=new cl;return r.moveTo(e,i),r.rect(e,i,s,n),r}clone(){return new Mg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Mg.NOWORK_ANIMATE_ATTR}}function Tg(t){return new Mg(t)}Mg.NOWORK_ANIMATE_ATTR=Fd;class wg extends jd{constructor(t){super(t),this.type="glyph",this.numberType=lu,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=Il.graphicService.updateGlyphAABBBounds(this.attribute,Xh(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 wg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return wg.NOWORK_ANIMATE_ATTR}}function Cg(t){return new wg(t)}wg.NOWORK_ANIMATE_ATTR=Fd;class Eg{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=Dl[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 Pg{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const s=Fc(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}=Wl(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}=Wl(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=Nl(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}=Wl(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||jl;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||Fl;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=Nl(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Wl(this.text.slice(t),this.character);return i+this.ellipsisWidth-s}return i}}const Bg=["width","height","image",...Rd];class Rg extends jd{constructor(t){super(t),this.type="image",this.numberType=cu,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=Xh(this).image;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateImageAABBBounds(e,Xh(this).image,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Ll[t]}needUpdateTags(t){return super.needUpdateTags(t,Bg)}needUpdateTag(t){return super.needUpdateTag(t,Bg)}clone(){return new Rg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Rg.NOWORK_ANIMATE_ATTR}}function Lg(t){return new Rg(t)}Rg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Fd);class Og extends Rg{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=wc(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=wc(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=Ll.width,height:e=Ll.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 Ig{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 Og?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=Dl[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Pg){const e=Vl.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 Og)break;if("vertical"===this.direction&&"vertical"!==s.direction){s.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";s.ellipsisStr=r;const{width:a}=Wl(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 Og)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 Og)break;const{width:n}=Wl(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 Og?t.width:t.getWidthWithEllips(this.direction)})),i}}class Dg{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=Dl[this.direction]}store(t){if(t instanceof Og){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 Ig(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 Og?"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=Nl(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 Pg(i,t.newLine,t.character),new Pg(s,!0,t.character)]}(t,s);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const Fg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...Rd];class jg extends jd{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=mu}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Rl.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:Rl.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:Rl.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:Rl.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:Rl.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:Rl.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:Rl.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:Rl.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=Xh(this).richtext;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateRichTextAABBBounds(e,Xh(this).richtext,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Rl[t]}needUpdateTags(t){return super.needUpdateTags(t,Fg)}needUpdateTag(t){return super.needUpdateTag(t,Fg)}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(){var t;const{textConfig:e=[],maxWidth:i,maxHeight:s,width:n,height:r,ellipsis:a,wordBreak:o,verticalDirection:l,textAlign:h,textBaseline:c,layoutDirection:d,singleLine:u,disableAutoWrapLine:p}=this.attribute,g=[];for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,g.push(t)}}else{const i=this.combinedStyleToCharacter(e[t]);if(S(i.text)&&(i.text=`${i.text}`),i.text&&i.text.includes("\n")){const t=i.text.split("\n");for(let e=0;e0,f="number"==typeof s&&Number.isFinite(s)&&s>0,v="number"==typeof n&&Number.isFinite(n)&&n>0&&(!m||n<=i),_="number"==typeof r&&Number.isFinite(r)&&r>0&&(!f||r<=s),y=new Eg(0,0,(v?n:m?i:0)||0,(_?r:f?s:0)||0,a,o,l,h,c,d||"horizontal",!v&&m,!_&&f,u||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),b=new Dg(y);if(p){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 jg.NOWORK_ANIMATE_ATTR}}function zg(t){return new jg(t)}jg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Fd);const Hg=["path","customPath",...Rd];class Vg extends jd{constructor(t){super(t),this.type="path",this.numberType=uu}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=Xh(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof cl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof cl?this.cache:t.path)}doUpdateAABBBounds(){const t=Xh(this).path;this.doUpdatePathShape(),this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updatePathAABBBounds(e,Xh(this).path,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new cl).fromString(t.path):t.customPath&&(this.cache=new cl,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xh(this).path[t]}needUpdateTags(t){return super.needUpdateTags(t,Hg)}needUpdateTag(t){return super.needUpdateTag(t,Hg)}toCustomPath(){return(new cl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Vg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Vg.NOWORK_ANIMATE_ATTR}}function Ng(t){return new Vg(t)}Vg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Fd);const Gg=["segments","points","curveType",...Rd];class Wg extends jd{constructor(t){super(t),this.type="area",this.numberType=au}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=Xh(this).area;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateAreaAABBBounds(e,Xh(this).area,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Rc(i,s,e))}getDefaultAttribute(t){return Xh(this).area[t]}needUpdateTags(t){return super.needUpdateTags(t,Gg)}needUpdateTag(t){return super.needUpdateTag(t,Gg)}toCustomPath(){const t=new cl,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 Wg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Wg.NOWORK_ANIMATE_ATTR}}function Ug(t){return new Wg(t)}Wg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Fd);const Yg=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Rd];class Kg extends jd{constructor(t){super(t),this.type="arc",this.numberType=nu}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=Xh(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);return Math.min(S(e,!0)?e:a*parseFloat(e)/100,a/2)}getParsedAngle(){const t=Xh(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=Xh(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=Nt(Number(l)/o*jt(g)),n=Nt(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=Xh(this).arc;this._AABBBounds.clear();const i=this.attribute,s=Il.graphicService.updateArcAABBBounds(i,Xh(this).arc,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=wc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return super.needUpdateTags(t,Yg)}needUpdateTag(t){return super.needUpdateTag(t,Yg)}getDefaultAttribute(t){return Xh(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 Kg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Kg.NOWORK_ANIMATE_ATTR}}function Xg(t){return new Kg(t)}Kg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Fd);const $g=["points","cornerRadius",...Rd];class qg extends jd{constructor(t){super(t),this.type="polygon",this.numberType=pu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=Xh(this).polygon;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updatePolygonAABBBounds(e,Xh(this).polygon,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Rc(i,s,e))}getDefaultAttribute(t){return Xh(this).polygon[t]}needUpdateTags(t){return super.needUpdateTags(t,$g)}needUpdateTag(t){return super.needUpdateTag(t,$g)}toCustomPath(){const t=this.attribute.points,e=new cl;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 Zg(t){return new qg(t)}qg.NOWORK_ANIMATE_ATTR=Fd;class Jg extends Au{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 Qg(t){return new Jg(t)}class tm{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 em extends tm{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 im{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 im.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},am=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},om=function(t,e){return function(i,s){e(i,s,t)}};function lm(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 hm(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 cm(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 dm(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),lm(t,t,[n+o,r+l,a+h]),lm(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),lm(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=nm.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]}lm(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),lm(i,i,[-s[0],-s[1],0]),cm(t,t,i)}}let um=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 tm],this._symbolBoundsContribitions=[new em],this._imageBoundsContribitions=[new tm],this._circleBoundsContribitions=[new tm],this._arcBoundsContribitions=[new tm],this._pathBoundsContribitions=[new tm]}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,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}=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 h=this.tempAABBBounds1,c=this.tempAABBBounds2;return h.setValue(i.x1,i.y1,i.x2,i.y2),c.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=dp(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=cp(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),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}=t,r=i;return n.forEach((t=>{r.add(t.x,t.y)})),r}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{r.add(t.x,t.y)}))})),r}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):Pc(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):(Pc(h,l,n,i),Pc(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&&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)}};um=rm([Oa(),om(0,Ra(yu)),am("design:paramtypes",[Object])],um);const pm=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 gm,mm;function fm(t){return gm||(gm=pm.CreateGraphic("text",{})),gm.initAttributes(t),gm.AABBBounds}const vm={x:0,y:0,z:0,lastModelMatrix:null};class _m{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=zu(o,l,n),p=Vu(o,c),g=Fu(n,r),m=ju(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;vm.x=n,vm.y=r,vm.z=a,vm.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=nm.allocate(),n=nm.allocate();dm(n,t,e),cm(s,d||s,n),vm.x=0,vm.y=0,vm.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),nm.free(n)}if(g&&!d){const s=t.getOffsetXY(e);vm.x+=s.x,vm.y+=s.y,vm.z=a,i.setTransformForCurrent()}else if(p)vm.x=0,vm.y=0,vm.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);vm.x+=s.x,vm.y+=s.y,this.transformWithoutTranslate(i,vm.x,vm.y,vm.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),vm.x=0,vm.y=0,vm.z=0;return vm}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=Xh(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,_=zu(d,u,h),y=Vu(d,g),b=Fu(h),x=ju(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&&nm.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}const ym=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 bm{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(bm.IsGradientStr(t))try{const e=ym(t)[0];if(e){if("linear"===e.type)return bm.ParseLinear(e);if("radial"===e.type)return bm.ParseRadial(e);if("conic"===e.type)return bm.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 xm(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 Sm(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 Am=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},km=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mm=function(t,e){return function(i,s){e(i,s,t)}};class Tm{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=Xh(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=Eh.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),Eh.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 wm=new Tm;let Cm=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)}))}};Cm=Am([Oa(),Mm(0,Ra(qa)),Mm(0,Ia(rp)),km("design:paramtypes",[Object])],Cm);class Em{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=Eh.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])),Eh.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 Pm=new Em;const Bm=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=xm(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T+r,innerRadius:M-r,startAngle:_-a,endAngle:y+a}),e.beginPath(),Uu(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=xm(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T-r,innerRadius:M+r,startAngle:_+a,endAngle:y-a}),e.beginPath(),Uu(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})}},Rm=Pm,Lm=wm;const Om=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=xm(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=xm(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()}}}},Im=Pm,Dm=wm;const Fm=new class extends Tm{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()}},jm=Et/2;function zm(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],-jm,0,!1)}if(t.lineTo(_[0],_[1]),!q(v,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,jm,!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],jm,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+jm,!1)}return t.closePath(),t}var Hm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Vm{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=xm(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(),zm(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=xm(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(),zm(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 Nm=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)}};Nm=Hm([Oa()],Nm);let Gm=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()}}};Gm=Hm([Oa()],Gm);const Wm=new Vm,Um=Pm,Ym=wm;const Km=new class extends Vm{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)}},Xm=new class extends Tm{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=Xh(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=wc(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?zm(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 $m=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=xm(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=xm(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=Pm,Zm=wm;var Jm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},tf=function(t,e){return function(i,s){e(i,s,t)}};let ef=class extends _m{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=nu,this.builtinContributions=[Bm,Lm,Rm],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||T>Ct)&&(O=n*It(y),I=n*jt(y),D=r*It(x),F=r*jt(x),uCt){const t=Ft(S,C),r=Ft(A,C),a=Wu(D,F,P,B,n,t,Number(p)),o=Wu(O,I,R,L,n,r,Number(p));if(C0&&e.arc(i+o.cx,s+o.cy,r,Ot(o.y11,o.x11),Ot(o.y01,o.x01),!p)}}else e.moveTo(i+P,s+B);if(!(r>Ct)||v<.001)e.lineTo(i+R,s+L),g=!0;else if(E>Ct){const t=Ft(M,E),n=Ft(k,E),a=Wu(R,L,O,I,r,-n,Number(p)),o=Wu(P,B,D,F,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),E0&&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(x),s+r*jt(x));return g}drawShape(t,e,i,s,n,r,a,o){const l=Xh(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++)Mc[s]=t,i&&(i=!(null!==(e=Mc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Mc[e]=!!t[e],i&&(i=!!Mc[e]);else Mc[0]=!1,Mc[1]=!1,Mc[2]=!1,Mc[3]=!1;return{isFullStroke:i,stroke:Mc}})(d);if((v||C)&&(e.beginPath(),Uu(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(),Uu(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),dd(o.color,l.color,h,!1)}(0,0,h,n);a||zu&&(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=Xh(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}};ef=Jm([Oa(),tf(0,Ra(qa)),tf(0,Ia($u)),Qm("design:paramtypes",[Object])],ef);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 _m{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=ou,this.builtinContributions=[Om,Dm,Im],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Xh(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=Xh(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function of(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 lf(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),of(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 cf=class extends _m{constructor(){super(...arguments),this.numberType=du}draw(t,e,i,s){const n=Xh(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;lf(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(),lf(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"===f)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=hl(t.points,f,{startPoint:e});return s=n,n})).filter((t=>!!t)),"linearClosed"===f){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===v){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],v,_,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=v*r;let g=0,m=!1;t.cache.forEach(((r,f)=>{if(m)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(m=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[f],[l,t.attribute],Ft(y,1),_,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,v,_,i,s,t,a,o)}};function df(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 uf(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),of(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),of(t,l,1,s),o=!1):o=!0}t.closePath()}cf=hf([Oa()],cf);const pf=new class extends Em{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:Oc(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Oc(l,"textureColor")),textureSize:b=(null!==(m=t.attribute.textureSize)&&void 0!==m?m:Oc(l,"textureSize")),texturePadding:x=(null!==(f=t.attribute.texturePadding)&&void 0!==f?f:Oc(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},gf=wm;var mf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ff=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)}};function _f(t,e,i){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"linearClosed":return ll(t,i)}}let yf=class extends _m{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=au,this.builtinContributions=[pf,gf],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=Xh(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}=t.attribute,b=this.valid(t,g,a,o);if(!b)return;const{doFill:x,doStroke:S}=b,{clipRange:A=g.clipRange,closePath:k,points:M,segments:T}=t.attribute;let{curveType:w=g.curveType}=t.attribute;if(k&&"linear"===w&&(w="linearClosed"),1===A&&!T&&!M.some((t=>!1===t.defined))&&"linear"===w)return this.drawLinearAreaHighPerformance(t,e,!!m,S,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(T&&T.length){let e,i;const s=T.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=_f(t.points,w,{startPoint:e});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=T.length-1;t>=0;t--){const e=T[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=T[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=_f(i,"stepBefore"===w?"stepAfter":"stepAfter"===w?"stepBefore":w),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!M||!M.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=M,i=[];for(let t=M.length-1;t>=0;t--)i.push({x:null!==(u=M[t].x1)&&void 0!==u?u:M[t].x,y:null!==(p=M[t].y1)&&void 0!==p?p:M[t].y});const s=_f(e,w),n=_f(i,"stepBefore"===w?"stepAfter":"stepAfter"===w?"stepBefore":w);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===A){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,x,v,S,y,r[c],[g,t.attribute],A,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=A*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,x,v,S,y,r[u],[g,t.attribute],Ft(m,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,x,v,S,y,t.attribute,g,A,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Xh(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=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),df(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),df(t,e,i,s),e.length=0,i.length=0)}n=o})),df(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},Af=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kf=function(t,e){return function(i,s){e(i,s,t)}};let Mf=class extends _m{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=uu,this.builtinContributions=[xf,bf],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:Xh(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=Xh(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Mf=Sf([Oa(),kf(0,Ra(qa)),kf(0,Ia(tp)),Af("design:paramtypes",[Object])],Mf);var Tf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 _m{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=gu,this.builtinContributions=[Wm,Ym,Um],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Xh(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=Hu(g,m,k,M,c),w=Nu(g,v,k,M),C=Fu(c,d),E=ju(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(),zm(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=Xh(t,null==s?void 0:s.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Ef=Tf([Oa(),Cf(0,Ra(qa)),Cf(0,Ia(ip)),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 _m{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=fu,this.builtinContributions=[$m,Zm,qm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=Xh(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=Xh(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Lf=Pf([Oa(),Rf(0,Ra(qa)),Rf(0,Ia(sp)),Bf("design:paramtypes",[Object])],Lf);const Of=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 If=new class extends Tm{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=Of.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=fm(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?(zm(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&&Of.free(C),w()}};var Df=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ff=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jf=function(t,e){return function(i,s){e(i,s,t)}};let zf=class extends _m{constructor(t){super(),this.textRenderContribitions=t,this.numberType=vu,this.builtinContributions=[If],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Xh(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=Fc(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=sm.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),sm.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=Xh(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=cp(l,f),_=dp(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=dp("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 Hf(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},Yf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kf=function(t,e){return function(i,s){e(i,s,t)}};let Xf=class extends _m{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=pu,this.builtinContributions=[Wf,Gf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Xh(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))?Hf(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 Hf(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=Vf(d,u),b=Vf(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*f);const S=Nf(h,_,y,d,u),A=Nf(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Vf(k,M),w=Nf(h,Vf(_,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=Xh(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Xf=Uf([Oa(),Kf(0,Ra(qa)),Kf(0,Ia(ep)),Yf("design:paramtypes",[Object])],Xf);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},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)}};const Jf=["","repeat-x","repeat-y","repeat"];let Qf=class extends _m{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=cu,this.builtinContributions=[Km,Xm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Xh(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(),zm(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,Jf[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 Cd.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Xh(t).image;this._draw(t,a,!1,i)}};Qf=$f([Oa(),Zf(0,Ra(qa)),Zf(0,Ia(Qu)),qf("design:paramtypes",[Object])],Qf);const tv=Symbol.for("IncrementalDrawContribution"),ev=Symbol.for("ArcRender"),iv=Symbol.for("AreaRender"),sv=Symbol.for("CircleRender"),nv=Symbol.for("GraphicRender"),rv=Symbol.for("GroupRender"),av=Symbol.for("LineRender"),ov=Symbol.for("PathRender"),lv=Symbol.for("PolygonRender"),hv=Symbol.for("RectRender"),cv=Symbol.for("SymbolRender"),dv=Symbol.for("TextRender"),uv=Symbol.for("RichTextRender"),pv=Symbol.for("GlyphRender"),gv=Symbol.for("ImageRender"),mv=Symbol.for("DrawContribution");var fv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)};const _v=Symbol.for("DrawItemInterceptor"),yv=new Qt,bv=new Qt;class xv{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return t.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){yv.copy(s.dirtyBounds),bv.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(yv),s.backupDirtyBounds.copy(bv)),!0}}class Sv{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 Av=class{constructor(){this.order=1,this.interceptors=[new xv,new Mv,new kv,new Sv]}afterDrawItem(t,e,i,s,n){for(let r=0;r(e=t.numberType===ru,!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&&nm.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Tv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},Cv=function(t,e){return function(i,s){e(i,s,t)}};const Ev=Symbol.for("RenderService");let Pv=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}};Pv=Tv([Oa(),Cv(0,Ra(mv)),wv("design:paramtypes",[Object])],Pv);var Bv=new xa((t=>{t(Ev).to(Pv)}));const Rv=Symbol.for("PickerService"),Lv=Symbol.for("GlobalPickerService");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};const Iv=Symbol.for("PickItemInterceptor");let Dv=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){if(!t.shadowRoot)return null;const{parentMatrix:r}=n||{};if(!r)return null;const a=e.pickContext;a.highPerformanceSave();const o=t.shadowRoot,l=sm.allocateByObj(r),h=new $t(l.a*i.x+l.c*i.y+l.e,l.b*i.x+l.d*i.y+l.f),c=e.pickGroup(o,h,l,s);return a.highPerformanceRestore(),c}};Dv=Ov([Oa()],Dv);let Fv=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}};Fv=Ov([Oa()],Fv);let jv=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===ru,!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()}};jv=Ov([Oa()],jv);var zv=new xa(((t,e,i)=>{i(Rv)||(t(Lv).toSelf(),t(Rv).toService(Lv)),t(jv).toSelf().inSingletonScope(),t(Iv).toService(jv),t(Dv).toSelf().inSingletonScope(),t(Iv).toService(Dv),t(Fv).toSelf().inSingletonScope(),t(Iv).toService(Fv),Ja(t,Iv)})),Hv=new xa((t=>{t(_u).to(um).inSingletonScope(),t(yu).toConstantValue(pm)}));const Vv=Symbol.for("AutoEnablePlugins"),Nv=Symbol.for("PluginService");var Gv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},Uv=function(t,e){return function(i,s){e(i,s,t)}};let Yv=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(Vv)&&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=[]}};Yv=Gv([Oa(),Uv(0,Ra(qa)),Uv(0,Ia(Vv)),Wv("design:paramtypes",[Object])],Yv);var Kv=new xa((t=>{t(Nv).to(Yv),function(t,e){t(qa).toDynamicValue((t=>{let{container:i}=t;return new Za(e,i)})).whenTargetNamed(e)}(t,Vv)})),Xv=new xa((t=>{Ja(t,eo)})),$v=new xa((t=>{t(Xl).to($l).inSingletonScope(),Ja(t,Xl)})),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)};let Jv=class{constructor(){this.type="static",this.offscreen=!1,this.global=Il.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=Ql({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()}};Jv=qv([Oa(),Zv("design:paramtypes",[])],Jv);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},t_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let e_=class{constructor(){this.offscreen=!1,this.type="virtual",this.global=Il.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(){}};e_=Qv([Oa(),t_("design:paramtypes",[])],e_);var i_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},s_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let n_=class{constructor(){this.offscreen=!0,this.type="dynamic",this.global=Il.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;const s=Ql({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){}};n_=i_([Oa(),s_("design:paramtypes",[])],n_);var r_=new xa((t=>{t(Jv).toSelf(),t(n_).toSelf(),t(e_).toSelf(),t(Eu).toService(Jv),t(Pu).toService(n_),t(Bu).toService(e_)}));var a_=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 o_(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 a_(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,s)}))}function h_(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 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)},u_=function(t,e){return function(i,s){e(i,s,t)}};let p_=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=Il.global,this.layerService=Il.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:bl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:bl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,sm.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=h_(e,i,bl.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=Of.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=sm.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))})):o_(t,bl.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),Of.free(n),sm.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(tv);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},m_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},f_=function(t,e){return function(i,s){e(i,s,t)}};let v_=class{constructor(t){this.groupRenderContribitions=t,this.numberType=hu}drawShape(t,e,i,s,n,r,a,o){const l=Xh(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=Hu(u,f,p,g,h),k=Nu(u,v,p,g),M=Fu(h,c),T=ju(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(),zm(e,i,s,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Fm));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=Xh(t,null==s?void 0:s.theme).group,l=n.modelMatrix;if(n.camera){const e=nm.allocate(),i=nm.allocate();dm(i,t,o),cm(e,l||e,i),n.modelMatrix=e,nm.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&&nm.free(n.modelMatrix),n.modelMatrix=l,n.baseGlobalAlpha/=a,d&&d.then?d.then((()=>{r?n.restore():n.highPerformanceRestore()})):r?n.restore():n.highPerformanceRestore()}};v_=g_([Oa(),f_(0,Ra(qa)),f_(0,Ia(Ju)),m_("design:paramtypes",[Object])],v_);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};let y_=class extends cf{constructor(){super(...arguments),this.numberType=du}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=Xh(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=zu(u,p,c),_=Vu(u,g),y=Fu(c),b=ju(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())}};y_=__([Oa()],y_);var b_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 x_=class extends yf{constructor(){super(...arguments),this.numberType=au}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=Xh(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=zu(u,d,c),m=Fu(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())}};x_=b_([Oa()],x_);var S_,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},k_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},M_=function(t,e){return function(i,s){e(i,s,t)}},T_=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"}(S_||(S_={}));let w_=class extends p_{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=S_.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 T_(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:bl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:bl.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 T_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return T_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>T_(this,void 0,void 0,(function*(){if(2!==t.count)yield l_(t,bl.zIndex,((i,s)=>{if(this.status===S_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return T_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return T_(this,void 0,void 0,(function*(){this.rendering&&(this.status=S_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=S_.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 T_(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:()=>T_(this,void 0,void 0,(function*(){yield l_(t,bl.zIndex,(t=>T_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};w_=A_([Oa(),M_(0,La(nv)),M_(1,Ra(y_)),M_(2,Ra(x_)),M_(3,Ra(qa)),M_(3,Ia(_v)),k_("design:paramtypes",[Array,Object,Object,Object])],w_);var C_=new xa((t=>{t(Tm).toSelf().inSingletonScope(),t(Em).toSelf().inSingletonScope(),t(mv).to(p_),t(tv).to(w_),t(rv).to(v_).inSingletonScope(),t(nv).toService(rv),Ja(t,Ju),t(Cm).toSelf().inSingletonScope(),Ja(t,rp),Ja(t,nv),t(Av).toSelf().inSingletonScope(),t(_v).toService(Av),Ja(t,_v)}));function E_(){E_.__loaded||(E_.__loaded=!0,ql.load(Du),ql.load(Hv),ql.load(Bv),ql.load(zv),ql.load(Kv),function(t){t.load(Xv),t.load($v),t.load(r_)}(ql),function(t){t.load(C_)}(ql))}E_.__loaded=!1,E_();const P_=ql.get(io);Il.global=P_;const B_=ql.get(wu);Il.graphicUtil=B_;const R_=ql.get(Tu);Il.transformUtil=R_;const L_=ql.get(_u);Il.graphicService=L_;const O_=ql.get(Cu);Il.layerService=O_;class I_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Il.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),Il.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){Il.graphicService.hooks.onAttributeUpdate.taps=Il.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onSetStage.taps=Il.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class D_{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 F_{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,Il.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))})),Il.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){Il.graphicService.hooks.onAddIncremental.taps=Il.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onClearIncremental.taps=Il.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Il.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 j_{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)),Il.graphicService.hooks.onRemove.unTap(this.key),Il.graphicService.hooks.onRelease.unTap(this.key),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?Il.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:Il.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return function(t){const e={};return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[ni(i)]=t[i])})),["fontSize","lineHeight"].forEach((i=>{const s=ni(i);u(t[i])||(e[s]=/^[0-9]*$/.test(`${t[i]}`)?`${t[i]}px`:`${t[i]}`)})),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:Xh(t).text)}getTransformOfText(t){const e=Xh(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=Il.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),f=o+m.left-p.left,v=l+m.top-p.top;if(a.left=`${f}px`,a.top=`${v}px`,"text"===t.type&&"position"===c&&(a=Object.assign(Object.assign({},a),this.getTransformOfText(t))),d(n.style)){const e=n.style({top:v,left:f,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)));Il.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"===Il.global.env&&(t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:bl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:bl.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&&Il.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"===Il.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 z_=new Qt;class H_{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()})),Il.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&&(z_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(z_,t.parent&&t.parent.globalTransMatrix)))})),Il.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))})),Il.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){Il.graphicService.hooks.beforeUpdateAABBBounds.taps=Il.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.afterUpdateAABBBounds.taps=Il.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)),Il.graphicService.hooks.onRemove.taps=Il.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const V_=new Qt;class N_{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=Xh(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,Il.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),Il.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&V_.copy(s)})),Il.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(V_.equals(i)||this.tryLayout(t,!1))})),Il.graphicService.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1)}))}deactivate(t){Il.graphicService.hooks.onAttributeUpdate.taps=Il.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.beforeUpdateAABBBounds.taps=Il.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.afterUpdateAABBBounds.taps=Il.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onSetStage.taps=Il.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const G_=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===dc.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=dc.INITIAL,Il.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),Il.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:cc},{mode:"timeout",cons:hc},{mode:"manual",cons:lc}];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!==dc.INITIAL&&(this.status=dc.PAUSE,!0)}resume(){return this.status!==dc.INITIAL&&(this.status=dc.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===dc.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===dc.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=dc.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=dc.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};G_.addTimeline(gc),G_.setFPS(60);class W_{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=hd.Get(e,ld.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)?hd.Get(e,ld.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}function U_(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 Y_(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 K_{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=nm.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=nm.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()})),i&&Il.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))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])this.htmlMap[o].root.render(r);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t){const i=n.createRoot(t);i.render(r),this.htmlMap||(this.htmlMap={}),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}}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 Z_="white";class J_ extends Au{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:Z_}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 Yh,this.hooks={beforeRender:new to(["stage"]),afterRender:new to(["stage"])},this.global=Il.global,!this.global.env&&$_()&&this.global.setEnv("browser"),this.window=ql.get(Rh),this.renderService=ql.get(Ev),this.pluginService=ql.get(Nv),this.layerService=ql.get(Cu),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:Z_,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||G_,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new pc,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 oc(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 W_(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 K_(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 D_))}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 I_))}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 F_))}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 H_,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 N_))}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 j_))}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){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(){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){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(){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];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];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){this.pickerService||(this.pickerService=ql.get(Rv));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){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){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;const e=ql.get(Rh),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;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 Q_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ty=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ey=new oe(1,0,0,1,0,0),iy={x:0,y:0};let sy=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 cl,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 sm.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(sm.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(sm.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},iy),function(t,e,i){return Ch(t,0,!1,e,i)}(this.path.commandList,iy.x,iy.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},iy);const i=xm(this,this.lineWidth,this.dpr);return function(t,e,i,s){return Ch(t,e,!0,i,s)}(this.path.commandList,i,iy.x,iy.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(ey,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=>sm.free(t))),this.stack.length=0}};sy=Q_([Oa(),ty("design:paramtypes",[Object,Number])],sy);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},ry=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ay={WIDTH:500,HEIGHT:500,DPR:1};let oy=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=ay.WIDTH,height:n=ay.HEIGHT,dpr:r=ay.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)}};oy.env="browser",oy=ny([Oa(),ry("design:paramtypes",[Object])],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};let hy=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}}};hy=ly([Oa()],hy);var cy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let uy=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}};uy=cy([Oa(),dy("design:paramtypes",[])],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)},my=function(t,e){return function(i,s){e(i,s,t)}};let fy=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=Il.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=nm.allocate();if(hm(i,e),a){if(i){const t=nm.allocate();r.modelMatrix=cm(t,a,i),nm.free(i)}}else hm(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=Xh(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=Xh(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&&nm.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),sm.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function vy(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&&vy(t,e,a,s,n),n.push(t[a],t[a+1]),i-a>2&&vy(t,a,i,s,n))}function _y(t,e){const i=t.length-1,s=[t[0]];return vy(t,0,i,e,s),s.push(t[i]),s}fy=py([Oa(),my(0,Ra(qa)),my(0,Ia(Iv)),gy("design:paramtypes",[Object])],fy);let yy=!1;const by=new xa((t=>{yy||(yy=!0,t(ef).toSelf().inSingletonScope(),t(ev).to(ef).inSingletonScope(),t(nv).toService(ev),t($u).toService(Cm),Ja(t,$u))}));let xy=!1;const Sy=new xa((t=>{xy||(xy=!0,t(Ef).toSelf().inSingletonScope(),t(hv).to(Ef).inSingletonScope(),t(nv).toService(hv),t(Gm).toSelf(),t(Nm).toSelf(),t(ip).toService(Gm),t(ip).toService(Nm),t(ip).toService(Cm),Ja(t,ip))}));let Ay=!1;const ky=new xa((t=>{Ay||(Ay=!0,t(cf).toSelf().inSingletonScope(),t(y_).toSelf().inSingletonScope(),t(av).to(cf).inSingletonScope(),t(nv).toService(av))}));let My=!1;const Ty=new xa((t=>{My||(My=!0,t(yf).toSelf().inSingletonScope(),t(iv).to(yf).inSingletonScope(),t(nv).toService(iv),t(qu).toService(Cm),Ja(t,qu),t(x_).toSelf().inSingletonScope())}));let wy=!1;const Cy=new xa((t=>{wy||(wy=!0,t(Lf).toSelf().inSingletonScope(),t(cv).to(Lf).inSingletonScope(),t(nv).toService(cv),t(sp).toService(Cm),Ja(t,sp))}));let Ey=!1;const Py=new xa((t=>{Ey||(Ey=!0,t(af).toSelf().inSingletonScope(),t(sv).to(af).inSingletonScope(),t(nv).toService(sv),t(Zu).toService(Cm),Ja(t,Zu))}));let By=!1;const Ry=new xa((t=>{By||(By=!0,t(dv).to(zf).inSingletonScope(),t(nv).toService(dv),t(np).toService(Cm),Ja(t,np))}));let Ly=!1;const Oy=new xa((t=>{Ly||(Ly=!0,t(Mf).toSelf().inSingletonScope(),t(ov).to(Mf).inSingletonScope(),t(nv).toService(ov),t(tp).toService(Cm),Ja(t,tp))}));let Iy=!1;const Dy=new xa((t=>{Iy||(Iy=!0,t(lv).to(Xf).inSingletonScope(),t(nv).toService(lv),t(ep).toService(Cm),Ja(t,ep))}));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};let jy=class{constructor(){this.numberType=lu}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=Xh(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};jy=Fy([Oa()],jy);let zy=!1;const Hy=new xa((t=>{zy||(zy=!0,t(pv).to(jy).inSingletonScope(),t(nv).toService(pv))}));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},Ny=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Gy=class extends _m{constructor(){super(),this.numberType=mu,this.builtinContributions=[If],this.init()}drawShape(t,e,i,s,n){const r=Xh(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=zu(o,l,!0),d=zu(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=Xh(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(),zm(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=Xh(t).richtext;this._draw(t,s,!1,i)}};Gy=Vy([Oa(),Ny("design:paramtypes",[])],Gy);let Wy=!1;const Uy=new xa((t=>{Wy||(Wy=!0,t(uv).to(Gy).inSingletonScope(),t(nv).toService(uv))}));let Yy=!1;const Ky=new xa((t=>{Yy||(Yy=!0,t(gv).to(Qf).inSingletonScope(),t(nv).toService(gv),t(Qu).toService(Cm),Ja(t,Qu))}));const Xy=(t,e)=>(d(qy.warnHandler)&&qy.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),$y=(t,e,i)=>{if(!d(qy.errorHandler))throw new Error(t);qy.errorHandler.call(null,t,e)},qy={silent:!1,warnHandler:!1,errorHandler:!1},Zy=$_(),Jy=Zy&&globalThis?globalThis.document:void 0;function Qy(t){return("desktop-browser"===t||"mobile-browser"===t)&&Zy}function tb(t){return eb(t)||"mobile-browser"===t}function eb(t){return t.includes("miniApp")||"lynx"===t||"wx"===t}let ib=0;function sb(){return ib>=9999999&&(ib=0),ib++}function nb(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function rb(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const ab=(t,e,i)=>(t.fields=e||[],t.fname=i,t),ob=t=>e=>R(e,t),lb=t=>{at.getInstance().error(t)},hb=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||lb("Access path missing open bracket: "+t),o>0&&h(),o=0,s=n+1):n>s?h():s=n+1}return o&&lb("Access path missing closing bracket: "+t),a&&lb("Access path missing closing quote: "+t),n>s&&(n+=1,h()),e})(t),n=1===s.length?s[0]:t;return ab((i&&i.get||ob)(s),[n],e||n)},cb=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(y(t)){const s=t.map((t=>hb(t,e,i)));return t=>s.map((e=>e(t)))}return hb(t,e,i)};cb("id");const db=ab((function(t){return t}),[],"identity"),ub=ab((function(){return 0}),[],"zero");ab((function(){return 1}),[],"one"),ab((function(){return!0}),[],"true"),ab((function(){return!1}),[],"false"),ab((function(){return{}}),[],"emptyObject");const pb=(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=>gb(t,r,n)))))},mb=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t;function fb(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 vb(t,e,i,s,n){let r=0,a=0;return fb(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function _b(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;fb(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:vb(t,e,i,n,h)}}function yb(t){return"horizontal"===t}function bb(t){return"vertical"===t}const xb=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Sb extends Au{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,xb.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=>xb.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"},Zb=(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 Jb 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=ic.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=ic.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=Zb(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=ic.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=Zb(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=ic.now()-i>this.config.press.time&&Zb(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},tx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ex=[0,0,0];let ix=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({},gl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},fl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},vl),{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 sm.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&&(sm.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(sm.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&&Xu.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&&(Y_(ex,[t,e,i],this.modelMatrix),t=ex[0],e=ex[1],i=ex[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&&(Y_(ex,[t,e,i],this.modelMatrix),t=ex[0],e=ex[1],i=ex[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Y_(ex,[e,i,s],this.modelMatrix),e=ex[0],i=ex[1],s=ex[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]:Il.global.measureTextMethod;var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Il.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:vl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:vl.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&&(Y_(ex,[e,i,s],this.modelMatrix),e=ex[0],i=ex[1],s=ex[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=Sm(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=xm(this,l,this.dpr),r.strokeStyle=Sm(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=hp(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=hp(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=>sm.free(t))),this.stack.length=0}};ix.env="browser",ix=Qb([Oa(),tx("design:paramtypes",[Object,Number])],ix);var 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},nx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let rx=class extends oy{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Il.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new ix(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 ax(t,e){return new xa((i=>{i(Zl).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Jl).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}rx.env="browser",rx=sx([Oa(),nx("design:paramtypes",[Object])],rx);const ox=ax(rx,ix);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},hx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cx=function(t,e){return function(i,s){e(i,s,t)}};let dx=class extends fy{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=Eh.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 px=class{constructor(){this.type="group",this.numberType=hu}contains(t,e,i){return!1}};px=ux([Oa()],px);const gx=new xa(((t,e,i,s)=>{gx.__vloaded||(gx.__vloaded=!0,t(Kb).to(px).inSingletonScope(),t(Xb).toService(Kb),Ja(t,Xb))}));gx.__vloaded=!1;var mx=gx;const fx=new xa(((t,e,i,s)=>{i(dx)||t(dx).toSelf().inSingletonScope(),i(Rv)?s(Rv).toService(dx):t(Rv).toService(dx)}));var vx,_x=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let bx=vx=class extends uy{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${vx.idprefix}_${vx.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Il.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:vx.GenerateCanvasId(),canvasControled:!0};this.canvas=new rx(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 rx({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)}};bx.env="browser",bx.idprefix="visactor_window",bx.prefix_count=0,bx=vx=_x([Oa(),yx("design:paramtypes",[])],bx);const xx=new xa((t=>{t(bx).toSelf(),t(Lh).toDynamicValue((t=>t.container.get(bx))).whenTargetNamed(bx.env)}));var 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)};class kx{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 Mx(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 Tx=class extends hy{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 kx(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 Mx(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Mx(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}}};Tx=Sx([Oa(),Ax("design:paramtypes",[])],Tx);const wx=new xa((t=>{wx.isBrowserBound||(wx.isBrowserBound=!0,t(Tx).toSelf().inSingletonScope(),t(eo).toService(Tx))}));function Cx(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Cx.__loaded||(Cx.__loaded=!0,t.load(wx),t.load(ox),t.load(xx),e&&function(t){t.load(mx),t.load(fx)}(t))}wx.isBrowserBound=!1,Cx.__loaded=!1;var Ex=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Px=class extends ix{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}};Px.env="feishu",Px=Ex([Oa()],Px);var Bx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Rx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Lx=class extends oy{constructor(t){super(t)}init(){this._context=new Px(this,this._dpr)}release(){}};Lx.env="feishu",Lx=Bx([Oa(),Rx("design:paramtypes",[Object])],Lx);const Ox=ax(Lx,Px);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)},Fx=function(t,e){return function(i,s){e(i,s,t)}};class jx{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 zx=class extends uy{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new jx}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 Lx(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 Lx({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()}};zx.env="feishu",zx=Ix([Oa(),Fx(0,Ra(io)),Dx("design:paramtypes",[Object])],zx);const Hx=new xa((t=>{t(zx).toSelf(),t(Lh).toDynamicValue((t=>t.container.get(zx))).whenTargetNamed(zx.env)}));var Vx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Gx=function(t,e){return function(i,s){e(i,s,t)}};let Wx=class extends fy{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 sy(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}};Wx=Vx([Oa(),Gx(0,Ra(qa)),Gx(0,Ia(Ab)),Gx(1,Ra(qa)),Gx(1,Ia(Iv)),Nx("design:paramtypes",[Object,Object])],Wx);const Ux=new xa((t=>{Ux.__vloaded||(Ux.__vloaded=!0,Ja(t,Ab))}));Ux.__vloaded=!1;var Yx=Ux,Kx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$x=function(t,e){return function(i,s){e(i,s,t)}};let qx=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=nu}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=Xh(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}};qx=Kx([Oa(),$x(0,Ra(ev)),Xx("design:paramtypes",[Object])],qx);let Zx=!1;const Jx=new xa(((t,e,i,s)=>{Zx||(Zx=!0,t(kb).to(qx).inSingletonScope(),t(Ab).toService(kb))}));var Qx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},eS=function(t,e){return function(i,s){e(i,s,t)}};let iS=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=au}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=Xh(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}};iS=Qx([Oa(),eS(0,Ra(iv)),tS("design:paramtypes",[Object])],iS);let sS=!1;const nS=new xa(((t,e,i,s)=>{sS||(sS=!0,t(Mb).to(iS).inSingletonScope(),t(Ab).toService(Mb))}));var rS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oS=function(t,e){return function(i,s){e(i,s,t)}};let lS=class{constructor(t){this.canvasRenderer=t,this.type="circle",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=Xh(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}};lS=rS([Oa(),oS(0,Ra(sv)),aS("design:paramtypes",[Object])],lS);let hS=!1;const cS=new xa(((t,e,i,s)=>{hS||(hS=!0,t(Tb).to(lS).inSingletonScope(),t(Ab).toService(Tb))}));var dS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pS=function(t,e){return function(i,s){e(i,s,t)}};let gS=class{constructor(t){this.canvasRenderer=t,this.type="glyph",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=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}};gS=dS([Oa(),pS(0,Ra(pv)),uS("design:paramtypes",[Object])],gS);let mS=!1;const fS=new xa(((t,e,i,s)=>{mS||(mS=!0,t(Ob).to(gS).inSingletonScope(),t(gS).toService(Ob))}));var vS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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{constructor(){this.type="image",this.numberType=cu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};_S=vS([Oa()],_S);let yS=!1;const bS=new xa(((t,e,i,s)=>{yS||(yS=!0,t(wb).to(_S).inSingletonScope(),t(_S).toService(wb))}));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},SS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},AS=function(t,e){return function(i,s){e(i,s,t)}};let kS=class{constructor(t){this.canvasRenderer=t,this.type="line",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=Xh(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}};kS=xS([Oa(),AS(0,Ra(av)),SS("design:paramtypes",[Object])],kS);let MS=!1;const TS=new xa(((t,e,i,s)=>{MS||(MS=!0,t(Cb).to(kS).inSingletonScope(),t(Ab).toService(Cb))}));var wS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ES=function(t,e){return function(i,s){e(i,s,t)}};let PS=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=pu}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=Xh(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}};PS=wS([Oa(),ES(0,Ra(lv)),CS("design:paramtypes",[Object])],PS);let BS=!1;const RS=new xa(((t,e,i,s)=>{BS||(BS=!0,t(Lb).to(PS).inSingletonScope(),t(Ab).toService(Lb))}));var LS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},OS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IS=function(t,e){return function(i,s){e(i,s,t)}};let DS=class{constructor(t){this.canvasRenderer=t,this.type="path",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=Xh(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}};DS=LS([Oa(),IS(0,Ra(ov)),OS("design:paramtypes",[Object])],DS);let FS=!1;const jS=new xa(((t,e,i,s)=>{FS||(FS=!0,t(Eb).to(DS).inSingletonScope(),t(Ab).toService(Eb))}));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},HS=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)}};const NS=new Qt;let GS=class{constructor(t){this.canvasRenderer=t,this.type="rect",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=Xh(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;NS.setValue(i.x1,i.y1,i.x2,i.y2),NS.expand(-r/2),h=!NS.containsPoint(e)}}return s.highPerformanceRestore(),h}};GS=zS([Oa(),VS(0,Ra(hv)),HS("design:paramtypes",[Object])],GS);let WS=!1;const US=new xa(((t,e,i,s)=>{WS||(WS=!0,t(Pb).to(GS).inSingletonScope(),t(Ab).toService(Pb))}));let YS=!1;const KS=new xa(((t,e,i,s)=>{YS||(YS=!0,t(wb).to(_S).inSingletonScope(),t(_S).toService(wb))}));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},$S=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qS=function(t,e){return function(i,s){e(i,s,t)}};let ZS=class{constructor(t){this.canvasRenderer=t,this.type="symbol",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=Xh(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}};ZS=XS([Oa(),qS(0,Ra(cv)),$S("design:paramtypes",[Object])],ZS);let JS=!1;const QS=new xa(((t,e,i,s)=>{JS||(JS=!0,t(Bb).to(ZS).inSingletonScope(),t(Ab).toService(Bb))}));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};let eA=class{constructor(){this.type="text",this.numberType=vu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};eA=tA([Oa()],eA);let iA=!1;const sA=new xa(((t,e,i,s)=>{iA||(iA=!0,t(Rb).to(eA).inSingletonScope(),t(Ab).toService(Rb))})),nA=new xa(((t,e,i,s)=>{i(Wx)||t(Wx).toSelf().inSingletonScope(),i(Rv)?s(Rv).toService(Wx):t(Rv).toService(Wx)}));class rA{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 aA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let lA=class extends hy{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 rA(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 Dc.call(t)}}getCancelAnimationFrame(){return t=>{Dc.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}};lA=aA([Oa(),oA("design:paramtypes",[])],lA);const hA=new xa((t=>{hA.isFeishuBound||(hA.isFeishuBound=!0,t(lA).toSelf().inSingletonScope(),t(eo).toService(lA))}));function cA(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];cA.__loaded||(cA.__loaded=!0,t.load(hA),t.load(Ox),t.load(Hx),e&&function(t){t.load(Yx),t.load(nA),t.load(Jx),t.load(nS),t.load(cS),t.load(fS),t.load(bS),t.load(TS),t.load(RS),t.load(jS),t.load(US),t.load(KS),t.load(QS),t.load(sA)}(t))}hA.isFeishuBound=!1,cA.__loaded=!1;var dA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let pA=class extends ix{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(){}};pA.env="node",pA=dA([Oa(),uA("design:paramtypes",[Object,Number])],pA);var gA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let fA=class extends oy{constructor(t){super(t)}init(){this._context=new pA(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};fA.env="node",fA=gA([Oa(),mA("design:paramtypes",[Object])],fA);const vA=ax(fA,pA);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)},bA=function(t,e){return function(i,s){e(i,s,t)}};let xA=class extends uy{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 fA(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 fA({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){}};xA.env="node",xA=_A([Oa(),bA(0,Ra(io)),yA("design:paramtypes",[Object])],xA);const SA=new xa((t=>{t(xA).toSelf(),t(Lh).toDynamicValue((t=>t.container.get(xA))).whenTargetNamed(xA.env)}));var AA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 kA=class extends hy{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 Dc.call(t)}}getCancelAnimationFrame(){return t=>{Dc.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};kA=AA([Oa()],kA);const MA=new xa((t=>{MA.isNodeBound||(MA.isNodeBound=!0,t(kA).toSelf().inSingletonScope(),t(eo).toService(kA))}));function TA(t){TA.__loaded||(TA.__loaded=!0,t.load(MA),t.load(vA),t.load(SA))}MA.isNodeBound=!1,TA.__loaded=!1;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},CA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},EA=function(t,e){return function(i,s){e(i,s,t)}};let PA=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=nu}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=Xh(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=xm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};PA=wA([Oa(),EA(0,Ra(ev)),CA("design:paramtypes",[Object])],PA);let BA=!1;const RA=new xa(((t,e,i,s)=>{BA||(BA=!0,t(Ib).to(PA).inSingletonScope(),t(Xb).toService(Ib))}));var LA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},OA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IA=function(t,e){return function(i,s){e(i,s,t)}};const DA=new Qt;let FA=class{constructor(t){this.canvasRenderer=t,this.type="rect",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=Xh(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=xm(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;DA.setValue(i.x1,i.y1,i.x2,i.y2),DA.expand(-r/2),h=!DA.containsPoint(e)}}return s.highPerformanceRestore(),h}};FA=LA([Oa(),IA(0,Ra(hv)),OA("design:paramtypes",[Object])],FA);let jA=!1;const zA=new xa(((t,e,i,s)=>{jA||(jA=!0,t(Vb).to(FA).inSingletonScope(),t(Xb).toService(Vb))}));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 VA=class extends _m{};VA=HA([Oa()],VA);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},GA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},WA=function(t,e){return function(i,s){e(i,s,t)}};let UA=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="line",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;s.highPerformanceSave();const n=Xh(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=xm(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&nm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};UA=NA([Oa(),WA(0,Ra(av)),GA("design:paramtypes",[Object])],UA);let YA=!1;const KA=new xa(((t,e,i,s)=>{YA||(YA=!0,t(zb).to(UA).inSingletonScope(),t(Xb).toService(zb))}));var XA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},qA=function(t,e){return function(i,s){e(i,s,t)}};let ZA=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=au}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=Xh(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=xm(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h})),s.highPerformanceRestore(),h}};ZA=XA([Oa(),qA(0,Ra(iv)),$A("design:paramtypes",[Object])],ZA);let JA=!1;const QA=new xa(((t,e,i,s)=>{JA||(JA=!0,t(Db).to(ZA).inSingletonScope(),t(Xb).toService(Db))}));var tk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ik=function(t,e){return function(i,s){e(i,s,t)}};let sk=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=fu}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=Xh(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=xm(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&nm.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};sk=tk([Oa(),ik(0,Ra(cv)),ek("design:paramtypes",[Object])],sk);let nk=!1;const rk=new xa(((t,e,i,s)=>{nk||(nk=!0,t(Nb).to(sk).inSingletonScope(),t(Xb).toService(Nb))}));var ak=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ok=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lk=function(t,e){return function(i,s){e(i,s,t)}};let hk=class{constructor(t){this.canvasRenderer=t,this.type="circle",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=Xh(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=xm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};hk=ak([Oa(),lk(0,Ra(sv)),ok("design:paramtypes",[Object])],hk);let ck=!1;const dk=new xa(((t,e,i,s)=>{ck||(ck=!0,t(Fb).to(hk).inSingletonScope(),t(Xb).toService(Fb))}));var uk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gk=function(t,e){return function(i,s){e(i,s,t)}};let mk=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=vu}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=Xh(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=dp(a,u,n),v=cp(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&&nm.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};mk=uk([Oa(),gk(0,Ra(dv)),pk("design:paramtypes",[Object])],mk);let fk=!1;const vk=new xa(((t,e,i,s)=>{fk||(fk=!0,t(Gb).to(mk).inSingletonScope(),t(Xb).toService(Gb))}));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},yk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bk=function(t,e){return function(i,s){e(i,s,t)}};let xk=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="path",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=Xh(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=xm(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&nm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};xk=_k([Oa(),bk(0,Ra(ov)),yk("design:paramtypes",[Object])],xk);let Sk=!1;const Ak=new xa(((t,e,i,s)=>{Sk||(Sk=!0,t(Hb).to(xk).inSingletonScope(),t(Xb).toService(Hb))}));var kk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mk=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 wk=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=pu}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=Xh(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=xm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};wk=kk([Oa(),Tk(0,Ra(lv)),Mk("design:paramtypes",[Object])],wk);let Ck=!1;const Ek=new xa(((t,e,i,s)=>{Ck||(Ck=!0,t(Wb).to(wk).inSingletonScope(),t(Xb).toService(Wb))}));var Pk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rk=function(t,e){return function(i,s){e(i,s,t)}};let Lk=class{constructor(t){this.canvasRenderer=t,this.type="glyph",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=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}};Lk=Pk([Oa(),Rk(0,Ra(pv)),Bk("design:paramtypes",[Object])],Lk);let Ok=!1;const Ik=new xa(((t,e,i,s)=>{Ok||(Ok=!0,t(Yb).to(Lk).inSingletonScope(),t(Xb).toService(Yb))}));var Dk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Fk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jk=function(t,e){return function(i,s){e(i,s,t)}};let zk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=mu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};zk=Dk([Oa(),jk(0,Ra(uv)),Fk("design:paramtypes",[Object])],zk);let Hk=!1;const Vk=new xa(((t,e,i,s)=>{Hk||(Hk=!0,t(Ub).to(zk).inSingletonScope(),t(Xb).toService(Ub))}));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};let Gk=class{constructor(){this.type="image",this.numberType=cu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Gk=Nk([Oa()],Gk);let Wk=!1;const Uk=new xa(((t,e,i,s)=>{Wk||(Wk=!0,t(jb).to(Gk).inSingletonScope(),t(Xb).toService(jb))})),Yk=$_();function Kk(){Kk.__loaded||(Kk.__loaded=!0,pm.RegisterGraphicCreator("arc",Xg),ql.load(by),ql.load(Yk?RA:Jx))}Kk.__loaded=!1;const Xk=Kk;function $k(){$k.__loaded||($k.__loaded=!0,pm.RegisterGraphicCreator("area",Ug),ql.load(Ty),ql.load(Yk?QA:nS))}$k.__loaded=!1;const qk=$k;function Zk(){Zk.__loaded||(Zk.__loaded=!0,pm.RegisterGraphicCreator("circle",lp),ql.load(Py),ql.load(Yk?dk:cS))}Zk.__loaded=!1;const Jk=Zk;function Qk(){Qk.__loaded||(Qk.__loaded=!0,pm.RegisterGraphicCreator("glyph",Cg),ql.load(Hy),ql.load(Yk?Ik:fS))}Qk.__loaded=!1;const tM=Qk;function eM(){eM.__loaded||(eM.__loaded=!0,pm.RegisterGraphicCreator("group",ku))}eM.__loaded=!1;const iM=eM;function sM(){sM.__loaded||(sM.__loaded=!0,pm.RegisterGraphicCreator("image",Lg),ql.load(Ky),ql.load(Yk?Uk:bS))}sM.__loaded=!1;const nM=sM;function rM(){rM.__loaded||(rM.__loaded=!0,pm.RegisterGraphicCreator("line",Ag),ql.load(ky),ql.load(Yk?KA:TS))}rM.__loaded=!1;const aM=rM;function oM(){oM.__loaded||(oM.__loaded=!0,pm.RegisterGraphicCreator("path",Ng),ql.load(Oy),ql.load(Yk?Ak:jS))}oM.__loaded=!1;const lM=oM;function hM(){hM.__loaded||(hM.__loaded=!0,pm.RegisterGraphicCreator("polygon",Zg),ql.load(Dy),ql.load(Yk?Ek:RS))}hM.__loaded=!1;const cM=hM;function dM(){dM.__loaded||(dM.__loaded=!0,pm.RegisterGraphicCreator("rect",Tg),ql.load(Sy),ql.load(Yk?zA:US))}dM.__loaded=!1;const uM=dM;function pM(){pM.__loaded||(pM.__loaded=!0,pm.RegisterGraphicCreator("richtext",zg),ql.load(Uy),ql.load(Yk?Vk:KS))}pM.__loaded=!1;const gM=pM;function mM(){mM.__loaded||(mM.__loaded=!0,pm.RegisterGraphicCreator("shadowRoot",Qg))}mM.__loaded=!1;const fM=mM;function vM(){vM.__loaded||(vM.__loaded=!0,pm.RegisterGraphicCreator("symbol",bg),ql.load(Cy),ql.load(Yk?rk:QS))}vM.__loaded=!1;const _M=vM;function yM(){yM.__loaded||(yM.__loaded=!0,pm.RegisterGraphicCreator("text",mp),ql.load(Ry),ql.load(Yk?vk:sA))}yM.__loaded=!1;const bM=yM;function xM(){iM(),uM()}const SM=-.5*Math.PI,AM=1.5*Math.PI,kM="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 MM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(MM||(MM={}));const TM={[MM.selectedReverse]:{},[MM.selected]:{},[MM.hover]:{},[MM.hoverReverse]:{}},wM={container:"",width:30,height:30,style:{}},CM={debounce:xt,throttle:St};xM();let EM=class t extends Sb{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"===P_.env?(P_.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),P_.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:CM[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"===P_.env?(P_.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),P_.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",CM[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 PM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&PM(t,e)}))}EM.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 BM=t=>!u(t)&&!1!==t.visible;function RM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function LM(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 IM=["#ffffff","#000000"];function DM(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 FM(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(...IM);for(const n of a)if(t!==n&&FM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function FM(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?jM(t,e)>s:"largeText"===i?jM(t,e)>3:jM(t,e)>4.5}function jM(t,e){const i=zM(t),s=zM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function zM(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 HM(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 VM(t,e){return[t[0]*e,t[1]*e]}function NM(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 GM=(t,e,i,s)=>new Qe(Object.assign({defaultFontParams:Object.assign({fontFamily:kM,fontSize:14},s),getTextBounds:i?void 0:fm,specialCharSet:"-/: .,@%'\"~"+Qe.ALPHABET_CHAR_SET+Qe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function WM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const s=fm({text:t,fontFamily:e.fontFamily||i.fontFamily||kM,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 UM(t){return"rich"===YM(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type")}function YM(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 KM(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 XM(t){const e=YM(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?pm.richtext(KM(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)),pm.text(t))}function $M(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 ZM(){iM(),uM(),_M(),gM(),bM()}var JM=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);nh&&(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,V=JM(a,["visible"]);if(m&&c(H)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},V),{visible:H&&!!s,x:I,y:D,width:k,height:M}),"rect");B(null==f?void 0:f.panel)||(t.states=f.panel),this._bgRect=t}}this._textShape=P}}QM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const tT={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}},eT={poptip:z({},tT)};var iT=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]]}}}}nT.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 rT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 aT=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,nT.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new nT(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,eT.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}))}};aT=rT([Oa()],aT);var oT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 lT=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)}};lT=oT([Oa()],lT);let hT=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)}};hT=oT([Oa()],hT);const cT=new xa(((t,e,i,s)=>{i(aT)||(t(aT).toSelf().inSingletonScope(),t(rp).toService(aT)),i(lT)||(t(lT).toSelf(),t(Vv).toService(lT)),i(hT)||(t(hT).toSelf(),t(Vv).toService(hT))}));class dT extends Sb{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}iM(),aM();class uT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},uT.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})}}uT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},iM(),uM();class pT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},pT.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})}}pT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},iM(),Xk();class gT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},gT.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)}}gT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},iM(),Xk();class mT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},mT.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=SM,endAngle:s=AM}=this.attribute,n=s-i,r=ee(ne(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}mT.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},iM(),lM();class fT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fT.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)}}fT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const vT=new Uint32Array(33),_T=new Uint32Array(33);_T[0]=0,vT[0]=~_T[0];for(let t=1;t<=32;++t)_T[t]=_T[t-1]<<1|1,vT[t]=~_T[t];function yT(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]&vT[31&l]&_T[1+(31&h)])return!0}else{if(i[c]&vT[31&l])return!0;if(i[d]&_T[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,vT[31&n]&_T[1+(31&r)]);else for(s(a,vT[31&n]),s(o,_T[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,_T[31&i]|vT[1+(31&s)]);else for(n(r,_T[31&i]),n(a,vT[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 bT(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 xT(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=bT(t,r),!(s&&e.outOfBounds(r)||e.getRange(r))}function ST(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 ST(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 ST(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 ST(t,e,n,s,h,c)}return!1}const kT=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],MT=["top","inside-top","inside"];function TT(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 wT={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 CT(t,e){var i,s;return null!==(s=null===(i=wT[e])||void 0===i?void 0:i.call(wT,t))&&void 0!==s?s:{from:{},to:{}}}const ET=(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 PT(t,e,i,s){t.attribute.text!==e.attribute.text&&k(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new jc({text:t.attribute.text},{text:e.attribute.text},i,s))}const BT={mode:"same-time",duration:300,easing:"linear"};function RT(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 LT(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 OT(t){return 3===t||4===t}function IT(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 DT=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)}},FT=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 jT(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 zT(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)}}iM(),bM(),gM(),aM();class HT extends Sb{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},HT.defaultAttributes,t)),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(MM.hover,!0),PM(this,(t=>{t===e||B(t.states)||t.addState(MM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(PM(this,(t=>{B(t.states)||(t.removeState(MM.hoverReverse),t.removeState(MM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void PM(this,(t=>{B(t.states)||(t.removeState(MM.selectedReverse),t.removeState(MM.selected))}));B(e.states)||(e.addState(MM.selected,!0),PM(this,(t=>{t===e||B(t.states)||t.addState(MM.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:[];(this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)]).forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(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[zT(g,m,c,d,a,o),zT(-g,-m,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds);if(i){const t=pm.line({points:i});return e&&e.attribute.fill&&t.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&t.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(t),t}}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)),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 XM(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&&y.setRange(bT(v,t.AABBBounds,!0))}))),m.length>0&&m.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&&y.setRange(bT(v,t.AABBBounds,!0))})):t.AABBBounds&&y.setRange(bT(v,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 i=new Map,s=this._graphicToText||new Map,n=[],r=[],{visible:a}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{const o=this.getRelatedGraphic(t.attribute),l=t.attribute.id,h=this._isCollectionBase?l:o,c=(null==s?void 0:s.get(h))?"update":"enter";let d;if(a&&(d=this._createLabelLine(t,o)),"enter"===c){if(n.push(t),i.set(h,d?{text:t,labelLine:d}:{text:t}),o){const{from:i,to:s}=CT(t.attribute,"fadeIn");this.add(t),d&&(r.push(d),this.add(d)),this._syncStateWithRelatedGraphic(o),this._animationConfig.enter.duration>0&&o.once("animate-bind",(a=>{t.setAttributes(i),d&&d.setAttributes(i);const l=this._afterRelatedGraphicAttributeUpdate(t,n,d,r,e,o,s,this._animationConfig.enter);o.on("afterAttributeUpdate",l)}))}}else if("update"===c){const e=s.get(h);s.delete(h),i.set(h,e);const n=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&&PT(t,e,s,n))}i.forEach(((i,s)=>{const{duration:n,easing:r,increaseEffect:a=!0,channel:o}=i,{from:l,to:h}=ET(t,e,o,i.options);B(h)||t.animate().to(h,n,r),"text"in l&&"text"in h&&a&&PT(t,e,n,r)}))})(n,t,this._animationConfig.update),e.labelLine&&d&&e.labelLine.animate().to(d.attribute,r,a)}})),s.forEach((t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(CT(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=i}_renderWithOutAnimation(t){var e;const i=new Map,s=this._graphicToText||new Map,{visible:n}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach((t=>{const e=this.getRelatedGraphic(t.attribute),r=(null==s?void 0:s.get(e))?"update":"enter",a=this._isCollectionBase?t.attribute.id:e;let o;if(n&&(o=this._createLabelLine(t,e)),"enter"===r)i.set(a,o?{text:t,labelLine:o}:{text:t}),this.add(t),o&&this.add(o),this._syncStateWithRelatedGraphic(e);else if("update"===r){const e=s.get(a);s.delete(a),i.set(a,e),e.text.setAttributes(t.attribute),e.labelLine&&o&&e.labelLine.setAttributes(o.attribute)}})),s.forEach((t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)})),this._graphicToText=i}_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)}}VT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};class NT extends HT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},NT.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}}}NT.tag="rect-label",NT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};let GT=class t extends HT{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 jT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};GT.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class WT{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 UT extends HT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UT.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:"…"}),n=this._createLabelText(s),r=this.getGraphicBounds(n),a=r.x2-r.x1,o=e.map((t=>t.attribute)),l=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),o,i,a);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=LT(l.endAngle-d/2),p=RT(h.x,h.y,l.outerRadius,o),g=RT(h.x,h.y,a+e.line.line1MinLength,o),m=new WT(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);m.pointA=RT(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):OT(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=RT(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=OT(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=OT(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=OT(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?OT(t.quadrant)?"left":"right":OT(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*(OT(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;e1&&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 jT(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 extends HT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},KT.defaultAttributes,t)),this.name="line-data-label"}labeling(t,e){return DT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}KT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const XT={rect:NT,symbol:VT,arc:UT,line:GT,area:YT,"line-data":KT};class $T extends Sb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},$T.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=yT(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(){iM(),aM(),cM(),_M()}function ZT(){iM(),aM(),Xk(),_M()}$T.defaultAttributes={pickable:!1},qT();class JT extends Sb{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({},JT.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=pm.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=pm.line;Y(i)[0].cornerRadius&&(t=pm.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=pm.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}}JT.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}}},ZT();class QT extends JT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JT.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=pm.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 tw,ew;!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"}(tw||(tw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(ew||(ew={}));const iw={[ew.selectedReverse]:{},[ew.selected]:{},[ew.hover]:{},[ew.hoverReverse]:{}},sw={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}}},nw=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 rw(t,e,i){return!mt(t,e,0,1e-6)&&!gt(t,i,0,1e-6)}function aw(t,e,i,s){const n=fm(Object.assign({text:i},s)),r=n.width(),a=n.height(),o=nw(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=rw(o,-l,-h)?((o+l)/c-.5)*r:rw(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=rw(o,-l,-h)?.5*-a:rw(o,h,l)?.5*a:Math.cos(o)>=0?(.5-(h-o)/c)*a:(.5-nw(o-l)/c)*a,{x:p,y:g-m}}function ow(t){const e={};return PM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function lw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function hw(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 VM(r,(s?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}const cw=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!B(s.states)?(s.addState(MM.hover,!0),PM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(MM.hoverReverse,!0)})),s):i},dw=(t,e,i)=>i?(PM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(MM.hoverReverse),t.removeState(MM.hover))})),null):i,uw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(MM.selected)?(PM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(MM.selectedReverse),t.removeState(MM.selected))})),null):s.name&&!B(s.states)?(s.addState(MM.selected,!0),PM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(MM.selectedReverse,!0)})),s):i};class pw extends Sb{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=cw(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=dw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=uw(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=pm.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&&ow(this._innerView),this.removeAllChild(!0),this._innerView=pm.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=pm.group({x:0,y:0,zIndex:1});if(a.name=tw.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=pm.group({x:0,y:0,pickable:!1});t.name=tw.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=pm.group({x:0,y:0,pickable:!1});i.name=tw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=pm.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=tw.tick,r.id=this._getNodeId(t.id),B(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=TM;else{const t=this.data[s],e=z({},TM,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=pm.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=tw.subTick,r.id=this._getNodeId(`${n}`),B(s.state))r.states=TM;else{const i=z({},TM,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=pm.group({x:0,y:0,pickable:!1});return r.name=`${tw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=XM(this._getLabelAttribute(t,e,n,i));if(a.name=tw.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=TM;else{const s=z({},TM,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 QM(Object.assign({},e));i.name=tw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return lw(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({},sw.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 gw(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 mw(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 fw={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&&vw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function vw(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 _w(t,e){for(let i,s=1,n=t.length,r=t[0];s1&&e.height()>1}function bw(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Aw(t,e.attribute.angle)),{angle:Sw(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({},kw(t,e.attribute.angle)),{angle:Sw(e.attribute.angle)}))}))}(t,e),gw(e)}function Sw(){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 Aw(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=Sw(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 kw(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=Sw(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 Mw{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 VM([s[1],-1*s[0]],t*(e?1:-1)*i)}}function Tw(){iM(),aM(),gM(),bM()}var ww=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=NM(_,[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({},iw,c.text),shape:z({},iw,c.shape),panel:z({},iw,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 Aw(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return kw(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)})),xw(i,t),!bw(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(yw);if(B(i))return;let s;s=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i),gw(s);const{method:n="parity",separation:r=0}=e,a=d(n)?n:fw[n]||fw.parity;if(s.length>=3&&_w(s,r)){do{s=a(s,r)}while(s.length>=3&&_w(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&&vw(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=pm.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=tw.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=WM(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}}Cw.defaultAttributes=sw,U(Cw,Mw);class Ew{isInValidValue(t){const{startAngle:e=SM,endAngle:i=AM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=SM,endAngle:i=AM,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 hw(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 Pw,Bw=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=pm.circle(c);d.name=tw.line,d.id=this._getNodeId("line"),B(a.state)||(d.states=z({},iw,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=Bw(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({},iw,d.text),shape:z({},iw,d.shape),panel:z({},iw,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 aw(t,e,i,s)}}Rw.defaultAttributes=sw,U(Rw,Ew);class Lw extends mc{constructor(){super(...arguments),this.mode=ko.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},PM(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{Iw[t]=!0}));const Hw=t=>-Math.log(-t),Vw=t=>-Math.exp(-t),Nw=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,Gw=t=>10===t?Nw:t===Math.E?Math.exp:e=>Math.pow(t,e),Ww=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Uw=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),Yw=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function Kw(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 Xw(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function $w(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),$w(t,i,s)*(e/(1-i))}function Zw(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function Jw(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 eC{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=Zw(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 iC=Symbol("implicit");class sC extends eC{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=Pw.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=iC}clone(){const t=(new sC).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!==iC)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 rC extends sC{constructor(t){super(),this.type=Pw.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:nC(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 nC(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 rC(!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:aC}=xe;function oC(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=aC(_e.parseColorString(t),s);return t=>e(t).formatRgb()}return At(Number(t),Number(e))}return e instanceof ye?aC(t,e):e instanceof _e?aC(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 lC extends eC{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:zw,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zw;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=zw,this._piecewise=Xw,this._interpolate=oC}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?Jw:Xw,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:zw),this.rescale(i)):this._clamp!==zw}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 hC=Math.sqrt(50),cC=Math.sqrt(10),dC=Math.sqrt(2),uC=[1,2,5,10],pC=(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=vC(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?mC(0,-(e-1)/s,s):mC((e-1)/s,0,s)},gC=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 pC(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return pC(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=mC(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=mC(t,e,l);return n&&r.reverse(),r})),vC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=uC[0];return i>=hC?s=uC[3]:i>=cC?s=uC[2]:i>=dC&&(s=uC[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function _C(t,e,i){const s=(e-t)/Math.max(0,i);return vC(s)}function yC(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=_C(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 xC(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 SC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),AC=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})),kC=ft(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=fC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?SC(t,e,n):SC(t,e,tC(n)),h=SC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),MC=ft(((t,e,i,s,n)=>yC(s(t),s(e),i).map((t=>tC(n(t))))));class TC extends lC{constructor(){super(...arguments),this.type=Pw.Linear}clone(){return(new TC).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 gC(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=fC(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 yC(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=xC(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=bC(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=bC(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=bC(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function wC(t){return e=>-t(-e)}function CC(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class EC extends lC{constructor(){super(Ww(10),Gw(10)),this.type=Pw.Log,this._limit=CC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new EC).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=Ww(this._base),s=Gw(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=wC(i),this._pows=wC(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=Hw,this.untransformer=Vw):(this._logs=i,this._pows=s,this._limit=CC(),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 zw}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 AC(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 kC(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 MC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return MC(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=xC(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=Qw(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 PC extends TC{constructor(){super(Uw(1),Yw(1)),this.type=Pw.Symlog,this._const=1}clone(){return(new PC).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=Uw(t),this.untransformer=Yw(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 AC(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 kC(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 MC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return MC(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=xC(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=Qw(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 BC{constructor(){this.type=Pw.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 BC).domain(this._domain).range(this._range).unknown(this._unknown)}}const RC=t=>t.map(((t,e)=>({index:e,value:t}))),LC=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 OC(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function IC(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=GM(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=DC(S,y,m[0],m[m.length-1]):a&&c&&s===e.length-1?T=DC(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=DC(A,b,m[0],m[m.length-1]):a&&d&&s===e.length-1?w=DC(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},jC=(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=GM(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=lw(o,hw(s,o,e,n));return aw(l,hw(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},zC={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&OC(i.AABBBounds,t.AABBBounds,e)||(i=t,0))))}},HC=(t,e,i,s)=>FC(t,e,i).map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),VC=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},NC=(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&&!VC(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?NC(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&&LC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},UC=(t,e)=>{if(Dw(t.type))return((t,e)=>{if(!Dw(t.type))return RC(t.domain());const i=t.range(),s=Math.abs(i[i.length-1]-i[0]);if(s<2)return RC([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=FC(t,h,e).map(((t,e)=>({AABBBounds:t,value:h[e]})));for(;n.length>=3&&IC(n,i);)n=zC.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 RC(h)})(t,e);if(jw(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?RC([s[s.length-1]]):RC([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=HC(t,s,e,c),l=Math.min(...n.map((t=>t[2]))),h=GC(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=HC(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 RC(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=jC(t,i,e),r=$(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=WC(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 RC(c)})(t,e)}return RC(t.domain())};function YC(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 KC(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 XC(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=YC(t,!!n),o=YC(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=KC(e,t,!1,!!n),o=KC(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=YC(t,!!n),o=YC(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class $C extends Sb{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&ow(this._innerView),this.removeAllChild(!0),this._innerView=pm.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 lw(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?`${tw.grid}-sub`:`${tw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=YC(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=KC(t,o,!1,!!a)}const u=pm.path(Object.assign({path:c,z:l},d(r)?z({},this.skipDefault?null:$C.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=YC(o,!!a),f=Lt(o[0].x-o[1].x),v=Lt(o[0].y-o[1].y),_=pm.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:$C.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,Mw);var ZC=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(JC,Ew);const QC="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",tE={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:QC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:QC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},eE={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 iE;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(iE||(iE={}));var sE=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=iE.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=iE.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=iE.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=iE.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=iE.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t),"browser"===P_.env&&(P_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),P_.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===iE.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===iE.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=iE.endHandler):h+=l:this._activeTag===iE.endHandler&&(c+l{t.preventDefault();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===iE.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"===P_.env&&(P_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),P_.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===iE.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===iE.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=sE(i,["formatMethod"]),{formatMethod:a}=s,o=sE(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:V={},brushSelect:N,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=V.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:N?"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),N&&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:N?"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:N?"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"},eE.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=V.symbolType)&&void 0!==y?y:"square"},eE.horizontal),V),{pickable:!G&&(null===(b=V.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},eE.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},eE.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"},eE.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=V.symbolType)&&void 0!==R?R:"square"},eE.vertical),V),{pickable:!G&&(null===(L=V.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},eE.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},eE.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 _y(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 QM(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 aE,oE,lE,hE;function cE(){iM(),ZM()}function dE(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 uE(t,e){const{dx:i,dy:s}=dE(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}rE.defaultAttributes=tE,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"}(aE||(aE={})),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"}(oE||(oE={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(lE||(lE={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(hE||(hE={}));class pE extends Sb{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=cw(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=dw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=uw(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=pm.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=pm.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=pm.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 gE(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 mE(t,e,i,s){t&&(gE(t.startSymbol,e,i,s),t.lines.forEach((t=>gE(t,e,i,s))),gE(t.line,e,i,s),gE(t.endSymbol,e,i,s))}function fE(t,e,i,s){t&&(gE(t.getTextShape(),e,i,s),gE(t.getBgRect(),e,i,s))}function vE(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 _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,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;gE(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)})),gE(t.endSymbol,s+r+a,o,n),gE(e.getTextShape(),s+r+a+o,l,n),gE(e.getBgRect(),s+r+a+o,l,n)}function xE(t,e,i,s,n){mE(t,s,i,n),fE(e,s,i,n)}function SE(t,e,i,s,n){gE(t,s,i,n),fE(e,s,i,n)}function AE(t,e,i,s,n){gE(t,s,i,n),fE(e,s,i,n)}function kE(t,e,i,s,n,r){var a;mE(t,n,s,r),gE(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?fE(i,n,s,r):gE(i,n,s,r)}function ME(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;gE(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)})),gE(e,n+o+l,h,r),gE(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(gE(i.getTextShape(),n+o+l+h+c,d,r),gE(i.getBgRect(),n+o+l+c,d,r)):gE(i,n+o+l+c,d,r)}function TE(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?bE(t,e,s,r,a):"fadeIn"===i&&xE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?bE(t,e,s,n,a):"fadeIn"===i&&xE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){_E(t,s,i,n),yE(e,s,i,n)}(t,e,i,s,n)}}function wE(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&&SE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&SE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){vE(t,s,i,n),yE(e,s,i,n)}(t,e,i,s,n)}}function CE(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&&AE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&AE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){vE(t,s,i,n),yE(e,s,i,n)}(t,e,i,s,n)}}function EE(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?kE(n,r,e,i,s,o):"callIn"===t&&ME(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?kE(n,r,e,i,s,a):"callIn"===t&&ME(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;_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)}(n,r,e,t,i,s)}}const PE={type:"clipIn",duration:500,easing:"linear",delay:0},BE={type:"fadeIn",duration:500,easing:"linear",delay:0},RE={type:"callIn",duration:500,easing:"linear",delay:0},LE={type:"fadeOut",duration:500,easing:"linear",delay:0};class OE extends pE{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=PE,this.defaultExitAnimation=LE}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;uE(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 QM(Object.assign(Object.assign({},e),{state:{panel:z({},TM,null==i?void 0:i.labelBackground),text:z({},TM,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({},TM,null==e?void 0:e.labelBackground),text:z({},TM,null==e?void 0:e.label)}})),this.setLabelPos())}}const IE=.001,DE={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:aE.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]}},FE={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"}}},jE={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:lE.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]}},zE={interactive:!0,label:{position:oE.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}},HE={interactive:!0,label:{position:lE.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}},VE={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"}},NE={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"}},GE={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 WE(){UE._animate=TE}cE(),qT();class UE extends OE{markerAnimate(t){UE._animate&&this._animationConfig&&UE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UE.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(RM(t)?t:t-Math.PI)+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}getTextStyle(t,e,i){return LM(Math.abs(e),Math.PI/2,IE)||LM(Math.abs(e),3*Math.PI/2,IE)?OM(i,e,t):RM(e)?FE.postiveXAxis[t]:FE.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new JT({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},TM,null==a?void 0:a.line),startSymbol:z({},TM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},TM,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({},TM,null==a?void 0:a.line),startSymbol:z({},TM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},TM,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 YE(){KE._animate=wE}UE.defaultAttributes=DE,cE(),cM();class KE extends pE{markerAnimate(t){KE._animate&&this._animationConfig&&KE._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({},KE.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=BE,this.defaultExitAnimation=LE}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({},NE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;uE(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=pm.polygon(Object.assign({points:e},s));r.states=z({},TM,null==n?void 0:n.area),r.name="mark-area-polygon",this._area=r,t.add(r);const a=new QM(Object.assign(Object.assign({},i),{state:{panel:z({},TM,null==n?void 0:n.labelBackground),text:z({},TM,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({},TM,null==s?void 0:s.area)),this._label&&this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},e),{state:{panel:z({},TM,null==s?void 0:s.labelBackground),text:z({},TM,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}}KE.defaultAttributes=zE,cE(),ZT();class XE extends OE{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,{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 lE.arcInnerStart:l=s;case lE.arcOuterStart:l=s;break;case lE.arcInnerEnd:l=n;case lE.arcOuterEnd:l=n;break;case lE.center:case lE.arcInnerMiddle:case lE.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 VE[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 QT({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},TM,null==o?void 0:o.line),startSymbol:z({},TM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},TM,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({},TM,null==o?void 0:o.line),startSymbol:z({},TM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},TM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}}XE.defaultAttributes=jE,cE(),Xk();class $E extends pE{markerAnimate(t){$E._animate&&this._animationConfig&&$E._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({},$E.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcArea",this.defaultUpdateAnimation=BE,this.defaultExitAnimation=LE}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 lE.center:h=(i+s)/2,c=(n+r)/2;break;case lE.arcInnerStart:h=i,c=n;break;case lE.arcOuterStart:h=s,c=n;break;case lE.arcInnerEnd:h=i,c=r;break;case lE.arcOuterEnd:h=s,c=r;break;case lE.arcInnerMiddle:h=i,c=(n+r)/2;break;case lE.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({},VE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;uE(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=pm.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));h.states=z({},TM,null==l?void 0:l.area),h.name="polar-mark-area-area",this._area=h,t.add(h);const c=new QM(Object.assign(Object.assign({},o),{state:{panel:z({},TM,null==l?void 0:l.labelBackground),text:z({},TM,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({},TM,null==o?void 0:o.area)),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},a),{state:{panel:z({},TM,null==o?void 0:o.labelBackground),text:z({},TM,null==o?void 0:o.label)}})),this.setLabelPos())}isValidPoints(){return!0}}function qE(){ZE._animate=EE}$E.defaultAttributes=HE,cE(),qT(),ZT(),_M(),nM(),aM();class ZE extends pE{markerAnimate(t){ZE._animate&&this._animationConfig&&ZE._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ZE.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=RE,this.defaultExitAnimation=LE,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return LM(Math.abs(s),Math.PI/2,IE)||LM(Math.abs(s),3*Math.PI/2,IE)?OM(t,s,n):RM(s)?GE.postiveXAxis[n]:GE.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=hE.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({},TM,null==m?void 0:m.textBackground),text:z({},TM,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({},TM,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({},TM,null==m?void 0:m.image));const y=RM(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=pm.symbol(Object.assign(Object.assign({},i),r)),h.states=z({},TM,null==s?void 0:s.symbol)):"text"===n?h=new QM(Object.assign(Object.assign({},i),{state:{panel:z({},TM,null==s?void 0:s.textBackground),text:z({},TM,null==s?void 0:s.text)}})):"richText"===n?(h=pm.richtext(Object.assign(Object.assign({},i),a)),h.states=z({},TM,null==s?void 0:s.richText)):"image"===n?(h=pm.image(Object.assign(Object.assign({},i),o)),h.states=z({},TM,null==s?void 0:s.image)):"custom"===n&&l&&(h=l(),h.states=z({},TM,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=LM(c,0,IE)||LM(d,0,IE),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(aP.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(aP.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===aP.focus||"focus"===o){const s=a.hasState(nP.focus);a.toggleState(nP.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[nP.unSelected,nP.unSelectedHover,nP.focus],t),this._setLegendItemState(e,nP.selected,t)})):(this._setLegendItemState(a,nP.selected,t),this._removeLegendItemState(a,[nP.unSelected,nP.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[nP.selected,nP.selectedHover,nP.focus],t),this._setLegendItemState(e,nP.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(nP.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(nP.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(rP.legendItemClick,a,t);i?(this._removeLegendItemState(a,[nP.selected,nP.selectedHover],t),this._setLegendItemState(a,nP.unSelected,t)):(this._setLegendItemState(a,nP.selected,t),this._removeLegendItemState(a,[nP.unSelected,nP.unSelectedHover],t))}else this._setLegendItemState(a,nP.selected,t),this._removeLegendItemState(a,[nP.unSelected,nP.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[nP.selected,nP.selectedHover],t),this._setLegendItemState(e,nP.unSelected,t))}))}this._dispatchLegendEvent(rP.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,nP.selected),this._removeLegendItemState(e,[nP.unSelected,nP.unSelectedHover])):(this._removeLegendItemState(e,[nP.selected,nP.selectedHover]),this._setLegendItemState(e,nP.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=eP,spaceRow:h=iP}=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;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):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=pm.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,aP.item,t,w)):(w=pm.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,aP.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?nP.selected:nP.unSelected);const C=pm.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=pm.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,aP.itemShape,t,w,S.state),s.addState(e?nP.selected:nP.unSelected),C.add(s)}let O=0;if(d){const e=R(g,"size",10);E=pm.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},g),{visible:!0,pickMode:"imprecise",boundsPadding:T})),this._appendDataToShape(E,aP.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=XM(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,aP.itemLabel,t,w,A.state),D.addState(e?nP.selected:nP.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=XM(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,aP.itemValue,t,w,k.state),r.addState(e?nP.selected:nP.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(),V=p(this.attribute.item.width)?this.attribute.item.width:z+T[1]+T[3],N=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=V,w.attribute.height=N,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 tP(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 tP(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 EM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:12},t),{width:e})):new EM(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=pm.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=eP,spaceRow:a=iP}=s,o=this._itemsContainer,{space:l=sP,defaultCurrent:h=1}=n,c=cP(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 _=pm.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(nP.selected)?this._setLegendItemState(t,nP.selectedHover,e):this._setLegendItemState(t,nP.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===aP.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(rP.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(nP.unSelectedHover)||t.hasState(nP.selectedHover))&&(i=!0),t.removeState(nP.unSelectedHover),t.removeState(nP.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(nP.unSelectedHover)&&!t.hasState(nP.selectedHover)||(i=!0),t.removeState(nP.unSelectedHover),t.removeState(nP.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===aP.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(rP.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(rP.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!==aP.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(rP.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!==aP.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(rP.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(nP.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({},dP,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(nP.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 pP;function gP(t){return y(t)?t:[t,t]}function mP(t){return t?"ew-resize":"ns-resize"}uP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:eP,spaceRow:iP,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:sP,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"}(pP||(pP={})),lP();class fP extends Sb{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({},fP.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"===P_.env?(P_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),P_.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"===P_.env?(P_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),P_.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"===P_.env?(P_.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),P_.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"===P_.env?(P_.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),P_.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:gP(d)[0],endValue:gP(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const m=pm.group({x:0,y:0});m.name=pP.innerView,this.add(m),this._innerView=m;let f,v=0;if(r&&r.visible){f=pm.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=pP.startText,m.add(f);const e=p(r.space)?r.space:0;v+=(g?f.AABBBounds.width():f.AABBBounds.height())+e}const _=pm.group({x:g?v:0,y:g?0:v});m.add(_);const y=pm.group({x:0,y:0});let b;if(y.name=pP.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=pm.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=pP.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=pm.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=pP.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]=gP(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":mP(p)},r));if(v.name=pP.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=f,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=pP.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":mP(p)},r));if(i.name=pP.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(m,"end");e.name=pP.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=pm.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=pP.trackContainer;const f=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===f?"pointer":mP(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=pm.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=pP.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return pm.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":mP(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),pm.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=pm.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=pm.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===pP.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===pP.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===pP.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===pP.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}}}fP.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}}},hP(),lP();class vP extends oP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},vP.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 _P(){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`}vP.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"}}},hP(),lP(),lM();class yP extends oP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},yP.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=pm.group({x:0,y:0});this._innerView.add(x);const S=new fP({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:_P(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=pm.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))}}yP.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)"}},iM(),bM(),gM();let bP=class t extends Sb{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,V,N,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},wM),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},wM),$),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!==(V=K.width)&&void 0!==V?V: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!==(N=$.width)&&void 0!==N?N: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"))}}}};bP.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 xP={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"}}};iM(),bM(),gM();let SP=class extends Sb{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==e)return void(o&&o.hideAll());if(p(i))if(!1!==i.visible){const t=z({},R(xP,"title.style"),i.style);UM(t)?this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},KM(t)),{visible:i.visible,x:0,y:0}),"richtext"):this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},t),{lineHeight:p(t.lineHeight)?t.lineHeight:t.fontSize,visible:i.visible,x:0,y:0}),"text"),i.autoFit&&k(a)&&this._setLocalAutoFit(a,this._title,i),i.autoLimit&&k(r)&&this._title.setAttribute("maxLineWidth",a)}else{const t=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}if(p(s)){const t=Y(s),e=[];t.forEach(((t,s)=>{if(!1!==t.visible){const n=z({},R(xP,"content.style"),t.style);let l;l=UM(n)?o.createOrUpdateChild("indicator-content-"+s,Object.assign(Object.assign({},KM(n)),{visible:i.visible,x:0,y:0}),"richtext"):o.createOrUpdateChild("indicator-content-"+s,Object.assign(Object.assign({},n),{lineHeight:p(n.lineHeight)?n.lineHeight:n.fontSize,visible:t.visible,x:0,y:0}),"text"),t.autoFit&&k(a)&&this._setLocalAutoFit(a,l,t),t.autoLimit&&k(r)&&l.setAttribute("maxLineWidth",a),e.push(l)}else{const t=o.find((t=>t.name==="indicator-content-"+s),!1);t&&o.removeChild(t)}})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.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=WM(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 AP extends yg{constructor(t){super(t)}}var kP,MP;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(kP||(kP={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(MP||(MP={}));class TP extends Sb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},TP.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"},TP.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"},TP.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},TP.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},TP.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 AP(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new AP(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new AP(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(kP.OnPlay)},this.pause=()=>{this._dispatchEvent(kP.OnPause)},this.forward=()=>{this._dispatchEvent(kP.OnForward)},this.backward=()=>{this._dispatchEvent(kP.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()}}TP.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},TP.defaultAttributes={[MP.Start]:{},[MP.Pause]:{},[MP.Backward]:{},[MP.Forward]:{}};const wP={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},CP=[200,10];var EP,PP;!function(t){t.Default="default",t.Reverse="reverse"}(EP||(EP={})),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"}(PP||(PP={}));const BP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===EP.Default&&s===i})({direction:e,maxIndex:i,dataIndex:n})||(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===EP.Reverse&&s===i})({direction:e,minIndex:s,dataIndex:n})},RP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===EP.Default&&s===i})({direction:e,minIndex:s,dataIndex:n})||(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===EP.Reverse&&s===i})({direction:e,maxIndex:i,dataIndex:n})},LP=t=>"top"===t||"bottom"===t;class OP extends Sb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},OP.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(LP(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:CP[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:CP[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 fP(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 LP(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 TP(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=LP(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:CP[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?(LP(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:LP(this._orient)?t+s:(this._size.width-r)/2,y:LP(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:LP(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:LP(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:LP(this._orient)?t+s:(this._size.width-r)/2,y:LP(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 IP(){lP(),iM(),_M()}OP.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({},wP),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},wP),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},wP),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},wP),{key:"backward",position:"start"})}},IP();class DP extends OP{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:EP.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(kP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(kP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(kP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(kP.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(PP.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(BP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||RP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===EP.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(PP.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=P_.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(PP.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(PP.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=P_.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(),P_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(PP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,P_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(PP.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(PP.change),this.dispatchCustomEvent(PP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var FP,jP=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())}))};IP();class zP extends OP{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(kP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(kP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(kP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(kP.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(PP.change))},this.play=()=>jP(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(PP.play),this._rafId=P_.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=P_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,P_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(PP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,P_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(PP.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(PP.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(PP.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"}(FP||(FP={}));const HP={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}},VP=5;const NP={debounce:xt,throttle:St};iM(),cM();let GP=class t extends Sb{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:NP[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(FP.brushClear,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._container.incrementalClearChild(),this._brushMaskAABBBoundsDict={}):(this._activeDrawState&&this._dispatchEvent(FP.drawEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._activeMoveState&&this._dispatchEvent(FP.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=HP.trigger,updateTrigger:e=HP.updateTrigger,endTrigger:i=HP.endTrigger,resetTrigger:s=HP.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(FP.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(FP.moveStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_drawing(t){var e,i;const s=this.eventPosToStagePos(t),{sizeThreshold:n=VP,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(FP.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(FP.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=pm.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)})},UP=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}},YP={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:kM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:kM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:kM,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},KP=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];iM(),uM(),_M(),bM(),gM();let XP=class t extends Sb{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:BM(u)&&BM(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:BM(u)&&BM(u.value)},UP(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:BM(u)&&BM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:BM(u)&&BM(u.value)},UP(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},wM),u.value),visible:BM(u)&&BM(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=BM(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 _=BM(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(!BM(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)+(BM(n.key)?r+n.key.spacing:0)+(BM(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&&($M(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:BM(n.key)||"right"===c||(t="left"),m.setAttribute("textAlign",t),$M(c,m,t,u,a),m.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(BM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Fc(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(BM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},UP(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},UP(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},wM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(BM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},UP(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},UP(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=>KP.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)&&BM(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=BM(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=GM(u),y=GM(p);let b=0;if(BM(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(BM(p)){const{width:t,height:e}=y.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}f&&mg[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 WP({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return WP({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};XP.defaultAttributes=YP;const $P=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 ZP(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function JP(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function QP(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 tB(t,e){const i=QP(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 eB(t,e){const i=iB(t),s=iB(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 iB(t,e={x:0,y:0}){return qt.distancePP(t,e)}function sB(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 nB(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const rB=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var oB,lB;!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"}(oB||(oB={})),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.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(lB||(lB={}));const hB="__VCHART",cB=500,dB=500,uB=`${hB}_LABEL_LIMIT`,pB=`${hB}_LABEL_ALIGN`,gB=`${hB}_LABEL_TEXT`,mB=`${hB}_LABEL_VISIBLE`,fB=`${hB}_LABEL_X`,vB=`${hB}_LABEL_Y`,_B=`${hB}_ARC_TRANSFORM_VALUE`,yB=`${hB}_ARC_RATIO`,bB=`${hB}_ARC_START_ANGLE`,xB=`${hB}_ARC_END_ANGLE`,SB=`${hB}_ARC_K`,AB=`${hB}_ARC_MIDDLE_ANGLE`,kB=`${hB}_ARC_QUADRANT`,MB=`${hB}_ARC_RADIAN`,TB=-Math.PI/2,wB=3*Math.PI/2,CB=-90,EB=.6;var PB,BB,RB,LB,OB,IB,DB,FB,jB,zB,HB,VB,NB,GB,WB;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(PB||(PB={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(BB||(BB={})),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"}(RB||(RB={})),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"}(LB||(LB={})),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"}(OB||(OB={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(IB||(IB={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(DB||(DB={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(FB||(FB={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(jB||(jB={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(zB||(zB={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(HB||(HB={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(VB||(VB={})),t.VGRAMMAR_HOOK_EVENT=void 0,(NB=t.VGRAMMAR_HOOK_EVENT||(t.VGRAMMAR_HOOK_EVENT={})).BEFORE_EVALUATE_DATA="beforeEvaluateData",NB.AFTER_EVALUATE_DATA="afterEvaluateData",NB.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",NB.AFTER_EVALUATE_SCALE="afterEvaluateScale",NB.BEFORE_PARSE_VIEW="beforeParseView",NB.AFTER_PARSE_VIEW="afterParseView",NB.BEFORE_TRANSFORM="beforeTransform",NB.AFTER_TRANSFORM="afterTransform",NB.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",NB.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",NB.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",NB.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",NB.BEFORE_STAGE_RESIZE="beforeStageResize",NB.AFTER_STAGE_RESIZE="afterStageResize",NB.BEFORE_VRENDER_DRAW="beforeVRenderDraw",NB.AFTER_VRENDER_DRAW="afterVRenderDraw",NB.BEFORE_MARK_JOIN="beforeMarkJoin",NB.AFTER_MARK_JOIN="afterMarkJoin",NB.BEFORE_MARK_UPDATE="beforeMarkUpdate",NB.AFTER_MARK_UPDATE="afterMarkUpdate",NB.BEFORE_MARK_STATE="beforeMarkState",NB.AFTER_MARK_STATE="afterMarkState",NB.BEFORE_MARK_ENCODE="beforeMarkEncode",NB.AFTER_MARK_ENCODE="afterMarkEncode",NB.BEFORE_DO_LAYOUT="beforeDoLayout",NB.AFTER_DO_LAYOUT="afterDoLayout",NB.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",NB.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",NB.BEFORE_DO_RENDER="beforeDoRender",NB.AFTER_DO_RENDER="afterDoRender",NB.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",NB.AFTER_MARK_RENDER_END="afterMarkRenderEnd",NB.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",NB.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",NB.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",NB.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",NB.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",NB.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",NB.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",NB.BEFORE_ELEMENT_STATE="beforeElementState",NB.AFTER_ELEMENT_STATE="afterElementState",NB.BEFORE_ELEMENT_ENCODE="beforeElementEncode",NB.AFTER_ELEMENT_ENCODE="afterElementEncode",NB.ANIMATION_START="animationStart",NB.ANIMATION_END="animationEnd",NB.ELEMENT_ANIMATION_START="elementAnimationStart",NB.ELEMENT_ANIMATION_END="elementAnimationEnd",NB.ALL_ANIMATION_START="allAnimationStart",NB.ALL_ANIMATION_END="allAnimationEnd",function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(GB||(GB={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(WB||(WB={}));const UB="__vgrammar_scene_item__",YB=[RB.line,RB.area],KB=[RB.arc3d,RB.rect3d,RB.pyramid3d],XB="key",$B=[{}],qB=["key"],ZB=!0,JB=!0,QB=!1,tR=!0,eR="VGRAMMAR_IMMEDIATE_ANIMATION",iR=0,sR=1e3,nR=0,rR=0,aR=!1,oR=!1,lR="quintInOut",hR={stopWhenStateChange:!1,immediatelyApply:!0};function cR(t,e){return Y(t).reduce(((t,i)=>{const s=_(i)?e.getGrammarById(i):i;return s&&t.push(s),t}),[])}function dR(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 cR(t.dependency,e);var i;return[]}function uR(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function pR(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 gR(t,e){return mR(t)?t.output():e[t]}const mR=t=>t&&!u(t.grammarType),fR=t=>d(t)?t:e=>e[t];function vR(t){return!!(null==t?void 0:t.scale)}function _R(t){return!!(null==t?void 0:t.field)}function yR(t,e){if(!t)return[];let i=[];return t.scale&&(i=mR(t.scale)?[t.scale]:Y(e.getScaleById(t.scale))),i.concat(dR(t,e))}function bR(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 xR(t,e,i,s,n){i&&(uR(i)?e.forEach((e=>{const n=pR(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 RB.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case RB.group:case RB.rect:case RB.image:return["width","height","y1"].includes(e);case RB.path:case RB.shape:return["path","customPath"].includes(e);case RB.line:return"defined"===e;case RB.area:return["x1","y1","defined"].includes(e);case RB.rule:return["x1","y1"].includes(e);case RB.symbol:return"size"===e;case RB.polygon:return"points"===e;case RB.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(vR(l)){const t=gR(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?cb(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(_R(l)){const t=cb(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=pR(l,s,e.datum,t)}))})))}function SR(t,e,i,s){if(!t)return null;if(uR(t))return pR(t,s,e,i);const n={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(vR(h)){const t=gR(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?cb(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(_R(h)){const t=cb(h.field);n[r]=t(e)}else n[r]=pR(h,s,e,i)})),n}class AR{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 kR=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]}};kR._plotMarks={},kR._marks={},kR._components={},kR._graphicComponents={},kR._transforms={},kR._grammars={},kR._glyphs={},kR._animations={},kR._interactions={},kR._graphics={},kR.registerGlyph=(t,e,i,s,n)=>(kR._glyphs[t]=new AR(e,i,s,n),kR._glyphs[t]),kR.registerAnimationType=(t,e)=>{kR._animations[t]=e},kR.getAnimationType=t=>kR._animations[t],kR.registerInteraction=(t,e)=>{kR._interactions[t]=e},kR.registerGraphic=(t,e)=>{kR._graphics[t]=e},kR.getGraphicType=t=>kR._graphics[t],kR.createGraphic=(t,e)=>{const i=kR._graphics[t];return i?i(e):null};const MR=t=>!!RB[t];function TR(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var s;const n=kR.getGraphicType(e)?kR.createGraphic(e,i):kR.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 wR=t=>{t&&(t[UB]=null,t.release(),t.parent&&t.parent.removeChild(t))},CR=["fillOpacity"],ER=(t,e,i)=>{var s;return"fillOpacity"===e?(t.fillOpacity=null!==(s=i.fillOpacity)&&void 0!==s?s:1,["fillOpacity"]):[]};const PR={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"}],[RB.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"}],[RB.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"}],[RB.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 BR=(t,e,i,s)=>{const n={},r=e?Object.keys(e):[],a=_(t)?PR[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||(CR.includes(r)?ER(n,r,e):n[r]=e[r])}))}else r.forEach((t=>{CR.includes(t)?ER(n,t,e):n[t]=e[t]}));return n},RR=(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),LR=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],OR=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(LR);function IR(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)?OR:LR,r=[];let a=null;return t.forEach(((t,e)=>{a&&n.every((e=>RR(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=DR(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function DR(t){const e={};return t?(Object.keys(t).forEach((i=>{"x"!==i&&"y"!==i&&"x1"!==i&&"y1"!==i&&"defined"!==i&&"size"!==i&&"width"!==i&&"height"!==i&&"context"!==i&&(e[i]=t[i])})),e):e}let FR=class{constructor(t){this.data=null,this.states=[],this.diffState=BB.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:{}})));xR(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?BR(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[UB]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?BR(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t)))}updateGraphicItem(){if(!this.graphicItem)return;this.diffState===BB.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&&(wR(this.graphicItem),this.graphicItem[UB]=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=fR(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(pR(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===BB.unChange&&(this.diffState=BB.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&(this.mark.isCollectionMark()&&delete t.defined,Object.assign(e,t)),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==BB.enter&&this.diffState!==BB.update||!this.states.length||this.useStates(this.states),this.mark.markType===RB.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 cl))}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[PB.update],a=e[PB.enter],o=e[PB.exit],l=this.mark.isLargeMode()||n&&!this.mark.getSpec().enableSegments;this.diffState===BB.enter?(a&&xR(this,t,a,s,l),r&&xR(this,t,r,s,l)):this.diffState===BB.update?((n&&a||i)&&xR(this,t,a,s,l),r&&xR(this,t,r,s,l)):this.diffState===BB.exit&&o&&(i&&xR(this,t,a,s,l),xR(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)gb(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[RB.line,RB.area,RB.largeRects,RB.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(s=l.nextAttrs)||void 0===s?void 0:s.points)&&(!0===i||bR(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[PB.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=DR(h),e===RB.line||e===RB.area){const i=function(t,e,i,s){return t&&t.length&&(1!==t.length||e)?t.some((t=>bR(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===RB.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=IR(e.items,e.points,i);if(s)return void s.forEach((e=>{t.push(e)}))}const n=DR(e.items[0]);n.points=e.points,t.push(n)})),t}return s?IR(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=SR(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=IR(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t)}else h.points=i,h.segments=null}else e===RB.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===RB.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}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&&(wR(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 jR{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 zR=(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 HR extends jR{constructor(t,e){super(t,e),this.type=HR.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({},HR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=zR(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()}}HR.type="element-select",HR.defaultOptions={state:WB.selected,trigger:"click"};class VR extends jR{constructor(t,e){super(t,e),this.type=VR.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},VR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=zR(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 NR(t){if(t)return t.type===Pw.Band?t.bandwidth():t.type===Pw.Point?t.step():void 0}VR.type="element-highlight",VR.defaultOptions={highlightState:WB.highlight,blurState:WB.blur,trigger:"pointerover",triggerOff:"pointerout"};class GR{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 WR=()=>{U(HR,GR),kR.registerInteraction(HR.type,HR)},UR=()=>{U(VR,GR),kR.registerInteraction(VR.type,VR)},YR=(t,e)=>mR(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,KR=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,s)=>{const n=t[s];return i[s]=YR(n,e),i}),{}):t.map((t=>YR(t,e))):t;let XR=-1;class $R extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++XR}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(dR(this.spec[e],this.view)),this.spec[e]=t,this.attach(dR(t,this.view)),this.commit(),this}}const qR=(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=dR(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}},ZR=(t,e)=>{const i=kR.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(cR(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(y(e)){const s=e.map((e=>qR(t,e,i)));return{references:s.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:s.map((t=>t.value))}}return qR(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}},JR=(t,e)=>{if(null==t?void 0:t.length){const i=[];let s=[];return t.forEach((t=>{var n;const r=ZR(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},QR={csv:Yr,dsv:Ur,tsv:Kr,json:function(t){if(!_(t))return Y(t);try{return Y(JSON.parse(t))}catch(t){return[]}}};class tL extends $R{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||!QR[e.type])return Y(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return QR[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?dR(t.format,this.view)[0]:null;if(s&&e.push(s),t.values){const s=dR(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=dR(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=mR(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=JR(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=JR(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 eL="window",iL="view",sL={trap:!1},nL="width",rL="height",aL="viewWidth",oL="viewHeight",lL="padding",hL="viewBox",cL="autoFit";function dL(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 uL(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,dL(t,e,n,s)}class pL{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 dL(this.nodes,e,0,this.compare),uL(this.nodes,e,null,this.compare)}return this.nodes.push(t),dL(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)),dL(this.nodes,e,0,this.compare),uL(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,uL(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class gL{constructor(t){this.list=[],this.ids={},this.idFunc=t||db}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 mL{constructor(){this.grammars=[],this.logger=at.getInstance(),this._curRank=0,this._committed=new gL((t=>t.uid)),this._heap=new pL(((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 gL((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 fL=(t,e,i,s,n)=>{const r=t=>{if(n||!t||s&&!s(t)||i.call(null,t),t.markType===RB.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}n&&(!t||s&&!s(t)||i.call(null,t))};r(t)};class vL{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 $d(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Il.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 J_(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 $b(o)),null===(r=this._eventConfig)||void 0===r?void 0:r.gesture){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new Jb(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 _L(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 yL(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 bL(t,e,i,s,n){if(n===eL){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{yL(t,_L(t),!1)}))}));const e=_L(t);yL(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e}class xL extends $R{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?pR(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}},ML=(t,e)=>e&&e.debounce?xt(t,e.debounce):e&&e.throttle?St(t,e.throttle):t;class TL extends FR{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 xR(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[UB]=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?BR(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);this.graphicItem||this.initGraphicItem(),this.diffState===BB.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==BB.enter&&this.diffState!==BB.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.diffState===BB.enter&&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=BR(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=PR[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===RB.shape&&(o.datum=d[0].datum)})),s}}_generateGlyphItems(t,e,i){const s=e.map((t=>Object.assign({},t,{nextAttrs:i})));return YB.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)gb(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[UB]=null})),this.glyphGraphicItems=null),super.release()}}const wL=t=>t.markType===RB.glyph?new TL(t):new FR(t);function CL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(XB,i?t.slice().sort(i):t.slice()),{keys:qB,data:s};const n=fR(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 EL{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?CL(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 PL=(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=bR(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=bR(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 BL=(t,e,i,s,n)=>d(i)?i(t.getDatum(),t,n):i;class RL extends mc{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 LL extends mc{getEndProps(){return this.to}onBind(){var t;const e=null!==(t=this.target.constructor.NOWORK_ANIMATE_ATTR)&&void 0!==t?t:Fd,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)}}vc.mode|=ko.SET_ATTR_IMMEDIATELY;let OL=0;const IL=t=>!u(t)&&(t.prototype instanceof mc||"onBind"in t.prototype&&"onStart"in t.prototype&&"onEnd"in t.prototype&&"onUpdate"in t.prototype);class DL{constructor(t,e,i){this.id=OL++,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||!kR.getAnimationType(e.type))return null;const r=kR.getAnimationType(e.type)(t,n,i);return PL(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?BL(t,0,n[i].from,0,s):void 0,e.to[i]=l?BL(t,0,n[i].to,0,s):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),PL(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=IL(o);return u(o)||IL(o)?h?new o(r.from,r.to,a,t.easing,l):r.to?new LL(r.from,r.to,a,t.easing):void 0:new RL(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 Uc(a,e))}r>0&&t.wait(r)}}function FL(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(jL(i,t[i]))})),e}function jL(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:iR,totalTime:h.totalTime,oneByOne:null!==(i=h.oneByOne)&&void 0!==i?i:oR,loop:null!==(s=h.loop)&&void 0!==s?s:aR,controlOptions:z({},hR,null!==(n=h.controlOptions)&&void 0!==n?n:{}),timeSlices:[{duration:null!==(r=h.duration)&&void 0!==r?r:sR,delay:null!==(a=h.delay)&&void 0!==a?a:nR,delayAfter:null!==(o=h.delayAfter)&&void 0!==o?o:rR,effects:[{type:h.type,channel:h.channel,custom:h.custom,easing:null!==(l=h.easing)&&void 0!==l?l:lR,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:iR,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:oR,loop:null!==(d=t.loop)&&void 0!==d?d:aR,controlOptions:z({},hR,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:nR,delayAfter:null!==(i=t.delayAfter)&&void 0!==i?i:rR,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:lR,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 zL(t,e,i){return d(t)?t.call(null,e.getDatum(),e,i):t}class HL{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 VL{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=FL(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=FL(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!==BB.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 HL(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=jL(eR,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 HL(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===BB.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 DL(s,i,e);if(l.animate(n,r),!l.isAnimating)return;s.diffState===BB.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=pR(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,s,n){const r=[],a=zL(t.startTime,e,n),o=zL(t.totalTime,e,n),l=zL(t.oneByOne,e,n),h=zL(t.loop,e,n);let c=0;t.timeSlices.forEach((t=>{var i;const a=zL(t.delay,e,n),l=zL(t.delayAfter,e,n),h=null!==(i=zL(t.duration,e,n))&&void 0!==i?i:o/s,d=Y(t.effects).map((t=>Object.assign({},t,{customParameters:zL(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===BB.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===BB.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===eR,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===BB.exit&&0===o[BB.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 NL extends $R{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new VL(this,{}),this.differ=new EL([]),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===BB.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(e,i){var s;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===VB.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:$B,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===RB.group)return;const e=CL(null!=t?t:$B,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(BB.update,t,e,i)}encodeState(t,e,i,s){if(t===BB.enter&&(this._isReentered=!0),this.spec.encode[t]){const n=this.spec.encode[t];if(uR(n))this.detach(yR(n,this.view));else{const r=_(e);r&&s||!r&&i?(Object.keys(n).forEach((t=>{this.detach(yR(n[t],this.view))})),this.spec.encode[t]={}):r?this.detach(yR(n[e],this.view)):Object.keys(e).forEach((t=>{this.detach(yR(n[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),_(e)?(this.spec.encode[t][e]=i,this.attach(yR(i,this.view))):uR(e)?(this.spec.encode[t]=e,this.attach(yR(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(yR(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=JR(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=JR(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 YB.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!==BB.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===GB.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&&!uR(n)&&Object.keys(n).forEach((t=>{vR(n[t])&&(e[t]=gR(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];uR(s)||Object.keys(s).forEach((t=>{_R(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[UB];if((null==s?void 0:s.mark)===this){const i=bL(this.view,t,s,0,iL);this.emitGrammarEvent(e,i,s)}},this.initEvent()),this.animate||(this.animate=new VL(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=gR(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!==RB.group){if(!this.graphicItem){const t=TR(this,RB.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||KB.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||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==RB.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=fR(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:()=>XB),a=fR(null!==(n=this.spec.groupBy)&&void 0!==n?n:()=>XB),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===BB.enter))),c=[];this.differ.setCallback(((t,e,i)=>{const s=t;let n;if(u(e))n=this.elementMap.get(s),n&&(n.diffState=BB.exit);else if(u(i)){n=this.elementMap.has(s)?this.elementMap.get(s):wL(this),n.diffState===BB.exit&&(n.diffState=BB.enter,this.animate.getElementAnimators(n,BB.exit).forEach((t=>t.stop("start")))),n.diffState=BB.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=BB.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:$B;l||this.differ.setCurrentData(CL(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]=SR(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[PB.group],s);e.forEach((t=>{this.markType===RB.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._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:TR(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!==RB.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=fR(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:()=>XB),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=wL(this);e.diffState=BB.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=wL(this);i.diffState=BB.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!==RB.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=TR(this,RB.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!==BB.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:PR[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=BB.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&&wR(this.graphicItem),this.detachAll(),super.release()}}let GL=class extends NL{constructor(t,e){super(t,RB.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===RB.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 PR.rect}evaluateJoin(t){if(!this.elements.length){const t=wL(this);t.updateData(XB,$B,(()=>""),this.view),this.elements=[t],this.elementMap.set(XB,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 xR(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[PB.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:TR(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 WL(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 UL(t,e){return Math.min(t<0?t+e:t-1,e)}function YL(t,e,i){let s=UL(t,i),n=UL(e,i);if(k(t)||k(e)?k(t)?k(e)||(s=UL(Math.max(0,n-1),i)):n=UL(s+1,i):(s=1,n=2),s>n){const t=n;n=s,s=t}return{start:s,end:n}}const KL=(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=>WL(t,i))),u=l.map((t=>WL(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}=YL(e,i,r),{start:h,end:c}=YL(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()}))},XL={[LB.axis]:0,[LB.legend]:1,[LB.slider]:2,[LB.player]:3,[LB.datazoom]:4},$L=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=XL[t.componentType])&&void 0!==s?s:1/0},qL=(t,e,i,s)=>{const n=i.clone(),r=t.getSpec().layout,a=mb(r.maxChildWidth,n.width()),o=mb(r.maxChildHeight,n.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=kL(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&&d$L(t)-$L(e)));for(let t=0,e=f.length;t{null==t||t.forEach((t=>{var s;if(t.markType!==RB.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=qL(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(aL,o),i.updateSignal(oL,l),i.updateSignal(lL,h)}else qL(t,n,a,e);else"grid"===r.display&&KL(t,n,a);ZL(n,e,i)}}))};class JL extends NL{constructor(t,e,i){super(t,RB.glyph,i),this.glyphType=e,this.glyphMeta=kR.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(!kR.getGraphicType(RB.glyph))return;const s=kR.createGraphic(RB.glyph,i),n=e.getMarks(),r=Object.keys(n).map((t=>{if(kR.getGraphicType(n[t])){const e=kR.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 QL=Symbol.for("key");class tO{diffGrammar(t,e){return function(t,e,i){const s={enter:[],exit:[],update:[]},n=new EL(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(CL(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!==RB.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==RB.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=CL(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=CL(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=fR(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 EL(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(CL(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:QL})),r=CL(e,(t=>{var e;return null!==(e=s(t))&&void 0!==e?e:QL}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==QL){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=pR(i.animation.delay,n,o,l),d=pR(i.animation.duration,n,o,l),u=pR(i.animation.oneByOne,n,o,l),p=pR(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)?Td:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:wd)(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);Sd(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)?Td:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:wd)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>_d(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>bd(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 xd({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Sc,null!==(l=i.easing)&&void 0!==l?l:Ac))}))}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 Ad({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Sc,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Ac))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Sd(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 eO{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 iO extends eO{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===RB.group&&s.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===RB.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=>{const s=t.mark;s.markType===RB.group&&s.includesChild(e,!1)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===RB.group&&e.includesChild(s,!1)&&(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 sO{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 nO extends NL{addGraphicItem(t,e){const i=t&&t.limitAttrs,s=TR(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?RB.richtext:RB.text,t);return super.addGraphicItem(t,e,s)}release(){super.release()}}nO.markType=RB.text;const rO={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)"}}},aO={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},oO=Object.assign({},rO);oO.axis=Object.assign({},oO.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),oO.circleAxis=Object.assign({},oO.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),oO.grid=Object.assign({},oO.grid,{style:{stroke:"#404349"}}),oO.circleGrid=Object.assign({},oO.circleGrid,{style:{stroke:"#404349"}}),oO.rectLabel=Object.assign({},oO.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),oO.lineLabel=Object.assign({},oO.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),oO.symbolLabel=Object.assign({},oO.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),oO.title=Object.assign({},oO.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const lO={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:aO,components:oO},hO={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:aO,components:rO};let cO=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")}};cO._themes=new Map,cO.registerTheme("default",hO),cO.registerTheme("dark",lO);class dO extends NL{constructor(t,e,i,s){super(t,RB.component,i),this._componentDatum={[XB]: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:kR.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,XB)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[XB]+=1}evaluateJoin(t){return this.spec.key=XB,t?(t[XB]=this._componentDatum[XB],this._componentDatum=t):this._componentDatum={[XB]:this._componentDatum[XB]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}class uO 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[UB],n=bL(0,t,s,0,iL);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(mR(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)):MR(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 xL(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 tL(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=kR.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=kR.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 RB.group:n=new GL(this,s);break;case RB.glyph:n=new JL(this,null==i?void 0:i.glyphType,s);break;case RB.component:n=kR.hasComponent(null==i?void 0:i.componentType)?kR.createComponent(null==i?void 0:i.componentType,this,s,null==i?void 0:i.mode):new dO(this,null==i?void 0:i.componentType,s,null==i?void 0:i.mode);break;case RB.text:n=new nO(this,t,s);break;default:n=kR.hasMark(t)?kR.createMark(t,this,s):new NL(this,t,s)}return this.grammars.record(n),this._dataflow.add(n),n}group(t){return this.mark(RB.group,t)}glyph(t,e){return this.mark(RB.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(RB.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(RB.component,t,{componentType:LB.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(RB.component,t,{componentType:LB.grid,mode:e})}legend(t){return this.mark(RB.component,t,{componentType:LB.legend})}slider(t){return this.mark(RB.component,t,{componentType:LB.slider})}label(t){return this.mark(RB.component,t,{componentType:LB.label})}datazoom(t){return this.mark(RB.component,t,{componentType:LB.datazoom})}player(t){return this.mark(RB.component,t,{componentType:LB.player})}title(t){return this.mark(RB.component,t,{componentType:LB.title})}scrollbar(t){return this.mark(RB.component,t,{componentType:LB.scrollbar})}customized(t,e){const i=kR.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&&AL.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&(wR(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_"+ ++SL;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(cO.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(nL,t.width),this.updateSignal(rL,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=kR.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=VB.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var s,n,r,a,o;return[{id:nL,value:null!==(s=t[nL])&&void 0!==s?s:0},{id:rL,value:null!==(n=t[rL])&&void 0!==n?n:0},{id:lL,value:kL(null!==(a=null!==(r=t[lL])&&void 0!==r?r:e[lL])&&void 0!==a?a:null==i?void 0:i.padding)},{id:aL,update:{callback:(t,e)=>{const i=kL(e[lL]);return e[nL]-i.left-i.right},dependency:[nL,lL]}},{id:oL,update:{callback:(t,e)=>{const i=kL(e[lL]);return e[rL]-i.top-i.bottom},dependency:[rL,lL]}},{id:hL,update:{callback:(t,e)=>{const i=kL(e[lL]);return(t||new Jt).setValue(i.left,i.top,i.left+e[aL],i.top+e[oL])},dependency:[aL,oL,lL]}},{id:cL,value:null!==(o=t[cL])&&void 0!==o?o:e[cL]}]})(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===RB.glyph?{glyphType:t.glyphType}:t.type===RB.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=cO.getTheme(t))&&void 0!==e?e:cO.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(nL);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(rL);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(aL);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(oL);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(lL);if(arguments.length){const i=kL(t);return this.updateSignal(e,i),i}return kL(e.output())}autoFit(t){const e=this.getSignalById(cL);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(hL);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=VB.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===RB.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var e;const i=this._options.doLayout||ZL;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=>{fL(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),fL(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=ZB,morph:o=JB,morphAll:l=QB,animation:h={},enableExitAnimation:c=tR}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:lR,delay:null!==(i=h.delay)&&void 0!==i?i:nR,duration:null!==(s=h.duration)&&void 0!==s?s:sR,oneByOne:null!==(n=h.oneByOne)&&void 0!==n?n:oR,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=VB.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=VB.reevaluate,this._dataflow.evaluate()),this._layoutState=VB.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=>!AL.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 fL(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(nL,t)),e!==this.height()&&(s=!0,this.updateSignal(rL,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]:iL;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):MR(t)?(i.markType=t,i.source=e):i.source=t===eL?eL: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=cR(l,this),v=ML(((t,e)=>{const s=c===iL&&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===eL&&(t=bL(0,t,e,0,eL));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===iL){if(function(t,e,i){const s=null==t?void 0:t[e];return!(!1===s||g(s)&&!s[i])}(this._eventConfig,iL,d))return this.addEventListener(d,v,sL),()=>{this.removeEventListener(d,v)}}else if(c===eL)return P_.addEventListener(d,v),this._eventListeners.push({type:d,source:P_,handler:v}),()=>{P_.removeEventListener(d,v);const t=this._eventListeners.findIndex((t=>t.type===d&&t.source===P_&&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=kR.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 vL(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e;this.grammars=new eO((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new iO((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 mL,this.animate=new sO(this),this._morph=new tO,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,[iL,eL]),e}(this._options.eventConfig),this._theme=this._options.disableTheme?null:cO.getDefaultTheme(),this.parseBuiltIn(),(e=this._options).mode&&P_.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=VB.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!==RB.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=P_.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&P_.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(),kR.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 pO=()=>{fM(),lM(),kR.registerGraphic(RB.path,Ng)},gO=()=>{fM(),uM(),kR.registerGraphic(RB.rect,Tg)},mO=()=>{fM(),aM(),kR.registerGraphic(RB.rule,Ag)},fO=()=>{fM(),_M(),kR.registerGraphic(RB.symbol,bg)},vO=()=>{fM(),bM(),gM(),kR.registerGraphic(RB.text,mp)},_O=()=>{fM(),tM(),kR.registerGraphic(RB.glyph,Cg)},yO=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},bO=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},xO=(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(yb(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},SO=(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&&yb(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},AO=yO(xO),kO=bO(xO);const MO=(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(yb(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},TO=(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&&yb(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},wO=yO(MO),CO=bO(MO);const EO=(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`},PO=(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`},BO=(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)?PO:EO,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)}}:{}},RO=(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}},LO=(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})}},OO=(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 IO extends dO{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 DO=(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 FO extends IO{constructor(t,e,i){super(t,LB.axis,e),this.spec.componentType=LB.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=kR.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=SR(n,e,i,s);const h=pR(this.spec.inside,s,e,i),c=pR(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(DO(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=pR(this.spec.tickCount,s,e,i);switch(this._getAxisComponentType()){case IB.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 IB.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?IB.circleAxis:IB.lineAxis,this._axisComponentType}}FO.componentType=LB.axis;let jO=class extends dO{constructor(t,e){super(t,LB.label,e),this.spec.componentType=LB.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=pR(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=pR(s,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case RB.line:case RB.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case RB.rect:case RB.rect3d:case RB.interval:g=p.rectLabel;break;case RB.symbol:case RB.circle:case RB.cell:g=p.symbolLabel;break;case RB.arc:case RB.arc3d:g=p.arcLabel;break;case RB.polygon:case RB.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=SR(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=SR(i,t,e,d);m.push(z({},f,s))}));else{const t=SR(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}};jO.componentType=LB.label;const zO=()=>{kR.registerGraphicComponent(LB.label,(t=>new $T(t))),kR.registerComponent(LB.label,jO)};class HO extends IO{constructor(t,e,i){super(t,LB.grid,e),this.spec.componentType=LB.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=kR.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=SR(s,t,e,i);const d=pR(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 DB.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 DB.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=pR(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(DO(h,n,s,d,this.spec.layout,!0),c))}this._getGridComponentType()===DB.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=pR(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case DB.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 DB.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=DB.circleAxisGrid:this._gridComponentType=DB.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case IB.circleAxis:this._gridComponentType=DB.circleAxisGrid;break;case IB.lineAxis:default:this._gridComponentType=DB.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()?DB.lineAxisGrid:DB.circleAxisGrid:DB.lineAxisGrid}else this._gridComponentType=DB.lineAxisGrid;return this._gridComponentType}}HO.componentType=LB.grid;const VO=(t,e,i)=>e.filter((e=>t.callback(e,i))),NO=(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 GO(t){return t.reduce(((t,e)=>t+e),0)}const WO={min:$,max:X,average:function(t){return 0===t.length?0:GO(t)/t.length},sum:GO};function UO(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 YO(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 KO(t,e,i,s){return YO(t,e,i,"min",s)}function XO(t,e,i,s){return YO(t,e,i,"max",s)}function $O(t,e,i,s){return YO(t,e,i,"average",s)}function qO(t,e,i,s){return YO(t,e,i,"sum",s)}const ZO=(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=UO;if("min"===n?l=KO:"max"===n?l=XO:"average"===n?l=$O:"sum"===n&&(l=qO),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[]},JO="_mo_hide_";const QO=(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(JO)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(JO,!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(JO,!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},tI=()=>{kR.registerTransform("filter",{transform:VO,markPhase:"beforeJoin"},!0)},eI=()=>{kR.registerTransform("map",{transform:NO,markPhase:"beforeJoin"},!0)},iI=()=>{kR.registerTransform("sampling",{transform:ZO,markPhase:"afterEncode"},!0)},sI=()=>{kR.registerTransform("markoverlap",{transform:QO,markPhase:"afterEncode"},!0)},nI=(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}}},rI=(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}}},aI=(t,e,i)=>{var s,n,r,a;const o=null!==(s=t.getFinalGraphicAttributes())&&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}}},oI=(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}}},lI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("y",!1),i=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1),n=t.getGraphicAttribute("y",!1),r=t.getGraphicAttribute("y1",!1),a=t.getGraphicAttribute("height",!1),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}}}}},hI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("y",!1),i=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("x1",!1),n=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicAttribute("height",!1),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 cI=(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.getGraphicAttribute("x",!1),r=t.getGraphicAttribute("x1",!1),a=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);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 dI=(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.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);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 uI=(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.getGraphicAttribute("y",!1),r=t.getGraphicAttribute("y1",!1),a=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("y",!1),n=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);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 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.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("y",!1),n=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);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)},gI=(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.getFinalGraphicAttributes();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.getFinalGraphicAttributes();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)},mI=(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.getFinalGraphicAttributes();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)},fI=(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.getFinalGraphicAttributes(),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.getFinalGraphicAttributes();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)},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=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.getFinalGraphicAttributes();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)},_I=(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((()=>Object.assign(n)))},yI=(t,e,i)=>({from:{points:_I(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),bI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:_I(t,e)}}),xI=(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),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}})),SI=(t,e,i)=>({from:{points:xI(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),AI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:xI(t,e,i)}}),kI=(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),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,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)=>{var s,n;const{offset:r=0,orient:a,direction:o,point:l}=null!=e?e:{};let h=0,c=0;"negative"===a&&(i.group?(h=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),c=null!==(n=i.groupHeight)&&void 0!==n?n:i.group.getBounds().height(),i.groupWidth=h,i.groupHeight=c):(h=i.width,c=i.height)),h+=r,c+=r;const u=d(l)?l.call(null,t.getDatum(),t,i):l,p=u&&k(u.x)?u.x:h,g=u&&k(u.y)?u.y:c,m=t.getFinalGraphicAttributes();switch(o){case"x":return{from:{x:p},to:{x:null==m?void 0:m.x}};case"y":return{from:{y:g},to:{y:null==m?void 0:m.y}};default:return{from:{x:p,y:g},to:{x:null==m?void 0:m.x,y:null==m?void 0:m.y}}}},CI=(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}}}},EI=(t,e,i)=>{var s,n,r,a;const o=t.getFinalGraphicAttributes();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}}}},PI=(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}}}},BI={symbol:["_mo_hide_","visible"]},RI=(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=BI[t.mark.markType])&&r.forEach((t=>{delete s[t],delete n[t]})),Object.keys(n).forEach((t=>{gb(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}},LI=(t,e,i)=>{var s,n;const r=null!==(n=null===(s=t.getFinalGraphicAttributes())||void 0===s?void 0:s.angle)&&void 0!==n?n:0;let a=0;return a=pt(r/(2*Math.PI),0)?Math.round(r/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(r/(2*Math.PI))*Math.PI*2:Math.floor(r/(2*Math.PI))*Math.PI*2,{from:{angle:a},to:{angle:r}}},OI=(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}}},II=()=>{kR.registerAnimationType("clipIn",nI)},DI=()=>{kR.registerAnimationType("clipOut",rI)},FI=()=>{kR.registerAnimationType("fadeIn",aI)},jI=()=>{kR.registerAnimationType("fadeOut",oI)},zI=()=>{kR.registerAnimationType("growCenterIn",lI)},HI=()=>{kR.registerAnimationType("growCenterOut",hI)},VI=()=>{kR.registerAnimationType("growHeightIn",uI)},NI=()=>{kR.registerAnimationType("growHeightOut",pI)},GI=()=>{kR.registerAnimationType("growWidthIn",cI)},WI=()=>{kR.registerAnimationType("growWidthOut",dI)},UI=()=>{kR.registerAnimationType("growPointsIn",yI)},YI=()=>{kR.registerAnimationType("growPointsOut",bI)},KI=()=>{kR.registerAnimationType("growPointsXIn",SI)},XI=()=>{kR.registerAnimationType("growPointsXOut",AI)},$I=()=>{kR.registerAnimationType("growPointsYIn",MI)},qI=()=>{kR.registerAnimationType("growPointsYOut",TI)},ZI=()=>{kR.registerAnimationType("growAngleIn",gI)},JI=()=>{kR.registerAnimationType("growAngleOut",mI)},QI=()=>{kR.registerAnimationType("growRadiusIn",fI)},tD=()=>{kR.registerAnimationType("growRadiusOut",vI)},eD=()=>{kR.registerAnimationType("moveIn",wI)},iD=()=>{kR.registerAnimationType("moveOut",CI)},sD=()=>{kR.registerAnimationType("scaleIn",EI)},nD=()=>{kR.registerAnimationType("scaleOut",PI)},rD=()=>{kR.registerAnimationType("rotateIn",LI)},aD=()=>{kR.registerAnimationType("rotateOut",OI)},oD=()=>{kR.registerAnimationType("update",RI)};class lD extends NL{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=uR(e)?null:Object.keys(e).reduce(((t,s)=>(vR(e[s])&&(t[s]=gR(e[s].scale,i)),t)),{});this._encoders[t]={callback:(t,i,n)=>{const r=SR(e,t,i,n);if(u(r.size)){const t=s.x?NR(s.x):void 0,e=s.y?NR(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(PR.symbol)}release(){super.release(),this._encoders=null}}lD.markType=RB.cell;const hD=["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 cD,dD,uD;t.ChartEvent=void 0,(cD=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",cD.rendered="rendered",cD.renderFinished="renderFinished",cD.animationFinished="animationFinished",cD.regionSeriesDataFilterOver="regionSeriesDataFilterOver",cD.afterInitData="afterInitData",cD.afterInitEvent="afterInitEvent",cD.afterInitMark="afterInitMark",cD.rawDataUpdate="rawDataUpdate",cD.viewDataFilterOver="viewDataFilterOver",cD.viewDataUpdate="viewDataUpdate",cD.viewDataStatisticsUpdate="viewDataStatisticsUpdate",cD.markDeltaYUpdate="markDeltaYUpdate",cD.viewDataLabelUpdate="viewDataLabelUpdate",cD.scaleDomainUpdate="scaleDomainUpdate",cD.scaleUpdate="scaleUpdate",cD.dataZoomChange="dataZoomChange",cD.drill="drill",cD.layoutStart="layoutStart",cD.layoutEnd="layoutEnd",cD.layoutRectUpdate="layoutRectUpdate",cD.playerPlay="playerPlay",cD.playerPause="playerPause",cD.playerEnd="playerEnd",cD.playerChange="playerChange",cD.playerForward="playerForward",cD.playerBackward="playerBackward",cD.scrollBarChange="scrollBarChange",cD.brushStart="brushStart",cD.brushChange="brushChange",cD.brushEnd="brushEnd",cD.brushClear="brushClear",cD.legendSelectedDataChange="legendSelectedDataChange",cD.legendFilter="legendFilter",cD.legendItemClick="legendItemClick",cD.legendItemHover="legendItemHover",cD.legendItemUnHover="legendItemUnHover",cD.tooltipShow="tooltipShow",cD.tooltipHide="tooltipHide",cD.tooltipRelease="tooltipRelease",cD.afterResize="afterResize",cD.afterRender="afterRender",cD.afterLayout="afterLayout",t.Event_Source_Type=void 0,(dD=t.Event_Source_Type||(t.Event_Source_Type={})).chart="chart",dD.window="window",dD.canvas="canvas",t.Event_Bubble_Level=void 0,(uD=t.Event_Bubble_Level||(t.Event_Bubble_Level={})).vchart="vchart",uD.chart="chart",uD.model="model",uD.mark="mark";const pD=`${hB}_waterfall_default_seriesField`,gD=`${hB}_CORRELATION_X`,mD=`${hB}_CORRELATION_Y`,fD=`${hB}_CORRELATION_SIZE`,vD=`${hB}_MEASURE_CANVAS_ID`,_D=`${hB}_DEFAULT_DATA_INDEX`,yD=`${hB}_DEFAULT_DATA_KEY`,bD=`${hB}_DEFAULT_DATA_SERIES_FIELD`,xD=`${hB}_DEFAULT_SERIES_STYLE_NAME`;var SD;t.AttributeLevel=void 0,(SD=t.AttributeLevel||(t.AttributeLevel={}))[SD.Default=0]="Default",SD[SD.Theme=1]="Theme",SD[SD.Chart=2]="Chart",SD[SD.Base_Series=3]="Base_Series",SD[SD.Series=4]="Series",SD[SD.Mark=5]="Mark",SD[SD.User_Chart=6]="User_Chart",SD[SD.User_Series=7]="User_Series",SD[SD.User_Mark=8]="User_Mark",SD[SD.Built_In=99]="Built_In";const AD=`${hB}_STACK_KEY`,kD=`${hB}_STACK_START`,MD=`${hB}_STACK_END`,TD=`${hB}_STACK_START_PERCENT`,wD=`${hB}_STACK_END_PERCENT`,CD=`${hB}_STACK_START_OffsetSilhouette`,ED=`${hB}_STACK_END_OffsetSilhouette`,PD=`${hB}_STACK_TOTAL`,BD=`${hB}_STACK_TOTAL_PERCENT`,RD=`${hB}_STACK_TOTAL_TOP`,LD=`${hB}_SEGMENT_START`,OD=`${hB}_SEGMENT_END`;var ID,DD;t.LayoutZIndex=void 0,(ID=t.LayoutZIndex||(t.LayoutZIndex={}))[ID.Axis_Grid=50]="Axis_Grid",ID[ID.CrossHair_Grid=100]="CrossHair_Grid",ID[ID.Region=450]="Region",ID[ID.Mark=300]="Mark",ID[ID.Node=400]="Node",ID[ID.Axis=100]="Axis",ID[ID.MarkLine=500]="MarkLine",ID[ID.MarkArea=100]="MarkArea",ID[ID.MarkPoint=500]="MarkPoint",ID[ID.DataZoom=500]="DataZoom",ID[ID.ScrollBar=500]="ScrollBar",ID[ID.Player=500]="Player",ID[ID.Legend=500]="Legend",ID[ID.CrossHair=500]="CrossHair",ID[ID.Indicator=500]="Indicator",ID[ID.Title=500]="Title",ID[ID.Label=500]="Label",ID[ID.Brush=500]="Brush",ID[ID.CustomMark=500]="CustomMark",ID[ID.Interaction=700]="Interaction",t.LayoutLevel=void 0,(DD=t.LayoutLevel||(t.LayoutLevel={}))[DD.Indicator=10]="Indicator",DD[DD.Region=20]="Region",DD[DD.Axis=30]="Axis",DD[DD.DataZoom=40]="DataZoom",DD[DD.Player=40]="Player",DD[DD.ScrollBar=40]="ScrollBar",DD[DD.Legend=50]="Legend",DD[DD.Title=70]="Title",DD[DD.CustomMark=70]="CustomMark";const FD=["linear","radial","conical"],jD={x0:0,y0:0,x1:1,y1:1},zD={x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},HD={x:.5,y:.5,startAngle:0,endAngle:2*Math.PI},VD={linear:jD,radial:zD,conical:HD},ND={label:{name:"label",type:"text"}},GD=`${hB}_rect_x`,WD=`${hB}_rect_x1`,UD=`${hB}_rect_y`,YD=`${hB}_rect_y1`,KD=Object.assign(Object.assign({},ND),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),XD=Object.assign(Object.assign({},ND),{bar3d:{name:"bar3d",type:"rect3d"}}),$D={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},qD=Object.assign(Object.assign({},ND),$D),ZD=Object.assign(Object.assign({},ND),{point:{name:"point",type:"symbol"}}),JD=Object.assign(Object.assign(Object.assign({},ND),$D),{area:{name:"area",type:"area"}}),QD=Object.assign(Object.assign(Object.assign({},ND),$D),{area:{name:"area",type:"area"}}),tF=Object.assign(Object.assign({},ND),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),eF=Object.assign(Object.assign({},ND),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}}),iF=Object.assign(Object.assign({},ND),{rose:{name:"rose",type:"arc"}}),sF=Object.assign(Object.assign({},ND),{area:{name:"area",type:"path"}}),nF=Object.assign(Object.assign({},ND),{group:{name:"group",type:"group"}}),rF=Object.assign(Object.assign({},nF),{track:{name:"track",type:"arc"},progress:{name:"progress",type:"arc"}}),aF=Object.assign(Object.assign({},ND),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),oF=Object.assign(Object.assign({},ND),{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"}}),lF=Object.assign(Object.assign({},ND),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"}}),hF=Object.assign(Object.assign({},ND),{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"}}),cF=Object.assign(Object.assign({},ND),{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"}}),dF=Object.assign(Object.assign({},ND),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),uF=Object.assign(Object.assign({},KD),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),pF=Object.assign(Object.assign({},ND),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),gF=Object.assign(Object.assign({},ND),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),mF=Object.assign(Object.assign({},ND),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}}),fF=Object.assign(Object.assign({},nF),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),vF=Object.assign(Object.assign({},ND),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),_F=Object.assign(Object.assign({},ND),{sunburst:{name:"sunburst",type:"arc"}}),yF=Object.assign(Object.assign({},KD),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),bF=Object.assign(Object.assign({},XD),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),xF=Object.assign(Object.assign({},ND),{circlePacking:{name:"circlePacking",type:"arc"}}),SF=Object.assign(Object.assign({},ND),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}}),AF=Object.assign(Object.assign({},ND),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),kF=Object.assign({},JD),MF=Object.assign(Object.assign({},ND),{liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"symbol"}}),TF=Object.assign(Object.assign({},ND),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});var wF;!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"}(wF||(wF={}));const CF={[oB.bar]:KD,[oB.bar3d]:XD,[oB.line]:qD,[oB.scatter]:ZD,[oB.area]:JD,[oB.radar]:QD,[oB.pie]:tF,[oB.pie3d]:eF,[oB.rose]:iF,[oB.geo]:ND,[oB.map]:sF,[oB.circularProgress]:rF,[oB.link]:aF,[oB.dot]:oF,[oB.wordCloud]:lF,[oB.wordCloud3d]:lF,[oB.funnel]:hF,[oB.funnel3d]:cF,[oB.linearProgress]:dF,[oB.waterfall]:uF,[oB.boxPlot]:pF,[oB.treemap]:gF,[oB.sankey]:mF,[oB.gauge]:fF,[oB.gaugePointer]:vF,[oB.sunburst]:_F,[oB.rangeColumn]:yF,[oB.rangeColumn3d]:bF,[oB.circlePacking]:xF,[oB.heatmap]:SF,[oB.correlation]:AF,[oB.rangeArea]:kF,[oB.liquid]:MF,[oB.venn]:TF};function EF(t){var e,i;const{type:s}=t;return s===oB.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}const PF={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},BF={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function RF(t,e){var i;if(!t)return[];const s=zF(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?FF(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>DF(i)?OF(t,i,e):i)).filter(p)}))):i.map((i=>DF(i)?OF(t,i,e):i)).filter(p):[]}return[]}function LF(t,e){var i,s;return FF(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 OF(t,e,i){var s;const n=zF(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=PF[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=BF[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 IF=(t,e,i)=>{if(e&&DF(t)){const s=OF(e,t,i);if(s)return s}return t};function DF(t){return t&&"palette"===t.type&&!!t.key}function FF(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function jF(t){return y(t)?{dataScheme:t}:t}function zF(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=EF(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 HF extends sC{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(!FF(this._range))return void super.range(this._range);const t=LF(this._range,this._domain);super.range(t)}}const VF={linear:TC,band:rC,point:class extends rC{constructor(t){super(!1),this.type=Pw.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:sC,threshold:BC,colorOrdinal:HF};function NF(t){const e=VF[t];return e?new e:null}function GF(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 WF(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function UF(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function YF(t){return!!_(t)&&(!!t.endsWith("%")&&nb(t.substring(0,t.length-1)))}function KF(t,e,i,s=0){var n,r;return S(t)?t:YF(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 XF(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]=KF(t[s],e.size,i)}))})),o}function $F(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)||YF(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 qF(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const ZF=(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},JF=[{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"]}],QF={default:{dataScheme:JF,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"}}},tj="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",ej={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:tj,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:tj,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:CB,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"}}}}},ij={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}}},sj=Object.assign(Object.assign({},ij),{label:{space:0}}),nj={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}}}}},rj="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;",aj={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:rj,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:rj,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}}}},oj={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}},lj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}},hj={horizontal:Object.assign(Object.assign({},oj),{rail:{width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:lj}),vertical:Object.assign(Object.assign({},oj),{rail:{width:8,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:lj})},cj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}},dj={horizontal:Object.assign(Object.assign({},oj),{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:cj}),vertical:Object.assign(Object.assign({},oj),{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:cj})},uj={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"}}}}},pj={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"}}}}},gj={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 mj(t,e){return t&&e.key in t?t[e.key]:e.default}function fj(t){return t&&"token"===t.type&&!!t.key}const vj={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%"},_j={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:QF,token:vj,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:ej,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},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:hj,sizeLegend:dj,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:ij,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:sj,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:pj,markArea:uj,markPoint:gj,polarMarkLine:pj,polarMarkArea:uj,polarMarkPoint:gj,geoMarkPoint:gj,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",textAlign:"left",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"},textAlign:"left",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:aj,crosshair:nj,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},yj={name:"dark",colorScheme:{default:{dataScheme:JF,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"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},bj=(t,e)=>t===e||!d(t)&&!d(e)&&(y(t)&&y(e)?e.every((e=>t.some((t=>bj(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>bj(t[i],e[i])))),xj=(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]={}),xj(t[s],e.slice(1),i))};function Sj(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]=Sj(n,e)}return s}function Aj(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])?kj(t,e,r,i):Mj(t,r,s[r])}}}}function kj(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?Tj({},t[n][e.index],i):i):t[n]=s?Tj({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?Tj({},t[n][r],i):i)}else t.id===e&&(t[n]=s?Tj({},t[n],i):i)}))}function Cj(t,...e){return Tj(Ej(t),...e.map(Ej))}function Ej(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]=jF(s),e}),{}));return t}(t.colorScheme),{series:s}=t,{mark:n,markByName:r}=t;let a;return(n||r)&&(a=Object.keys(CF).reduce(((t,e)=>{var i;const a=null!==(i=null==s?void 0:s[e])&&void 0!==i?i:{};return t[e]=Pj(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 Pj(t,e,i,s){if(!CF[e])return t;const n={};return Object.values(CF[e]).forEach((({type:e,name:r})=>{n[r]=Tj({},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 Bj=["animationThreshold","colorScheme","name","padding"];function Rj(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];Bj.includes(r)?n[r]=a:f(a)?DF(a)?n[r]=IF(a,e,s):fj(a)?n[r]=mj(i,a):n[r]=Rj(a,e,i,s):n[r]=a})),n}const Lj={[_j.name]:_j},Oj=_j.name,Ij=new Map(Object.keys(Lj).map((t=>[t,Lj[t]]))),Dj=new Map(Object.keys(Lj).map((t=>[t,Rj(Lj[t])]))),Fj=new Map(Object.keys(Lj).map((t=>[t,t===Oj]))),jj=(t,e)=>{if(!t)return;const i=Nj(e);Ij.set(t,i),Dj.set(t,Rj(i)),Fj.set(t,!0)},zj=(t=Oj,e=!1)=>(Fj.has(t)&&!Fj.get(t)&&jj(t,Ij.get(t)),e?Dj.get(t):Ij.get(t)),Hj=t=>Ij.delete(t)&&Dj.delete(t)&&Fj.delete(t),Vj=t=>!!_(t)&&Ij.has(t),Nj=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:Oj;return Cj({},zj(i),t)};class Gj{static registerInstance(t){Gj.instances.set(t.id,t)}static unregisterInstance(t){Gj.instances.delete(t.id)}static getInstance(t){return Gj.instances.get(t)}static instanceExist(t){return Gj.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return Gj.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}Gj.instances=new Map;class Wj{static registerTheme(t,e){jj(t,e)}static getTheme(t,e=!1){return zj(t,e)}static removeTheme(t){return Hj(t)}static themeExist(t){return Vj(t)}static getDefaultTheme(){return Wj.themes.get(Oj)}static setCurrentTheme(t){Wj.themeExist(t)&&(Wj._currentThemeName=t,Gj.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return Wj.getTheme(Wj._currentThemeName,t)}static getCurrentThemeName(){return Wj._currentThemeName}}function Uj(t,e){return _(t)?Wj.themeExist(t)?Wj.getTheme(t,e):{}:g(t)?t:{}}function Yj(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]=Yj(t[s],e)}return i}return y(t)?t.map((t=>Yj(t,e))):t}function Kj(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]=Kj(t[s],e)}return i}return y(t)?t.map((t=>Kj(t,e))):t}Wj.themes=Ij,Wj._currentThemeName=Oj;function Xj(t,e){for(let i=0;it.key===e))}function qj(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 Zj(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:{}},iz(t,a,n[o],l,e,r))})),s?Jj(n):n}function Jj(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))):Jj(t[e].nodes);return t}function Qj(t,e){if("values"in t&&t.values.length){const i=JP(t.values,e),s=ZP(t.values,wD);t.values.forEach((t=>{t[PD]=i,t[BD]=s,delete t[RD]}));const n=t.values.reduce(((t,e)=>e[MD]>t[MD]?e:t));n[RD]=!0}else for(const i in t.nodes)Qj(t.nodes[i],e)}function tz(t){if(!t.values.length)return;const e=t.values[t.values.length-1][MD]/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[kD]=s,s+=r[MD],r[MD]=s):(r[kD]=n,n+=r[MD],r[MD]=n),r[AD]=t.key}if(i)for(let i=0;i=0?s:n;r=a>=0?1:-1,l[TD]=0===h?0:Math.min(1,l[kD]/h)*r,l[wD]=0===h?0:Math.min(1,l[MD]/h)*r}}for(const s in t.nodes)ez(t.nodes[s],e,i)}function iz(t,e,i,s,n,r,a){if("values"in e)if(n&&e.values.forEach((t=>t[MD]=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}),iz(t,e.nodes[o],i.nodes[o],s,n,r,l)}}const sz=(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]=rz(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function az(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>lz(t.style(e,i,s,n)):B(t.style)||(e.style=lz(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>lz(t.state[e](i,s,n,r)):B(t.state[e])||(i[e]=lz(t.state[e]))})),e.state=i}return e}function oz(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>lz(t[i](e,s,n,r)):B(t[i])||(e[i]=lz(t[i]))})),e}function lz(t){return(null==t?void 0:t.angle)&&(t.angle=te(t.angle)),t}class hz{static registerChart(t,e){hz._charts[t]=e}static registerSeries(t,e){hz._series[t]=e}static registerComponent(t,e,i){hz._components[t]={cmp:e,alwaysCheck:i}}static registerMark(t,e){hz._marks[t]=e}static registerRegion(t,e){hz._regions[t]=e}static registerTransform(t,e){hz.transforms[t]=e}static registerLayout(t,e){hz._layout[t]=e}static registerAnimation(t,e){hz._animations[t]=e}static registerImplement(t,e){hz._implements[t]=e}static registerChartPlugin(t,e){hz._chartPlugin[t]=e}static registerComponentPlugin(t,e){hz._componentPlugin[t]=e}static createChart(t,e,i){if(!hz._charts[t])return null;return new(0,hz._charts[t])(e,i)}static createChartSpecTransformer(t,e){if(!hz._charts[t])return null;const i=hz._charts[t];return new(0,i.transformerConstructor)(Object.assign({seriesType:i.seriesType},e))}static createRegion(t,e,i){if(!hz._regions[t])return null;return new(0,hz._regions[t])(e,i)}static createRegionSpecTransformer(t,e){if(!hz._regions[t])return null;return new(0,hz._regions[t].transformerConstructor)(e)}static createSeries(t,e,i){if(!hz._series[t])return null;return new(0,hz._series[t])(e,i)}static createSeriesSpecTransformer(t,e){if(!hz._series[t])return null;return new(0,hz._series[t].transformerConstructor)(e)}static createMark(t,e,i){if(!hz._marks[t])return null;const s=new(0,hz._marks[t])(e,i);return"group"===s.type&&s.setInteractive(!1),s}static getComponents(){return Object.values(hz._components)}static getComponentInKey(t){return hz._components[t].cmp}static getLayout(){return Object.values(hz._layout)}static getLayoutInKey(t){return hz._layout[t]}static getSeries(){return Object.values(hz._series)}static getSeriesInType(t){return hz._series[t]}static getRegionInType(t){return hz._regions[t]}static getAnimationInKey(t){return hz._animations[t]}static getImplementInKey(t){return hz._implements[t]}static getSeriesMarkMap(t){return hz._series[t]?hz._series[t].mark:{}}static getChartPlugins(){return Object.values(hz._chartPlugin)}static getComponentPlugins(){return Object.values(hz._componentPlugin)}static getComponentPluginInType(t){return hz._componentPlugin[t]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}}hz._charts={},hz._series={},hz._components={},hz._marks={},hz._regions={},hz._animations={},hz._implements={},hz._chartPlugin={},hz._componentPlugin={},hz.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}},hz.dataParser={csv:Yr,dsv:Ur,tsv:Kr},hz._layout={};const cz=(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))},dz=(t,e,i,s)=>{var n;const r=jw(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:uz(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("_")}`,pz=(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},gz=(t,e)=>{if(!t)return null;if(!rB(t.getRegionsInIndex(),"polar"))return null;const{x:i,y:s}=e,n=pz(t,(t=>"angle"===t.getOrient()),e),r=pz(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&&jw(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=eB({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=iB(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=dz(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&&jw(r.type)){const h=t.getCenter(),c={x:i-t.getLayoutStartPoint().x-h.x,y:s-t.getLayoutStartPoint().y-h.y};let d=eB({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=iB(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 _=dz(f,t,"polar",o);a.push({index:v,value:f,position:r.scale(f),axis:t,data:_})}})),a.length?a:null};function mz(t){return"bottom"===t||"top"===t}function fz(t){return"left"===t||"right"===t}function vz(t){return"z"===t}function _z(t,e){return UF(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function yz(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function bz(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?mz(t)?"linear":"band":mz(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const xz=t=>t.fieldX[0],Sz=t=>t.fieldY[0],Az=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},kz=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},Mz=(t,e)=>t?e?xz:Az:e?Sz:kz,Tz=(t,e,i)=>{var s,n;if(!t)return null;if(!rB(t.getRegionsInIndex(),"cartesian"))return null;const{x:r,y:a}=e,o=null!==(s=pz(t,(t=>mz(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=pz(t,(t=>fz(t.getOrient())),e))&&void 0!==n?n:[],h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{jw(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=wz(s,i,t,Mz(e,jw(s.getScale().type)));n&&u.push(n)}}else{const n=h.size>0;if((n?h:c).has(s)){const r=wz(s,i,t,Mz(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},wz=(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 Cz(t,a,s)},Cz=(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=dz(e,t,"cartesian",null!=i?i:mz(t.getOrient())?xz:Sz);return{index:n,value:e,position:s.scale(e),axis:t,data:r}};class Ez{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:$y)("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:$y)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s;const n=null!==(i=Tz(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(s=gz(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=>jw(t.getScale().type))),r=n.length?n:s.filter((t=>{const e=t.getOrient();return mz(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=Cz(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var Pz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Pz||(Pz={}));const Bz={[Pz.dimensionHover]:class extends Ez{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)=>!cz(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}),tb(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}),tb(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[Pz.dimensionClick]:class extends Ez{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 Rz=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(Bz[t]){const e=new Bz[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(Bz[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}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class Lz{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}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const Oz={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 Iz{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 Lz);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}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 Oz[a]&&(a=Oz[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.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 hD.includes(e)||Object.values(t.VGRAMMAR_HOOK_EVENT).includes(e)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&kR.hasInteraction(e)}}function Dz(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function Fz(t,e,i){t.getParser(e)||t.registerParser(e,i)}const jz=new Map;let zz;function Hz(){zz||(zz=new va,Fz(zz,"geojson",da),Fz(zz,"topojson",pa),Dz(zz,"simplify",Rr))}function Vz(t,e,i={type:"geojson",centroid:!0}){jz.has(t)&&Xy(`map type of '${t}' already exists, will be overwritten.`),Hz();const s=new ya(zz),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}),jz.set(t,s)}function Nz(t){jz.has(t)?jz.delete(t):Xy(`map type of '${t}' does not exists.`)}function Gz(t,e=!1){let i=e;return t.latestData instanceof ya&&(i=!1),i?I(t.latestData):t.latestData.slice()}const Wz=(t,e)=>0===t.length?[]:1===t.length?Gz(t[0],null==e?void 0:e.deep):t.map((t=>Gz(t,null==e?void 0:e.deep)));function Uz(t,e,i){Dz(e=e instanceof va?e:t.dataSet,"copyDataView",Wz);const s=new ya(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:Xz.copyDataView}),s}function Yz(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:$y)(`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:$y)(`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([]),Xy("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 Kz(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var Xz;!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"}(Xz||(Xz={}));const $z=(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 uO(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:tH(this._option.mode),autoFit:!1,eventConfig:{gesture:tb(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())}clear(t,e=!1){const{chart:i}=t;i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=P_.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this._nextRafId&&(P_.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null),this._isRunning||(this.initView(),this._view&&(this._isRunning=!0,null===(e=this._view)||void 0===e||e.run(t),this._isRunning=!1,this._nextRafId&&(P_.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,this._isRunning=!0,null===(i=this._view)||void 0===i||i.run(t),this._isRunning=!1))))}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.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 Qy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function iH(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:$y)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function sH(t){t.crosshair=Y(t.crosshair||{}).map((e=>Tj({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function nH(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&&Qy(e.mode)){let t;t=_(h)?null===document||void 0===document?void 0:document.getElementById(h):h;const{width:e,height:s}=ii(t,i.width,i.height);a=e,o=s}else if(eb(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 rH(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")}),t}function aH(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"}(Jz||(Jz={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(Qz||(Qz={}));class oH{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({},oH.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]))))}}oH.defaultMarkInfo={};class lH{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new oH,this._markReverse=new oH,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement(Jz.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement(Jz.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement(Jz.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement(Jz.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement(Jz.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(Jz.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[Jz.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[Jz.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(Pz.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 hH={};Object.values(Jz).forEach((t=>{hH[t]=!0}));const cH={[Jz.STATE_HOVER]:Jz.STATE_HOVER_REVERSE,[Jz.STATE_SELECTED]:Jz.STATE_SELECTED_REVERSE,[Jz.STATE_DIMENSION_HOVER]:Jz.STATE_DIMENSION_HOVER_REVERSE};function dH(t){return cH[t]}class uH{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=dH(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=dH(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=dH(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=dH(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 pH{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 gH extends pH{constructor(){super(...arguments),this.id=sb(),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 mH extends gH{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,s){super(t),this.grammarType=Zz.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 fH extends pH{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 mH(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 vH extends fH{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 _H extends vH{constructor(){super(...arguments),this.id=sb(),this.stateKeyToSignalName=t=>`${hB}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===qz.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===qz.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?qz.none:qz.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?qz.exit:qz.appear}}}}class yH{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=>Tj({},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 bH extends pH{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=yH,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new oH,this._lastLayoutRect=null,this.id=sb(),this.userId=t.id,this._spec=t,this.effect={},this.event=new Rz(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=`${hB}_${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=hz.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 xH{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=XF($F(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:KF(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:KF(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:KF(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:KF(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:KF(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:KF(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=KF(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=KF(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]=KF(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 SH extends bH{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 xH(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 AH extends yH{_initTheme(t,e){return{spec:t,theme:this._theme}}}class kH extends SH{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=AH,this.modelType="region",this.specKey="region",this.type=kH.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.interaction=new uH,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 _H({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 lH(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 Qz)B(t.stateStyle[Qz[e]])||this.interaction.registerMark(Qz[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 MH(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 TH(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 wH(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 CH(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),wH(c,!0,u,o),s&&TH(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function EH(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),wH(c,!1,u,a),s&&TH(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function BH(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}=MH(t);s.length&&CH(s,e,i,!1,"left"),n.length&&CH(n,e,i,!0,"left"),r.length&&EH(r,e,0,"left")}(e,this,a),s.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=MH(t);s.length&&PH(s,e,i,!1,"top"),n.length&&PH(n,e,i,!0,"top"),r.length&&BH(r,e,0,"top")}(s,this,r),i.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=MH(t);s.length&&CH(s,e,i,!1,"right"),n.length&&CH(n,e,i,!0,"right"),r.length&&EH(r,e,0,"right")}(i,this,a),n.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=MH(t);s.length&&PH(s,e,i,!1,"bottom"),n.length&&PH(n,e,i,!0,"bottom"),r.length&&BH(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:$y)("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}}}RH.type="base";const LH=["line","area","trail"];function OH(t){return LH.includes(t)}class IH extends vH{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(OH)?s:!t.mark||OH(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=>!!hH[t])).map((t=>[t,10])),s=!t.mark||OH(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(hB)));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(hB)));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(Dw(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 DH extends gH{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=Zz.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 FH extends DH{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${hB}_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 jH extends gH{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=Zz.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 IH(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 Rz(s.getOption().eventDispatcher,s.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new FH(t)}stateKeyToSignalName(t){return`${hB}_${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=Jz.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=Jz.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===qz.appear&&this.runAnimationByState(qz.normal)})):this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,(()=>{this.runAnimationByState(qz.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),this._morph&&this._morphKey&&(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 zH extends jH{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].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))}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&&Tj(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(Fw(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=NF(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()):FD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Fw(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=LF(RF(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({},VD[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)FD.includes(null===(o=n.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(n.stroke)(t,e));else{const e=LF(RF(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 HH extends zH{constructor(){super(...arguments),this.type=HH.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)?(Xy("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?(Xy("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})}))}}HH.type="group";const VH=()=>{fM(),iM(),kR.registerGraphic(RB.group,ku),hz.registerMark(HH.type,HH)},NH={type:"clipIn"},GH={type:"fadeIn"};function WH(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 GH;default:return NH}}const UH={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"}},YH={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},KH={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},XH=()=>{hz.registerAnimation("scaleInOut",(()=>YH))},$H=()=>{hz.registerAnimation("fadeInOut",(()=>KH))},qH=(t,e)=>({appear:WH(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:Hc,duration:UH.update.duration,easing:UH.update.easing}],disappear:{type:"clipOut"}}),ZH=()=>{hz.registerAnimation("line",qH)},JH=()=>{uO.useRegisters([UI,YI,KI,XI,$I,qI,II,DI])},QH={measureText:(t,e,i,s)=>((t,e,i)=>GM(t,e,i,{fontFamily:vj.fontFamily,fontSize:vj.fontSize}))(e,i,s).measure(t)};class tV{static instance(){return tV.instance_||(tV.instance_=new tV),tV.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 eV{constructor(){this.id=sb(),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))?Xy("不要重复添加相同的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 iV extends eV{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 sV{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>hz.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>hz.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>hz.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return hz.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>hz.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){hz.registerTransform(t,e)}static registerFunction(t,e){t&&e&&tV.instance().registerFunction(t,e)}static unregisterFunction(t){t&&tV.instance().unregisterFunction(t)}static getFunction(t){return t?tV.instance().getFunction(t):null}static getFunctionList(){return tV.instance().getFunctionNameList()}static registerMap(t,e,i){const s=hz.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=hz.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,jz.get(e);var e}static hideTooltip(t=[]){Gj.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,c;this.id=sb(),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 d=this._option,{dom:u,renderCanvas:p,mode:g,stage:m,poptip:f}=d,v=e(d,["dom","renderCanvas","mode","stage","poptip"]),y=Qy(g);y&&u&&(this._container=_(u)?null===document||void 0===document?void 0:document.getElementById(u):u),p&&(this._canvas=p),m&&(this._stage=m),"node"===g||this._container||this._canvas||this._stage?(y?Cx(ql):"node"===g&&TA(ql),this._viewBox=this._option.viewBox,this._currentThemeName=Wj.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new eH({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:p},Object.assign(Object.assign({mode:this._option.mode,stage:m,pluginList:!1!==f?["poptipForText"]:[]},v),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new Iz(this,this._compiler),this._event=new Rz(this._eventDispatcher,g),this._compiler.initView(),null===(o=this.getStage())||void 0===o||o.setTheme({text:{fontFamily:null===(l=this._currentTheme)||void 0===l?void 0:l.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!y&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),Gj.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=Tj({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=Yj(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;sV.getFunctionList()&&sV.getFunctionList().length&&(t=Kj(t,sV)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=hz.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=hz.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=hz.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 nH(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:cB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:dB})}_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,Fz(this._dataSet,"dataview",ga),Fz(this._dataSet,"array",s),Dz(this._dataSet,"stackSplit",$z),Dz(this._dataSet,"copyDataView",Wz);for(const t in hz.transforms)Dz(this._dataSet,t,hz.transforms[t]);for(const t in hz.dataParser)Fz(this._dataSet,t,hz.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),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;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,null===(s=this._compiler)||void 0===s||s.releaseGrammar(!1===(null===(n=this._option)||void 0===n?void 0:n.animation)||!1===(null===(r=this._spec)||void 0===r?void 0:r.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.reCompile&&(null===(a=this._compiler)||void 0===a||a.clear({chart:this._chart,vChart:this},!this._option.animation||!this._spec.animation),null===(o=this._compiler)||void 0===o||o.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(){var t,e;this._option.animation&&(null===(t=this._chart)||void 0===t||t.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(qz.update,!0)})),null===(e=this._chart)||void 0===e||e.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(qz.update,!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,Gj.unregisterInstance(this)}updateData(t,e,s){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s)}))}_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){return u(this._dataSet)?this:this._chart?(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){if(this._chart)return this._chart.updateFullData(t),e&&this._compiler.render(),this;const i=Y(this._spec.data);return Y(t).forEach((t=>{var e;const{id:s,values:n,parser:r,fields:a}=t,o=i.find((t=>t.name===s));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 s=Yz(t,this._dataSet,i,{onError:null===(e=this._option)||void 0===e?void 0:e.onError});y(this._spec.data)&&this._spec.data.push(s)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i){const s=this._updateSpec(t,e);return s?(this.updateCustomConfigAndRerender(s,!0,{morphConfig:i,transformSpec:s.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){var i,s;const n=this._spec;if(!this._setNewSpec(t,e))return;G(n.theme,this._spec.theme)||this._setCurrentTheme();const r=this._shouldChartResize(n);return null===(s=null===(i=this._compiler)||void 0===i?void 0:i.getVGrammarView())||void 0===s||s.updateLayoutTag(),this._spec.type!==n.type?{reTransformSpec:!0,change:!0,reMake:!0,reCompile:!1,reSize:r}:(this._initChartSpec(this._spec,"render"),rH(this._chart.updateSpec(this._spec),{reTransformSpec:!1,change:r,reMake:!1,reCompile:!1,reSize:r}))}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)||wj(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)||wj(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=Tj({},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=Uj(this._currentThemeName,!0);else if(_(s)&&(!n||_(n))||_(n)&&(!s||_(s))){const t=Cj({},Uj(this._currentThemeName,!0),Uj(s,!0),Uj(n,!0));this._currentTheme=t}else{const t=Cj({},Uj(this._currentThemeName),Uj(s),Uj(n));this._currentTheme=Rj(t)}var r;r=R(this._currentTheme,"component.poptip"),z(eT.poptip,tT,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=!!Qy(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?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return Uj(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){if(!Wj.themeExist(t))return this;const e=this._setCurrentTheme(t);return yield this.updateCustomConfigAndRerender(e,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){if(!Wj.themeExist(t))return this;const e=this._setCurrentTheme(t);return this.updateCustomConfigAndRerender(e,!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}}_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 iH(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(!Qy(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)?null===document||void 0===document?void 0:document.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?qF(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 Xy("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?qF(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Xy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return tV.instance().getFunction(t)}registerFunction(t,e){t&&e&&tV.instance().registerFunction(t,e)}unregisterFunction(t){t&&tV.instance().unregisterFunction(t)}getFunctionList(){return tV.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}_initChartPlugin(){const t=hz.getChartPlugins();t.length>0&&(this._chartPlugin=new iV(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}}}sV.InstanceManager=Gj,sV.ThemeManager=Wj,sV.globalConfig={uniqueTooltip:!0},sV.Utils=QH,sV.vglobal=P_;hz.registerRegion("region",kH),hz.registerLayout("base",RH),VH(),uO.useRegisters([tI,eI]),uO.useRegisters([sD,nD,FI,jI,eD,iD,rD,aD,oD]),UR(),WR(),jj(yj.name,yj),at.getInstance(rt.Error);const nV=(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(oB).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=hz.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=hz.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},rV=(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=nV(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):bj(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const m=Tj({},i),f=d(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:Tj(m,f),hasChanged:!0};const i=Tj({},t,f);xj(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 aV{constructor(t){this.id=sb(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}const oV=t=>{hz.registerChartPlugin(t.type,t)};class lV extends aV{constructor(){super(lV.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[lV.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[lV.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=Sj(this._option.globalInstance.getSpec(),["data",lV.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=Sj(this._baseChartSpec,["data",lV.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=rV(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=Sj(i,["data",lV.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()}}lV.pluginType="chart",lV.specKey="media",lV.type="MediaQueryPlugin";const hV=/\{([^}]+)\}/,cV=/\{([^}]+)\}/g,dV=/:/;class uV extends aV{constructor(){super(uV.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[uV.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)),hz.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=hV.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(cV,((t,i)=>{if(!dV.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}}uV.pluginType="chart",uV.specKey="formatter",uV.type="formatterPlugin";const pV=()=>{oV(uV)};function gV(t){return 2===t.length&&k(t[0])&&k(t[1])&&t[1]>=t[0]}function mV(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 fV(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 vV(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 _V(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 yV(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 bV=(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 RC(v)};class xV extends aV{constructor(){super(xV.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!Dw(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&&gV(c)&&gV(d)))return;const u=mV(t,c),p=mV(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(!vV(u,p))return}else if(0===y&&0===b){if(!vV(p,u))return}else if(_||A)if(_&&!A){if(!fV(u,p))return}else if(A&&!_){if(!fV(p,u))return}else{if(m===b)return;if(m>b){if(!_V(u,p))return}else if(!_V(p,u))return}else{if(0===m&&0===y){if(!yV(u,p))return}else if(0===b&&0===g&&!yV(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){Dz(e.getOption().dataSet,"tickAlign",bV);const t={targetAxis:()=>s,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}xV.pluginType="component",xV.type="AxisSyncPlugin";const SV=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,AV=(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},mm||(mm=pm.CreateGraphic("richtext",{})),mm.setAttributes(a),mm.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}},kV="vchart-tooltip-container",MV={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}};function TV(t,e){return R(e,`component.${t}`)}function wV(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=hz.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const CV={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function EV(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 PV(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 BV(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function RV(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}const LV=(t,e,i)=>{var s;const n=null!==(s="band"===e?TV("axisBand",i):["linear","log","symlog"].includes(e)?TV("axisLinear",i):{})&&void 0!==s?s:{},r=mz(t)?TV("axisX",i):fz(t)?TV("axisY",i):TV("axisZ",i);return Tj({},TV("axis",i),n,r)},OV=(t,e,i)=>{var s;const n=null!==(s="band"===e?TV("axisBand",i):"linear"===e?TV("axisLinear",i):{})&&void 0!==s?s:{},r=TV("angle"===t?"axisAngle":"axisRadius",i);return Tj({},TV("axis",i),n,r)},IV=t=>"band"===t||"ordinal"===t||"point"===t;function DV(t,e){return{id:t,label:t,value:e,rawValue:t}}function FV(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 jV(t,e,i,s){let n=0,r=t.length-1;for(;n<=r;){const a=Math.floor((n+r)/2),o=t[a];if(o[i]<=e&&o[s||i]>=e)return o;o[i]>e?r=a-1:n=a+1}return null}const zV=(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(jw(a.type))A=a.bandwidth(),0===A&&a.step&&(M=a.step());else if(Dw(a.type)){const s=e.fieldX[0],r=e.fieldX2,a=jV(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=EV(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(jw(r.type))k=r.bandwidth(),0===k&&r.step&&(T=r.step());else if(Dw(r.type)){const s=e.fieldY[0],r=e.fieldY2,a=jV(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=EV(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(VV(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&&HV(t,"top",r.label),e.visible&&HV(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(VV(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&&HV(t,"left",a.label),e.visible&&HV(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}},HV=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=wV(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},VV=(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)}))}))},NV=(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=WV(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},GV=(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=WV(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},WV=(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},UV=(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},YV={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"]},KV=(t,e)=>{var i,s;return null!==(s=null===(i=YV[t])||void 0===i?void 0:i[0])&&void 0!==s?s:e},XV=(t,e)=>{var i,s;return null!==(s=null===(i=YV[t])||void 0===i?void 0:i[1])&&void 0!==s?s:e},$V=(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}=zV(3,e,i,s,n,r,a);return o?NV(r,o,d,h):l?GV(a,l,u,c):void 0},qV={fontFamily:vj.fontFamily,spacing:10,wordBreak:"break-word"};function ZV(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:qV),{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 JV=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},QV=(t,e)=>p(e)?t.map((t=>e[t])):void 0,tN=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),eN=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function iN(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=sN(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=>tN(i,s)(t)&&tN(n,r)(t)&&(u(a)||tN([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 sV.globalConfig.uniqueTooltip&&sV.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 sV.globalConfig.uniqueTooltip&&sV.hideTooltip(u.id),d}return"none"}const sN=(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=QV(c,t);let _=QV(d,t);const y=eN(_),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(tN(c,v));if(!y&&(_=QV(d,i),!eN(_)))return;const n=e.type===oB.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=jw(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(tN(c,n));f.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=QV(d,o),!eN(_))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(tN(c,n));if(!y&&(_=QV(d,r),!eN(_)))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===oB.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(tN(c,v))).find((t=>t[g]===m));f.forEach((n=>{if(_=QV(d,i),!eN(_))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},nN=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 rN=(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 aN{constructor(){this.activeTriggerSet={mark:new Set,dimension:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set,dimension:new Set,group:new Set}}}class oN extends aN{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:hN(e.title,{seriesId:this.series.id},!0),content:cN(e.content,{seriesId:this.series.id},!0)}))})),this.spec=a,this.activeType=nN(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 lN=(t,e,i)=>{const s=d(e)?e(t):e;return i?Object.assign(Object.assign({},t),s):Object.assign(Object.assign({},s),t)},hN=(t,e,i)=>p(t)?d(t)?(...s)=>lN(t(...s),e,i):lN(t,e,i):void 0,cN=(t,e,i)=>{const s=p(t)?Y(t).map((t=>d(t)?(...s)=>Y(t(...s)).map((t=>lN(t,e,i))):lN(t,e,i))):void 0;return s},dN=(t,e,i)=>{var s;let n={};switch(t){case"mark":case"group":e&&(n=null!==(s=rN(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=rN(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},uN=(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=pN(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)&&nN(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},pN=ft((t=>t.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(p))),[]))),gN=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},mN=(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}=wV(void 0,s,t,e);i&&r&&(n=i(...r))}return n},vN=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;class _N{}_N.dom=`${hB}_TOOLTIP_HANDLER_DOM`,_N.canvas=`${hB}_TOOLTIP_HANDLER_CANVAS`;const yN=20,bN={key:"其他",value:"..."},xN=(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)},SN=(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=vN(t.title,e,i),{visible:h,value:c,valueTimeFormat:p,valueTimeFormatMode:g,valueStyle:m,hasShape:f,valueFormatter:v}=null!=l?l:{},_=!1!==fN(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:xN(fN(c,t,i,v),p,g),valueStyle:fN(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=yN}=t,x=t.othersLine?Object.assign(Object.assign({},bN),t.othersLine):bN,S=t=>{if(null==t?void 0:t.length)for(const e of t)for(const t of null!=y?y:[]){const s=AN(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=AN(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},AN=(t,e,i)=>{const s=xN(fN(e.key,t,i,e.keyFormatter),e.keyTimeFormat,e.keyTimeFormatMode),n=xN(fN(e.value,t,i,e.valueFormatter),e.valueTimeFormat,e.valueTimeFormatMode),r=!1!==fN(e.visible,t,i)&&(p(s)||p(n)),a=fN(e.isKeyAdaptive,t,i),o=fN(e.spaceRow,t,i),l=fN(e.shapeType,t,i),h=fN(e.shapeColor,t,i),c=fN(e.shapeFill,t,i),d=fN(e.shapeStroke,t,i),u=fN(e.shapeLineWidth,t,i),g=fN(e.shapeHollow,t,i),m=fN(e.keyStyle,t,i),f=fN(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 kN extends aV{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=vN(x.position,b,e),M=null!==(n=vN(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:cB,R=null!==(o=null==P?void 0:P.height)&&void 0!==o?o:dB;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(Qy(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=SV(t,e),j=SV(T,D)}}else O.width=B,O.height=R;const z=j/F;let H,V,N,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=$V(e.dimensionInfo,rB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.x,a=t.end.x)}else W=t;if(L)switch(KV(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=$V(e.dimensionInfo,rB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.y,a=t.end.y)}else U=t;if(L)switch(XV(t)){case"top":V=r-C*z-_;break;case"bottom":V=a+_;break;case"center":V=(r+a)/2-C*z/2;break;case"centerTop":V=(r+a)/2-C*z-_;break;case"centerBottom":V=(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=UV(t,c),V=UV(i,c),N=UV(e,c),G=UV(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=UV(t,c):Y(t),S(e)||d(e)?V=UV(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(N))$=B-w*z-N;else{const t=Z;switch(KV(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(V))q=V;else if(k(G))q=R-C*z-G;else{const t=J;switch(XV(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,Qy(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"===KV(A,"right")?$+=v+w/2:$+=2*v+w)},at=()=>{et()&&($=-D.x/j)},ot=()=>{it()&&(L?$=(Q-D.x)/j-w:"center"===KV(A,"right")?$-=v+w/2:$-=2*v+w)},lt=()=>{it()&&($=(Q-D.x)/j-w)},ht=()=>{st()&&(L?q=-D.y/j:"center"===XV(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"===XV(A,"bottom")?q-=_+C/2:q-=2*_+C)},ut=()=>{nt()&&(q=(tt-D.y)/j-C)};switch(KV(A,"right")){case"center":case"centerLeft":case"centerRight":et()?(rt(),lt()):(ot(),at());break;case"left":rt(),lt();break;case"right":ot(),at()}switch(XV(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({},MV),{offsetX:null!==(t=null==i?void 0:i.x)&&void 0!==t?t:MV.offsetX,offsetY:null!==(e=null==i?void 0:i.y)&&void 0!==e?e:MV.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:_}=l,y=ei(d.padding),b=$F(d.padding),x=ZV(u,i),S=ZV(m,i),A=ZV(f,i),k={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},M={panel:JV(d),padding:y,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,maxContentHeight:_,enterable:h,transitionDuration:c},{title:T={},content:w=[]}=t;let C=b.left+b.right,E=b.top+b.bottom,P=b.top+b.bottom,B=0;const R=w.filter((t=>(t.key||t.value)&&!1!==t.visible)),L=!!R.length;let O=0,I=0,D=0,F=0;if(L){const t=[],e=[],i=[],s=[];let n=0;M.content=R.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:M,shapeColor:T}=r,w={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=Tj({},S,ZV(b,void 0,{})),{width:s,height:n,text:r}=AV(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=Tj({},A,ZV(x,void 0,{})),{width:e,height:s,text:n}=AV(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;M?t.stroke=e:t.fill=e,t.stroke=null!=u?u:e,t.lineWidth=g,w.shape=t;const i=null!=m?m:k.size;o=Math.max(i,o),s.push(i)}else w.shape={visible:!1};return w.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(V){U=Tj({},x,ZV(G,void 0,{})),Y()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:L?Math.ceil(B):void 0);const{text:t,width:e,height:i}=AV(N,U);M.title.value=Object.assign(Object.assign({width:Y()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),j=M.title.value.width,z=M.title.value.height,H=z+(L?M.title.spaceRow:0)}return E+=H,P+=H,M.title.width=j,M.title.height=z,Y()?C+=B||j:C+=Math.max(j,B),L&&M.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=C-b.left-b.right-F-O-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),M.valueWidth=Math.max(M.valueWidth,i.width))})),M.panel.width=C,M.panel.height=E,M.panelDomHeight=P,M})(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(Qy(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=SV(t,s),u=SV(l,c)}return s*=d,n*=d,Qy(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()}}kN.specKey="tooltip";const MN=(t,e)=>p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",TN=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 wN;const CN=(t=document.body)=>{if(u(wN)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),wN=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return wN};function EN(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}=null!=t?t:{},{fill:m,shadow:f,shadowBlur:v,shadowColor:_,shadowOffsetX:y,shadowOffsetY:b,shadowSpread:x,cornerRadius:S,stroke:A,lineWidth:k=0,width:M=0}=n,{value:T={}}=o,{shape:w={},key:C={},value:E={}}=l,P=function(t,e){if(!t)return;const{size:i}=Tj({},e,t),s={};return s.width=MN(i),s}(w),B=PN(C),R=PN(E),{bottom:L,left:O,right:I,top:D}=$F(h);return{panel:{width:MN(M+2*k),minHeight:MN(g+2*k),paddingBottom:MN(L),paddingLeft:MN(O),paddingRight:MN(I),paddingTop:MN(D),borderColor:A,borderWidth:MN(k),borderRadius:MN(S),backgroundColor:m?`${m}`:"transparent",boxShadow:f?`${y}px ${b}px ${v}px ${x}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)?MN(null==r?void 0:r.spaceRow):"0px"},PN(Tj({},T,null==r?void 0:r.value))),content:{},shapeColumn:{common:P,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 BN.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=BN.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==Jy?void 0:Jy.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(BN.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}}BN.type="tooltipModel";const RN={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},LN={boxSizing:"border-box"},ON={display:"inline-block",verticalAlign:"top"},IN={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},DN={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},FN={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},jN={lineHeight:"normal",boxSizing:"border-box"};class zN extends BN{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,l;if(!(null==t?void 0:t.hasShape)||!t.symbolType)return"";const{symbolType:h,fill:c,stroke:d,hollow:u=!1}=t,p=t.size?e(t.size):"8px",m=t.lineWidth?e(t.lineWidth)+"px":"0px";let f="currentColor";const v=()=>d?e(d):f,y=TN(p),b=t=>new yg({symbolType:t,size:y,fill:!0});let x=b(null!==(i=HN[h])&&void 0!==i?i:h);const S=x.getParsedPath();S.path||(x=b(S.pathStr));const A=x.getParsedPath().path,k=A.toString(),M=A.bounds;let T=`${M.x1} ${M.y1} ${M.width()} ${M.height()}`;if("0px"!==m){const[t,e,i,s]=T.split(" ").map((t=>Number(t))),n=Number(m.slice(0,-2));T=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}if(!c||_(c)||u)return f=u?"none":c?e(c):"currentColor",`\n \n \n \n `;if(g(c)){f=null!==(s="gradientColor"+t.index)&&void 0!==s?s:"";let i="";const h=(null!==(n=c.stops)&&void 0!==n?n:[]).map((t=>``)).join("");return"radial"===c.gradient?i=`\n ${h}\n `:"linear"===c.gradient&&(i=`\n ${h}\n `),`\n \n ${i}\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=""}}const HN={star:"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"};class VN extends BN{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 NN={overflowWrap:"normal",wordWrap:"normal"};class GN extends BN{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(Tj({},ON,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=Tj({},o?DN:IN,Object.assign(Object.assign(Object.assign({height:MN(l)},NN),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 Tj({},FN,Object.assign(Object.assign(Object.assign({height:MN(s)},NN),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 Tj({},jN,Object.assign(Object.assign({height:MN(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 WN extends BN{init(){this.product||(this.product=this.createElement("div",["container-box"])),this.shapeBox||this._initShapeBox(),this.keyBox||this._initKeyBox(),this.valueBox||this._initValueBox()}_initShapeBox(){const t=new GN(this.product,this._option,"shape-box",0);t.init(),this.shapeBox=t,this.children[t.childIndex]=t}_initKeyBox(){const t=new GN(this.product,this._option,"key-box",1);t.init(),this.keyBox=t,this.children[t.childIndex]=t}_initValueBox(){const t=new GN(this.product,this._option,"value-box",2);t.init(),this.valueBox=t,this.children[t.childIndex]=t}setStyle(t){super.setStyle(Tj(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+TN(e)),0);return Object.assign(Object.assign({},t),{width:`${a+CN(this._option.getContainer())}px`,maxHeight:MN(s),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class UN extends BN{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{title:e}=t;(null==e?void 0:e.hasShape)&&(null==e?void 0:e.shapeType)?this.shape||this._initShape():this.shape&&this._releaseShape(),this.textSpan||this._initTextSpan()}_initShape(){const t=new zN(this.product,this._option,0);t.init(),this.shape=t,this.children[t.childIndex]=t}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(){const t=new VN(this.product,this._option,1);t.init(),this.textSpan=t,this.children[t.childIndex]=t}setStyle(t){var e,i,s,n;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),{title:o}=a;super.setStyle(Tj({},RN,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 YN="99999999999999";class KN extends BN{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:YN,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 UN(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 WN(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(Tj({},LN,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 XN=t=>{hz.registerComponentPlugin(t.type,t)};class $N extends kN{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($N.type),this.type=_N.dom,this._tooltipContainer=null==Jy?void 0:Jy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(Jy&&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=EN(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()}))}}$N.type=_N.dom;class qN extends kN{constructor(){super(qN.type),this.type=_N.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 XP({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()}}qN.type=_N.canvas;const ZN=()=>{XN(qN)},JN=(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},QN={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}},tG=(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=Xj([],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 eG(a,n,o)},eG=(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)=>{nb(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=>{nb(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]=QN[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},iG=(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=>{nb(t[e])||(t[e]=0)}))})),t};class sG extends DH{_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 nG=`${hB}_HIERARCHY_DEPTH`,rG=`${hB}_HIERARCHY_ROOT`,aG=`${hB}_HIERARCHY_ROOT_INDEX`;function oG(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function lG(t,e,i){t&&(i.needDefaultSeriesField&&(t[bD]=i.defaultSeriesField),t[_D]=e,t[yD]=i.getKey(t,e,i))}function hG(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function cG(t,e,i,s=0,n,r){void 0===r&&(r=e),lG(t,e,i),t[nG]=s,t[rG]=n||t[i.categoryField],t[aG]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>cG(e,s,i,t[nG]+1,t[rG],r)))}const dG=["appear","enter","update","exit","disappear","normal"];function uG(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 vG(n)&&delete n.type,n.oneByOne&&(n=gG(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:mG,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=Tj({},o[e],a);return vG(n)&&delete n.type,n.oneByOne&&(n=gG(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:mG,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s.state=s.update,s}function pG(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),_G(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 gG(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 mG(t,e){var i,s;return null!==(i=null==t?void 0:t[_D])&&void 0!==i?i:null===(s=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===s?void 0:s.elementIndex}function fG(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 vG(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function _G(t,e){if(y(t))t.forEach(((i,s)=>{t[s]=e(t[s],s),_G(t[s],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),_G(t[i],e)}class yG extends yH{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=EF(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=Pj(R(a,`series.${h}`),h,l,o),d=R(a,`series.${h}_${r}`);return Tj({},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),c(t.stackOffsetSilhouette)&&(this.stack=t.stackOffsetSilhouette||this.stack),p(t.stackValue)&&(this.stack=!0),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=Tj({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>Tj({},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 bG extends bH{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:`${hB}_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=yG,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=function(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)}(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)&&(Dz(this._rawData.dataSet,"invalidTravel",iG),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=Yz(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=Uz(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=Uz(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new sG(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;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){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];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):this._rawStatisticsCache[t]=eG(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t]}}return e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))&&(this._rawStatisticsCache[t].min=$(this._rawStatisticsCache[t].values),this._rawStatisticsCache[t].max=X(this._rawStatisticsCache[t].values)),this._rawStatisticsCache[t]}_statisticViewData(){Dz(this._dataSet,"dimensionStatistics",tG);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&&Xj(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){Dz(this._dataSet,"dimensionStatistics",tG);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=Xj(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&Xj(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)&&(Dz(this._rawData.dataSet,"addVChartProperty",JN),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:oG.bind(this),call:lG}},!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=uG({},pG(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"}}:tb(s)||eb(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=Tj(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=Tj(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:Jz.STATE_HOVER_REVERSE,highlightState:Jz.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:Jz.STATE_SELECTED_REVERSE,state:Jz.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 t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:bD;this.getMarksWithoutRoot().forEach((t=>{const s={},n={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(s[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{n[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:xD,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][i]]:!0===s[t[i]]});const a={};Object.keys(n).forEach((e=>{a[e]=s=>{var n,a;let o;if(Array.isArray(s)){if(0===s.length)return;o=null===(n=r[s[0][i]])||void 0===n?void 0:n[e]}return o=null===(a=r[s[i]])||void 0===a?void 0:a[e],o||t.getAttribute(e,s)}})),this.setMarkStyle(t,a,xD)}))}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 oN(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=null!=i?i:{data:!0}).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((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||Kz(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()}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:bD,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new HF).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return RF(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:bD}}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()}`),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,Tj({},h,d||a[T.name]))}return T}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:yD}_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!==MD&&t!==wD&&t!==kD&&t!==TD||(t=this.getStackValueField()),null!==(e=qj(this.getRawData(),t))&&void 0!==e?e:t}getMarkInfoList(){var t;const e=super.getMarkInfoList();return e.length?e:Object.values(null!==(t=CF[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=>nb(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:bD]}}function xG(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();Dw(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 SG(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}}}bG.mark=ND,bG.transformerConstructor=yG;class AG extends bG{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);Dw(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:`${hB}_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(MD),this.setFieldX2(kD)):(this.setFieldY(MD),this.setFieldY2(kD))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(wD),this.setFieldX2(TD)):(this.setFieldY(wD),this.setFieldY2(TD))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(ED),this.setFieldX2(CD)):(this.setFieldY(ED),this.setFieldY2(CD))}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)&&(xG("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 kG="monotone",MG="linear";class TG{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($D.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:MG,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===kG?"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($D.point,{morph:fG(this._spec,$D.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:`${hB}_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(Pz.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:Jz.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[$D.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(Pz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,Tj({},this._spec[$D.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:Jz.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 wG extends zH{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)&&(Fw(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);let c=this._styleConvert(h);a&&"angle"===l&&(c=this.convertAngleToRadian(c)),this.setAttribute(l,c,e,i,s)})),o&&this.setEnableSegments(o)}}class CG extends wG{constructor(){super(...arguments),this.type=CG.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)===oB.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}CG.type="line";const EG=()=>{hz.registerMark(CG.type,CG),fM(),aM(),kR.registerGraphic(RB.line,Ag),JH()};class PG extends zH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class BG extends PG{constructor(){super(...arguments),this.type=BG.type}}BG.type="symbol";const RG=()=>{hz.registerMark(BG.type,BG),fO()};class LG extends yG{_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 OG extends eV{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function IG(t,e,i,s){switch(t){case r.cartesianBandAxis:return LV(_z(i,["z"]),"band",e);case r.cartesianLinearAxis:return LV(_z(i,["z"]),"linear",e);case r.cartesianLogAxis:return LV(_z(i,["z"]),"log",e);case r.cartesianSymlogAxis:return LV(_z(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return LV(_z(i),void 0,e);case r.polarBandAxis:return OV(i.orient,"band",e);case r.polarLinearAxis:return OV(i.orient,"linear",e);case r.polarAxis:return OV(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=TV(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>mz(t.orient)));let d;d=p(c)?Tj({},IV(c.type)?a:o,l):l;const u=n.find((t=>fz(t.orient)));let g;return g=p(u)?Tj({},jw(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=TV(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>"angle"===t.orient));let d;d=p(c)?Tj({},IV(c.type)?a:o,l):l;const u=n.find((t=>"radius"===t.orient));let g;return g=p(u)?Tj({},jw(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 DG(i,TV(t,e));default:return TV(t,e)}}const DG=(t,e)=>{var i;const s=Tj({},e,e[yz(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class FG extends yH{getTheme(t,e){return IG(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({},$F(e)),{[s]:0}))}}class jG extends SH{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 OG(this)}constructor(e,i){super(e,i),this.name="component",this.modelType="component",this.transformerConstructor=FG,this._delegateEvent=(e,i,s,n=null,r=null)=>{var a,o;i instanceof ec||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 _H({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}}}jG.transformerConstructor=FG;class zG extends zH{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(RB.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}zG.type="component";const HG=()=>{hz.registerMark(zG.type,zG)},VG=t=>t;class NG extends jG{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()?DB.circleAxisGrid:DB.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=uG(null===(o=hz.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 DH(this._option,t)]}collectData(t,e){const i=[];return sB(this._regions,(s=>{var n;let r=this.collectSeriesField(t,s);if(r=y(r)?Dw(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 sB(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=nB(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()})),sB(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(sB(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;tthis._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=az(s=t.domainLine)).startSymbol=az(s.startSymbol),s.endSymbol=az(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 lz(Tj({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:lz(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)=>lz(t[i](e.rawValue,s,e,n,r)):B(t[i])||(e[i]=lz(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 lz(Tj({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:lz(t.tick.style)),t.tick.state&&(i.tick.state=oz(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 lz(Tj({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:lz(t.subTick.style)),t.subTick.state&&(i.subTick.state=oz(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=CV[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?te(p):null,textStyle:Tj({},d,lz(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:lz(h.style)}),h.state&&(i.title.state.shape=oz(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:lz(o.style)}),o.state&&(i.title.state.background=oz(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=oz(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=lz(t.background.style)),t.background.state&&(i.panel.state=oz(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 lz(Tj({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:lz(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:lz(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=wV(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){Fz(this._option.dataSet,"scale",VG),Dz(this._option.dataSet,"ticks",UC);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)}}NG.specKey="axes";const GG=()=>{kR.registerGraphicComponent(IB.lineAxis,((t,e)=>new Cw(t,e))),kR.registerGraphicComponent(IB.circleAxis,(t=>new Rw(t))),kR.registerComponent(LB.axis,FO),kR.registerGraphicComponent(DB.lineAxisGrid,((t,e)=>new qC(t,e))),kR.registerGraphicComponent(DB.circleAxisGrid,((t,e)=>new JC(t,e))),kR.registerComponent(LB.grid,HO),HG(),hz.registerAnimation("axis",(()=>({appear:{custom:Ow},update:{custom:Lw},exit:{custom:Wc}})))},WG=[xV];class UG extends NG{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),sB(this._regions,(t=>{const e=this.getOrient();mz(e)?t.setXAxisHelper(this.axisHelper()):fz(e)?t.setYAxisHelper(this.axisHelper()):vz(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=Tj({x:t.x,y:t.y},this._axisStyle,n);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(Tj({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=mz(this.getOrient()),n=t=>{var e;return(s?!mz(t.getOrient()):mz(t.getOrient()))&&Dw(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=_z(i,["z"]),vz(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(!BV(e))return null;const{axisType:t,componentName:s}=bz(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=>fz(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(!BV(t))return;const{axisType:s,componentName:n}=bz(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=hz.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=[];mz(this.getOrient())?k(e)&&(o=this._inverse?[e-n,s]:[s,e-n]):vz(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(WG.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){mz(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&&!mz(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),!vz(this.getOrient())&&this._spec.innerOffset){const t=this._spec;fz(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=KF(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=KF(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=mz(this.getOrient())?t.fieldX:vz(this.getOrient())?t.fieldZ:t.fieldY,Dw(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:Dw(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&&(mz(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=mz(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 sB(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]:mz(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:vz(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();sB(this._regions,(e=>{mz(t)?(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):fz(t)?(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):vz(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=mz(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=mz(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=Tj(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 DV(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}=PV(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>=YG?10:n>=KG?5:n>=XG?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 qG extends UG{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new TC}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}}qG.type=r.cartesianLinearAxis,qG.specKey="axes",U(qG,$G);const ZG=()=>{GG(),hz.registerComponent(qG.type,qG)};class JG{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=DV(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=>DV(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 QG extends UG{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new rC}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{GG(),hz.registerComponent(QG.type,QG)};class eW extends qG{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),sB(this._regions,(t=>{mz(this.getOrient())?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=Tj({},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 DH(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=>DV(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=>DV(e.value,this._getNormalizedValue([e.value],t))))),s}transformScaleDomain(){}}eW.type=r.cartesianTimeAxis,eW.specKey="axes";class iW extends qG{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new EC}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(){}}iW.type=r.cartesianLogAxis,iW.specKey="axes",U(iW,$G);class sW extends qG{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new PC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}transformScaleDomain(){}}sW.type=r.cartesianSymlogAxis,sW.specKey="axes",U(sW,$G);class nW extends AG{constructor(){super(...arguments),this.type=oB.line,this.transformerConstructor=LG,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(uG(null===(i=hz.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),pG("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=SG(this);this._symbolMark.setAnimationConfig(uG(null===(s=hz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),pG("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]}}nW.type=oB.line,nW.mark=qD,nW.transformerConstructor=LG,U(nW,TG);class rW{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)=>{Kz(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 aW{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)=>{rb(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{Xj(e,[{key:t,operations:Dw(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&&Xj(e,[{key:i.field,operations:Dw(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?NF("colorOrdinal"):NF(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(rb(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),rb(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(!rb(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=Dw(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=Dw(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;Dw(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(Dw(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=Dw(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)));Dw(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 oW{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=Zj(t,!0);for(const e in a)for(const i in a[e].nodes)ez(a[e].nodes[i],t.getStackInverse(),n);if(r)for(const t in a)for(const e in a[t].nodes)tz(a[t].nodes[e]);s&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&Qj(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 lW extends pH{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=sb(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:cB,height:dB},this._viewRect={width:cB,height:dB},this._viewBox={x1:0,y1:0,x2:cB,y2:dB},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=$F(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new Rz(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new rW(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._spec.background&&"object"==typeof this._spec.background&&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 oW(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=function(t){if(!t)return null;if("string"==typeof t)return{fill:t,fillOpacity:1};if("object"!=typeof t)return null;const e=H(t,["x","y","width","height","x1","y1","image"]);return e.background=t.image,e}(this._spec.background);t&&(this._backgroundMark=hz.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({},t),{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=hz.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 bH)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 zH))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof zH)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&&Kz(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=nH(this._spec,this._option,{width:cB,height:dB})),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=RF(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new aW(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){rH(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=RF(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{rH(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{var s,n;const r=i.specKey||i.type,a=null!==(s=this._spec[r])&&void 0!==s?s:{};y(a)?(e[r]=e[r]||{specCount:a.length,componentCount:0},e[r].componentCount++,rH(t,i.updateSpec(null!==(n=a[i.getSpecIndex()])&&void 0!==n?n:{},a))):rH(t,i.updateSpec(a))}));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()];rH(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=XF(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(Jz.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(Jz.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(Jz.STATE_SELECTED)}clearHovered(){this.clearState(Jz.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===Pz.dimensionHover||s===Pz.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>jw(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=>{r?i[t.series.fieldY[0]]=s:i[t.series.fieldX[0]]=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 hW=(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 cW{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);xj(t,r,l.spec),xj(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}));xj(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=hW(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=hW(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(hz.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(hz.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=hz.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=hz.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=hz.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 dW extends cW{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")&&Tj(i,aH(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 uW extends dW{_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),sH(t)}}class pW extends lW{constructor(){super(...arguments),this.transformerConstructor=uW,this.type="line",this.seriesType=oB.line,this._canStack=!0}}pW.type="line",pW.seriesType=oB.line,pW.transformerConstructor=uW;class gW extends wG{constructor(){super(...arguments),this.type=gW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}gW.type="area";const mW=()=>{hz.registerMark(gW.type,gW),fM(),qk(),kR.registerGraphic(RB.area,Ug),JH()};class fW extends oN{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 vW=()=>{hz.registerAnimation("area",qH),ZH(),XH()};class _W extends LG{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=Tj({},m.style,g.style),l.state=Tj({},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 yW extends AG{constructor(){super(...arguments),this.type=oB.area,this.transformerConstructor=_W,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(yW.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===kG?"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 GF(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 GF(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(uG(null===(e=hz.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),pG("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(uG(null===(i=hz.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),pG("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=SG(this);this._symbolMark.setAnimationConfig(uG(null===(s=hz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),pG("point",this._spec,this._markAttributeContext),t))}}initTooltip(){this._tooltipHelper=new fW(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}}}yW.type=oB.area,yW.mark=JD,yW.transformerConstructor=_W,U(yW,TG);class bW extends dW{_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),sH(t)}}class xW extends lW{constructor(){super(...arguments),this.transformerConstructor=bW,this.type="area",this.seriesType=oB.area,this._canStack=!0}}xW.type="area",xW.seriesType=oB.area,xW.transformerConstructor=bW;function SW(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 AW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:SW(t,e)}),kW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:SW(t,e)}),MW={type:"fadeIn"},TW={type:"growCenterIn"};function wW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return MW;case"scaleIn":return TW;default:return AW(t)}}class CW extends zH{constructor(){super(...arguments),this.type=CW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}CW.type="rect";const EW=()=>{hz.registerMark(CW.type,CW),gO(),uO.useRegisters([VI,NI,GI,WI,zI,HI])};function PW(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[GD]):this._spec.barMinHeight?this._calculateRectPosition(t,!1):GF(this._dataToPosX(t),e),this._getBarXEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[WD]):GF(this._dataToPosX1(t),e),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[UD]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):GF(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[YD]):GF(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({},LW.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{morph:fG(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(LW.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(Dz(this._option.dataSet,"addVChartProperty",JN),s){const t=([t],{scaleDepth:e})=>{var i;let s=[{}];const n=this.getDimensionField(),r=u(e)?n.length:Math.min(n.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};Dz(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:oG.bind(this),call:lG}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new sG(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=YD,s=UD,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=WD,s=GD,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=Zj(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)PW(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=GF(this[n](t),o),d=GF(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[kD],n=t[MD],r=t[TD],h=t[wD];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]),{[kD]:i,[MD]:s}),a?{[TD]:o,[wD]:l}:void 0);t.push(Tg(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=>GF(this._dataToPosY(t),a),y1:t=>GF(this._dataToPosY1(t),a)}:{y:t=>GF(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=>GF(this._dataToPosX(t),r),x1:t=>GF(this._dataToPosX1(t),r)}:{x:t=>GF(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=SG(this);this._barMark.setAnimationConfig(uG(null===(e=hz.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),pG(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;if(void 0!==this._spec.barWidth&&r===n)return ZF(this._spec.barWidth,a);const o=void 0!==this._spec.barMinWidth,l=void 0!==this._spec.barMaxWidth;let h=a;return o&&(h=Math.max(h,ZF(this._spec.barMinWidth,a))),l&&(h=Math.min(h,ZF(this._spec.barMaxWidth,a))),h}_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=ZF(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=Dw(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}}LW.type=oB.bar,LW.mark=KD,LW.transformerConstructor=RW;const OW=()=>{iI(),EW(),hz.registerAnimation("bar",((t,e)=>({appear:wW(t,e),enter:AW(t,!1),exit:kW(t,!1),disappear:kW(t)}))),tW(),ZG(),hz.registerSeries(LW.type,LW)};class IW extends dW{_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),sH(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 DW extends lW{constructor(){super(...arguments),this.transformerConstructor=IW,this.type="bar",this.seriesType=oB.bar,this._canStack=!0}}DW.type="bar",DW.seriesType=oB.bar,DW.transformerConstructor=IW;class FW extends zH{constructor(){super(...arguments),this.type=FW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}FW.type="rect3d";class jW extends LW{constructor(){super(...arguments),this.type=oB.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d"}}jW.type=oB.bar3d,jW.mark=XD;class zW extends IW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}class HW extends DW{constructor(){super(...arguments),this.transformerConstructor=zW,this.type="bar3d",this.seriesType=oB.bar3d}}HW.type="bar3d",HW.seriesType=oB.bar3d,HW.transformerConstructor=zW;const VW=[10,20],NW=Pw.Linear,GW="circle",WW=Pw.Ordinal,UW=["circle","square","triangle","diamond","star"],YW=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class KW extends yG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class XW extends AG{constructor(){super(...arguments),this.type=oB.scatter,this.transformerConstructor=KW,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=`${hB}_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=`${hB}_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:NW,defaultRange:VW},"size")}getShapeAttribute(t,e){return u(e)?GW:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:WW,defaultRange:UW},"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(XW.mark.point,{morph:fG(this._spec,XW.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=SG(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(uG(null===(i=hz.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),pG("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:GW},Jz.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},Jz.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},Jz.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},Jz.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},Jz.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]}}XW.type=oB.scatter,XW.mark=ZD,XW.transformerConstructor=KW;const $W=()=>{RG(),hz.registerAnimation("scatter",((t,e)=>Object.assign({appear:YW(0,e)},YH))),tW(),ZG(),hz.registerSeries(XW.type,XW)};class qW extends dW{_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 ZW extends lW{constructor(){super(...arguments),this.transformerConstructor=qW,this.type="scatter",this.seriesType=oB.scatter,this._canStack=!0}}ZW.type="scatter",ZW.seriesType=oB.scatter,ZW.transformerConstructor=qW;Ln();const JW={},QW=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function tU(t,e){t&&_(t)||lb("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(JW[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 QW.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}(i,e)),JW[i]||null}const eU={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(eU).forEach((t=>{tU(t,eU[t])}));const iU="Feature",sU="FeatureCollection";function nU(t){const e=Y(t);return 1===e.length?e[0]:{type:sU,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===sU?t.features:Y(t).filter((t=>!u(t))).map((t=>t.type===iU?t:{type:iU,geometry:t}))}(e))),[])}}const rU=QW.concat(["pointRadius","fit","extent","size"]);function aU(t,e){let i=[];return t?(Object.keys(t).forEach((s=>{rU.includes(s)&&(i=i.concat(dR(t[s],e)))})),i):i}let oU=class extends $R{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(dR(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(dR(t,this.view)),this.commit(),this}size(t){return u(this.spec.size)||this.detach(dR(this.spec.size,this.view)),this.spec.size=t,this.attach(dR(t,this.view)),this.commit(),this}extent(t){return u(this.spec.extent)||this.detach(dR(this.spec.extent,this.view)),this.spec.extent=t,this.attach(dR(t,this.view)),this.commit(),this}fit(t){return u(this.spec.fit)||this.detach(dR(this.spec.fit,this.view)),this.spec.fit=t,this.attach(dR(t,this.view)),this.commit(),this}configure(t){return this.detach(aU(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(aU(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=tU((t||"mercator").toLowerCase());return e||lb("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),QW.forEach((t=>{u(this.spec[t])||function(t,e,i){d(t[e])&&t[e](i)}(this.projection,t,pR(this.spec[t],e,tU))})),u(this.spec.pointRadius)||this.projection.path.pointRadius(pR(this.spec.pointRadius,e,tU)),!(u(this.spec.fit)||u(this.spec.extent)&&u(this.spec.size))){const t=nU(pR(this.spec.fit,e,tU));this.spec.extent?this.projection.fitExtent(pR(this.spec.extent,e,tU),t):this.spec.size&&this.projection.fitSize(pR(this.spec.size,e,tU),t)}return this.projection}output(){return this.projection}};const lU=(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 hU extends bG{constructor(){super(...arguments),this.type=oB.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=`${hB}_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 cU=`${hB}_MAP_LOOK_UP_KEY`,dU=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[_D]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[cU]=e.nameMap[n]:t[cU]=n})),t.features);class uU extends oN{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 pU extends zH{constructor(){super(...arguments),this.type=pU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}pU.type="path";const gU=()=>{hz.registerMark(pU.type,pU),pO()};class mU{constructor(t){this.projection=tU(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 fU{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 vU{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 _U(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:fU}:tb(e)||eb(e)?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:vU}:null}const yU={debounce:xt,throttle:St};class bU{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=tb(this._renderMode)||eb(this._renderMode),_U(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return _U(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;u(n)||De({x:r,y:a},this._getRegionOrSeriesLayout(e),!1)&&(i&&i({zoomDelta:n,zoomX:r,zoomY:a},s),this._eventObj.emit("zoom",{scale:s.zoomDelta,scaleCenter:{x:s.zoomX,y:s.zoomY},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,yU[o]((t=>{this._zoomableTrigger.clearZoom()}),l)),h.on(...c,yU[o]((t=>{this._zoomEventDispatch(t,i,s)}),l))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||_U(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||_U(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,yU[o]((t=>{this._zoomableTrigger.clearScroll()}),l)),h.on(...c,yU[o]((t=>this._scrollEventDispatch(t,i,s)),l))}initScrollEventOfSeries(t,e,i){_U(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||_U(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||_U(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||_U(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=yU[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)}),l),_=yU[o]((t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1;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 xU(t,e){return`${hB}_${e}_${t}`}class SU extends jG{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:xU(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),e&&(e.zoomDelta=l),this.zoom(l,[t.zoomX,t.zoomY]),l},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=Tj(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},s=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,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 mU(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===oB.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),sB(this._regions,(t=>{var e;if(t.type===oB.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===oB.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[cU],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}}SU.type=r.geoCoordinate,U(SU,bU);const AU=()=>{hz.registerComponent(SU.type,SU)};class kU extends yG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class MU extends hU{constructor(){super(...arguments),this.type=oB.map,this.transformerConstructor=kU,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 !`),jz.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),Dz(this._dataSet,"copyDataView",Wz),Dz(this._dataSet,"map",dU),Dz(this._dataSet,"lookup",lU);const i=jz.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:Xz.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:cU,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 sG(this._option,s)}initMark(){this._pathMark=this._createMark(MU.mark.area,{morph:fG(this._spec,MU.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:bD])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:bD]):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(uG(null===(t=hz.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),pG("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new uU(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[_D]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[_D],{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 _D}getActiveMarks(){return[this._pathMark]}}MU.type=oB.map,MU.mark=sF,MU.transformerConstructor=kU;const TU=()=>{kR.registerGrammar("projection",oU,"projections"),AU(),gU(),hz.registerSeries(MU.type,MU),hz.registerImplement("registerMap",Vz),hz.registerImplement("unregisterMap",Nz),$H()},wU=(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,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},a=o[t];if(null==a||a.forEach(((t,e)=>{e===a.length-1?t[RD]=!0:delete t[RD]})),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=CU([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}=EU(m,i,s,n,u);i.start=f,i.end=v;let _=v-f;return p.forEach((t=>{t[c]=+f,t[d]=Kt(t[c],+t[h]),f=t[d],_=Xt(_,+t[h])})),g.forEach((t=>{t[c]=+f,t[d]=Kt(t[c],_),t[h]=_})),Object.assign(Object.assign({},i),{lastIndex:e})}(a,t,n,r,h,l,i,e,o),void r.push(n)}h=CU(a,t,n,r,h,l,i,e),r.push(n)})),r};function CU(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}=EU(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);e||(t[h]=+i.end,t[c]=Kt(t[h],+t[l]),i.end=t[c]),i.isTotal=e,(u(p)||p===pD)&&(t[pD]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function EU(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?Xy("total.collectCountField error"):n=e[a].start;o<0?Xy("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 PU=(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},BU={type:"fadeIn"},RU={type:"growCenterIn"};function LU(t,e){switch(e){case"fadeIn":return BU;case"scaleIn":return RU;default:return AW(t,!1)}}class OU extends zH{constructor(){super(...arguments),this.type=OU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}OU.type="rule";const IU=()=>{hz.registerMark(OU.type,OU),mO()},DU=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:FU(t.map((t=>t.latestData)).flat(),e.fields,i)}};function FU(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)=>FU(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class jU{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"}),Dz(e,"dimensionTree",DU),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 zU extends RW{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel")}}const HU={rect:UU,symbol:GU,arc:KU,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=GU(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1);return e},stackLabel:XU,line:$U,area:$U,rect3d:UU,arc3d:KU,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function VU(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}=wV(i,s,o.text,e);return h&&(o.text=h(...c,{series:a})),o}function NU(t){return d(t)?e=>t(e.data):t}function GU(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=NU(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:WU(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function WU(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function UU(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=NU(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:YU(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function YU(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 KU(t){var e;const{labelSpec:i}=t,s=null!==(e=NU(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 XU(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=VU(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),mp(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 $U(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 qU extends LW{constructor(){super(...arguments),this.type=oB.waterfall,this.transformerConstructor=zU,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 jU(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=pD)}getSeriesKeys(){return this._seriesField===pD?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),Dz(this._dataSet,"waterfallFillTotal",PU),Dz(this._dataSet,"waterfall",wU),(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=Uz(this.getViewData(),this._dataSet,{name:`${hB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new sG(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:kD,endAs:MD,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=SG(this);this._barMark.setAnimationConfig(uG(null===(i=hz.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),pG("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(uG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),pG("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(qU.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){if(!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible))return super.initLabelMarkStyle(t),void(this._labelMark=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 XU(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?GF(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):GF(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))}}qU.type=oB.waterfall,qU.mark=uF,qU.transformerConstructor=zU;const ZU=()=>{IU(),EW(),hz.registerAnimation("waterfall",((t,e)=>({appear:LU(t,e),enter:AW(t,!1),exit:kW(t,!1),disappear:kW(t,!1)}))),$H(),tW(),ZG(),hz.registerSeries(qU.type,qU)},JU=`${hB}_BOX_PLOT_OUTLIER_VALUE`;var QU;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(QU||(QU={}));const tY=(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={[JU]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class eY extends oN{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===QU.OUTLIER)return this.series.getOutliersField();if(t===QU.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case QU.MIN:return this.series.getMinField();case QU.MAX:return this.series.getMaxField();case QU.MEDIAN:return this.series.getMedianField();case QU.Q1:return this.series.getQ1Field();case QU.Q3:return this.series.getQ3Field();case QU.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===QU.OUTLIER)return e[JU];if(t===QU.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case QU.MIN:return e[this.series.getMinField()];case QU.MAX:return e[this.series.getMaxField()];case QU.MEDIAN:return e[this.series.getMedianField()];case QU.Q1:return e[this.series.getQ1Field()];case QU.Q3:return e[this.series.getQ3Field()];case QU.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[JU])}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.getContentKey(QU.OUTLIER),value:this.getContentValue(QU.OUTLIER),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(QU.MAX),value:this.getContentValue(QU.MAX),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(QU.Q3),value:this.getContentValue(QU.Q3),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(QU.MEDIAN),value:this.getContentValue(QU.MEDIAN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(QU.Q1),value:this.getContentValue(QU.Q1),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(QU.MIN),value:this.getContentValue(QU.MIN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(QU.SERIES_FIELD),value:this.getContentValue(QU.SERIES_FIELD),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]}}}class iY extends zH{constructor(){super(...arguments),this.type=iY.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}}iY.type="boxPlot";const sY=()=>{hz.registerMark(iY.type,iY),kR.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(SO).registerChannelEncoder("x",((t,e,i,s,n,r)=>r&&yb(r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,s,n,r)=>r&&yb(r.direction)?{shaft:{y:e,y1:e}}:null)).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&yb(r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&yb(r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&yb(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&&yb(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&&yb(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&&yb(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}}))),kR.registerAnimationType("boxplotScaleIn",AO),kR.registerAnimationType("boxplotScaleOut",kO),_O(),gO(),mO(),kR.registerGlyph("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(TO).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&yb(r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&yb(r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&yb(r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&yb(r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&yb(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}}))),kR.registerAnimationType("barBoxplotScaleIn",wO),kR.registerAnimationType("barBoxplotScaleOut",CO),_O(),gO(),mO()};class nY extends AG{constructor(){super(...arguments),this.type=oB.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(nY.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(nY.mark.outlier,{progressive:t,key:_D,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,Jz.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"},Jz.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=>GF(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>GF(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>GF(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>GF(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>GF(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},Jz.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=>GF(e(this.getDatumPositionValues(t,JU),{bandPosition:this._bandPosition}),s)}:{x:this.dataToPositionX.bind(this),y:t=>GF(e(this.getDatumPositionValues(t,JU),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,Jz.STATE_NORMAL,t.AttributeLevel.Series)}}initData(){if(super.initData(),!this._data)return;Dz(this._dataSet,"foldOutlierData",tY),Dz(this._dataSet,"addVChartProperty",JN);const t=new ya(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${hB}_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:oG.bind(this),call:lG}},!1),this._outlierDataView=new sG(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=SG(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=hz.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(pG("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(uG(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(uG(null===(a=hz.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new eY(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]}}nY.type=oB.boxPlot,nY.mark=pF;class rY extends zH{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=rY.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})}}rY.type="text";const aY=()=>{hz.registerMark(rY.type,rY),vO(),fM(),gM(),kR.registerGraphic(RB.richtext,zg)};function oY(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 lY extends oN{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 hY=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),cY={type:"fadeIn"},dY=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function uY(t,e){return"fadeIn"===e?cY:hY(t)}class pY extends RW{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 gY extends LW{constructor(){super(...arguments),this.type=oB.rangeColumn,this._barMarkType="rect",this._barName=oB.bar,this.transformerConstructor=pY}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(gY.mark.bar,{morph:fG(this._spec,gY.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(gY.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(gY.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}});oY(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}});oY(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=SG(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(uG(null===(i=hz.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),pG("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(uG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),pG("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(uG(null===(n=hz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),pG("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new lY(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)}}gY.type=oB.rangeColumn,gY.mark=yF,gY.transformerConstructor=pY;const mY=()=>{EW(),aY(),hz.registerAnimation("rangeColumn",((t,e)=>({appear:uY(t,e),enter:hY(t),exit:dY(t),disappear:dY(t)}))),$H(),tW(),ZG(),hz.registerSeries(gY.type,gY)};class fY extends gY{constructor(){super(...arguments),this.type=oB.rangeColumn3d,this._barMarkType="rect3d",this._barName=oB.bar3d}}fY.type=oB.rangeColumn3d,fY.mark=bF;class vY extends oN{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 _Y extends yW{constructor(){super(...arguments),this.type=oB.rangeArea}initMark(){var t;const{customShape:e,stateSort:i}=null!==(t=this._spec.area)&&void 0!==t?t:{};this._areaMark=this._createMark(_Y.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 vY(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))}}_Y.type=oB.rangeArea,_Y.mark=kF;class yY extends bG{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=EB,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:[]};Dw(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:[]};Dw(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)&&xG(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 bY=(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[_B],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[_B]*t;g(e,b,i),b+=i}))}return 0!==m&&(i[i.length-1][l]=r),i};function xY(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const SY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:xY(t,!0,qz.appear)}),AY={type:"fadeIn"},kY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:xY(t,!0,qz.enter)}),MY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:xY(t,!0,qz.exit)}),TY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:xY(t,!0,qz.exit)});function wY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return AY;case"growRadius":return SY(Object.assign(Object.assign({},t),{growField:"radius"}));default:return SY(Object.assign(Object.assign({},t),{growField:"angle"}))}}class CY extends zH{constructor(t,e){super(t,e),this.type=EY.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[AB])[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 EY extends CY{constructor(){super(...arguments),this.type=EY.type}}EY.type="arc";const PY=()=>{fM(),Xk(),kR.registerGraphic(RB.arc,Xg),uO.useRegisters([QI,tD,ZI,JI]),hz.registerMark(EY.type,EY)};class BY extends yG{_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=Tj({},this._theme,i,t);const n=(t,e)=>Tj({},"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 RY extends yY{constructor(){super(...arguments),this.transformerConstructor=BY,this._pieMarkName="pie",this._pieMarkType="arc",this._startAngle=TB,this._endAngle=wB,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this.dataToCentralPosition=t=>{const e=t[AB];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;Dz(this._dataSet,"pie",bY),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:bB,asEndAngle:xB,asRatio:yB,asMiddleAngle:AB,asRadian:MB,asQuadrant:kB,asK:SB}},!1);const e=new ya(this._dataSet,{name:`${hB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new sG(this._option,e)}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},RY.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{morph:fG(this._spec,this._pieMarkName),defaultMorphElementKey:this._seriesField,key:yD,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 aB(bB)(t)}endAngleScale(t){return aB(xB)(t)}initMarkStyle(){const e=this._pieMark;e&&this.setMarkStyle(e,{x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:WF(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:WF(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:aB(mB).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[AB];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===qz.appear)return this._startAngle;if(i===qz.disappear)return this._endAngle;const n=[qz.disappear,qz.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[_D];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[_D]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[_D])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[_D])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+se({x:0,y:0},a,e[AB]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+se({x:0,y:0},a,e[AB]).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[AB]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+se({x:0,y:0},a,e[AB]).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]}}RY.transformerConstructor=BY,RY.mark=tF;class LY extends RY{constructor(){super(...arguments),this.type=oB.pie}}LY.type=oB.pie;const OY=()=>{PY(),hz.registerAnimation("pie",((t,e)=>({appear:wY(t,e),enter:kY(t),exit:MY(t),disappear:TY(t)}))),hz.registerSeries(LY.type,LY)};class IY extends CY{constructor(){super(...arguments),this.type=IY.type,this._support3d=!0}}IY.type="arc3d";class DY extends BY{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class FY extends RY{constructor(){super(...arguments),this.type=oB.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=DY}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[AB];return"inside"===i.position?ee(e):0},this.setMarkStyle(e,Object.assign(Object.assign({},s),{z:100}),void 0,t.AttributeLevel.Mark)}}FY.type=oB.pie3d,FY.mark=eF,FY.transformerConstructor=DY;const jY=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)=>e.getGraphicAttribute("innerRadius")},outerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("outerRadius")}}}},zY={type:"fadeIn"},HY=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),VY=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),NY=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function GY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return zY;case"growAngle":return jY(Object.assign(Object.assign({},t),{growField:"angle"}));default:return jY(Object.assign(Object.assign({},t),{growField:"radius"}))}}class WY extends yY{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(MD),this.setInnerRadiusField(kD)}setValueFieldToPercent(){this.setRadiusField(wD),this.setInnerRadiusField(TD)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}class UY extends yG{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}const YY=(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:CB,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:EB,layoutRadius:e.layoutRadius}};class KY extends NG{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(!RV(e))return null;const{axisType:i,componentName:s,startAngle:n,endAngle:r,center:a,outerRadius:o,layoutRadius:l}=YY(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(!RV(e))return;const{axisType:a,componentName:o,startAngle:l,endAngle:h,center:c,outerRadius:d,layoutRadius:u}=YY(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=hz.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=TB,this._endAngle=wB,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),sB(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:EV(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(){sB(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 Dw(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:Dw(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:KF(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:KF(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=>DV(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=EB,e=0;const i=this.getChart().getSpec();return sB(this.getRegions(),(s=>{const n=s;if(r=n.type,[oB.rose,oB.radar,oB.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(Tj({},this._axisStyle,s)),this._gridMark){this._gridMark.getProduct().encode(Tj({},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)}}KY.type=r.polarAxis,KY.specKey="axes";class XY extends KY{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new TC}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}}XY.type=r.polarLinearAxis,XY.specKey="axes",U(XY,$G);const $Y=()=>{GG(),hz.registerComponent(XY.type,XY)};class qY extends KY{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new rC}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(){}}qY.type=r.polarBandAxis,qY.specKey="axes",U(qY,JG);const ZY=()=>{GG(),hz.registerComponent(qY.type,qY)};class JY extends WY{constructor(){super(...arguments),this.type=oB.rose,this.transformerConstructor=UY,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(JY.mark.rose,{morph:fG(this._spec,JY.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=>GF(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=GF(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(uG(null===(i=hz.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),pG("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}JY.type=oB.rose,JY.mark=iF,JY.transformerConstructor=UY;const QY=()=>{hz.registerSeries(JY.type,JY),PY(),hz.registerAnimation("rose",((t,e)=>({appear:GY(t,e),enter:HY(t),exit:VY(t),disappear:NY(t)}))),ZY(),$Y()};class tK extends mc{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);k(t*e)||(this.valid=!1),this._fromAngle=t,this._fromRadius=e;const{angle:i,radius:s}=this._pointToCoord(this.to);k(i*s)||(this.valid=!1),this._toAngle=i,this._toRadius=s}onUpdate(t,e,i){if(!1!==this.valid)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 eK extends Hc{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}),r=re(s.angle),a=re(n.angle),o=this._pointToCoord(e),l=this._pointToCoord({x:e.x1,y:e.y1}),h=re(o.angle),c=re(l.angle),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 iK=t=>({type:"in"===t?"fadeIn":"fadeOut"});function sK(t,e,i){return"fadeIn"===e?iK(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function nK(t,e,i){return"fadeIn"===e?iK(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 rK=(t,e)=>({custom:Nc,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 aK extends WY{constructor(){super(...arguments),this.type=oB.radar,this.transformerConstructor=LG,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(aK.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:MG,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):TB,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(uG(null===(s=hz.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),pG("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=hz.getAnimationInKey(e);t.setAnimationConfig(uG(null==i?void 0:i(n,r),pG(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}}}aK.type=oB.radar,aK.mark=QD,aK.transformerConstructor=LG,U(aK,TG);const oK=()=>{hz.registerSeries(aK.type,aK),sI(),mW(),EG(),RG(),hz.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:sK(t,e,"in"),enter:sK(t,e,"in"),exit:sK(t,e,"out"),disappear:"clipIn"===e?void 0:sK(t,e,"out"),update:[{options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:eK,customParameters:t,duration:UH.update.duration,easing:UH.update.easing}]}))),hz.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:nK(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:nK(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:tK,customParameters:t,duration:UH.update.duration,easing:UH.update.easing}]}))),hz.registerAnimation("radarGroup",((t,e)=>({appear:rK(t,"in"),disappear:rK(t,"out")}))),Xk(),ZY(),$Y()};class lK extends oN{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 hK=(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},cK={fill:"#bbb",fillOpacity:.2};class dK extends AG{constructor(){super(...arguments),this.type=oB.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]])),Dz(this._option.dataSet,"objFlat",hK),Dz(this._option.dataSet,"copyDataView",Wz),Fz(this._option.dataSet,"dataview",ga),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:Xz.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(Tj(cK,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(dK.mark.group),this._containerMark=this._createMark(dK.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(dK.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(dK.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(dK.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(dK.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(dK.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(dK.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:bD}}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 HF).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:bD}}initTooltip(){this._tooltipHelper=new lK(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]}}dK.type=oB.dot,dK.mark=oF;class uK extends oN{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 pK=(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 gK extends AG{constructor(){super(...arguments),this.type=oB.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(),Dz(this._option.dataSet,"linkDotInfo",pK),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:Xz.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(gK.mark.group),this._containerMark=this._createMark(gK.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(gK.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(gK.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:bD}}initInteraction(){const t=[];this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new uK(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]}}gK.type=oB.link,gK.mark=aF;class mK extends yY{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()?kD:LD],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()?MD: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):TB;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?te(r):wB,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=GF(this.angleAxisHelper.dataToPosition([t[kD]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=GF(this.angleAxisHelper.dataToPosition([t[MD]]),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(mK.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 Xg(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[Tg({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 _K=()=>{hz.registerAnimation("circularProgress",((t,e)=>({appear:vK(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class yK extends yG{constructor(){super(...arguments),this._supportStack=!0}}class bK extends mK{constructor(){super(...arguments),this.type=oB.circularProgress,this.transformerConstructor=yK,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(bK.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(bK.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()?kD:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?MD: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(uG(null===(i=hz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),pG("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(uG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),pG("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}bK.type=oB.circularProgress,bK.mark=rF,bK.transformerConstructor=yK;function xK(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const SK=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:xK(t)}),AK={type:"fadeIn"};function kK(t,e){return!1===e?{}:"fadeIn"===e?AK:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:xK(t)}))(t)}class MK extends oN{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 TK extends AG{constructor(){super(...arguments),this.type=oB.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(TK.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 GF(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 GF(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 GF(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 GF(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(TK.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 GF(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 GF(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(TK.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=GF(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(Tg({x:i,y:0,height:r,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=GF(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(Tg({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(uG(null===(i=hz.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),pG("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(uG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),pG("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new MK(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}TK.type=oB.linearProgress,TK.mark=dF;const wK=()=>{EW(),hz.registerAnimation("linearProgress",((t,e)=>({appear:kK(t,e),enter:{type:"grow"},disappear:SK(t)}))),$H(),hz.registerSeries(TK.type,TK)},CK=[0],EK=[20,40],PK=[200,500],BK={shrink:!1,enlarge:!1,fontSizeLimitMin:0},RK=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],LK=`${hB}_WORD_CLOUD_WEIGHT`,OK=`${hB}_WORD_CLOUD_TEXT`;class IK extends bG{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=EK}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:PK,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:CK,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)?OK:this._nameField,this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:BK},this._spec.wordCloudConfig),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:CK,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=!RK.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(IK.mark.word,{key:yD,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(uG(hz.getAnimationInKey("wordCloud")(n,s),pG("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 HF).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:bD])}}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 TC,o=this._fontWeightRange;if(r){const[e,i]=pb(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:LK,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:OK,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:Qy(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[r,a],shape:this._maskShape,dataIndexKey:yD,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:LK}: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:yD,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:LK}: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)}}IK.mark=lF;function DK(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)||UH.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 jK(){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 zK(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 HK=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function VK(t){return d(t)?t:function(){return t}}class NK{constructor(t){var e,i,s;switch(this.options=z({},NK.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=(s=this.options.shape,FK[s]?FK[s]():FK.circle()),this.getText=null!==(e=VK(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=VK(this.options.fontWeight),this.getTextFontSize=VK(this.options.fontSize),this.getTextFontStyle=VK(this.options.fontStyle),this.getTextFontFamily=VK(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>HK(10,50);break;case"random-light":this.getTextColor=()=>HK(50,90);break;default:this.getTextColor=VK(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 WK extends NK{constructor(t){var e;super(z({},WK.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<=WK.defaultOptions.minFontSize&&(this.options.minFontSize=WK.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=GK[this.options.spiral])&&void 0!==e?e:GK.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=VK(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}=zK(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(P_.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(XK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(KK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}XK(p,this._size)&&(p=$K(p,this._size))}else if(XK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||YK(p,i))&&(!i||!UK(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 UK(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 YK(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,XK=(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 $K(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}=zK(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)}ZK.defaultOptions={enlarge:!1};const QK={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},tX=(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?eX(t.fontFamily):"sans-serif",d=t.fontStyle?eX(t.fontStyle):"normal",u=t.fontWeight?eX(t.fontWeight):"normal",p=t.rotate?eX(t.rotate):0,g=eX(t.text),m=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",f=t.padding?eX(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||QK,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?eX(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=sX(nX(t,l),C);w=i=>e(t(i))}let E=WK;"fast"===t.layoutType?E=ZK:"grid"===t.layoutType&&(E=qK);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()},eX=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],iX=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),sX=(t,e)=>{if(t[0]===t[1])return t=>e[0];const i=iX(t[0]),s=iX(t[1]),n=Math.min(i,s),r=Math.max(i,s);return t=>(iX(t)-n)/(r-n)*(e[1]-e[0])+e[0]},nX=(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 rX(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{kR.registerTransform("wordcloud",{transform:tX,markPhase:"beforeJoin"},!0),aY(),hz.registerAnimation("wordCloud",((t,e)=>({appear:DK(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),hz.registerSeries(aX.type,aX)};(class extends IK{constructor(){super(...arguments),this.type=oB.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(IK.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(uG(null===(e=hz.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}})),pG("word",this._spec,this._markAttributeContext)))}}).type=oB.wordCloud3d;const lX=(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},hX=(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},cX=`${hB}_FUNNEL_TRANSFORM_RATIO`,dX=`${hB}_FUNNEL_REACH_RATIO`,uX=`${hB}_FUNNEL_HEIGHT_RATIO`,pX=`${hB}_FUNNEL_VALUE_RATIO`,gX=`${hB}_FUNNEL_LAST_VALUE_RATIO`,mX=`${hB}_FUNNEL_NEXT_VALUE_RATIO`,fX=`${hB}_FUNNEL_LAST_VALUE`,vX=`${hB}_FUNNEL_CURRENT_VALUE`,_X=`${hB}_FUNNEL_NEXT_VALUE`,yX=`${hB}_FUNNEL_TRANSFORM_LEVEL`,bX=20;class xX extends oN{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[dX])).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 SX extends zH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class AX extends SX{constructor(){super(...arguments),this.type=AX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}AX.type="polygon";const kX=()=>{hz.registerMark(AX.type,AX),fM(),cM(),kR.registerGraphic(RB.polygon,Zg),uO.useRegisters([UI,YI])};class MX extends yG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class TX extends bG{constructor(){super(...arguments),this.type=oB.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=MX,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;Dz(this._dataSet,"funnel",lX),Dz(this._dataSet,"funnelTransform",hX);const t=new ya(this._dataSet,{name:`${hB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new sG(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:vX,asTransformRatio:cX,asReachRatio:dX,asHeightRatio:uX,asValueRatio:pX,asNextValueRatio:mX,asLastValueRatio:gX,asLastValue:fX,asNextValue:_X,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:yX}})}initMark(){var t,e,i,s,n,r,a,o,l,h,c,d;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},TX.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,morph:fG(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({},TX.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(TX.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(TX.mark.outerLabelLine,{themeSpec:e,markSpec:t,depend:[this._funnelOuterLabelMark.label],noSeparateStyle:!0})}}initTooltip(){this._tooltipHelper=new xX(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*aB(dX).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(uG(null===(s=hz.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),pG("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(uG(hz.getAnimationInKey("fadeInOut")(),pG(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(uG(hz.getAnimationInKey("funnel")({},o),pG(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(uG(null===(a=hz.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),pG("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[gX])/2:this._getSecondaryAxisLength(t[pX])/2,n=this._getSecondaryAxisLength(t[pX])/2):(s=this._getSecondaryAxisLength(t[pX])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[mX])/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[yX])}_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[yD]===t[yD]));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?bX: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{kX(),aY(),IU(),hz.registerSeries(TX.type,TX),hz.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},KH))),hz.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Gc,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Gc,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),$H()};class CX extends SX{constructor(){super(...arguments),this.type=CX.type}}CX.type="pyramid3d";class EX extends MX{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class PX extends TX{constructor(){super(...arguments),this.type=oB.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=EX}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},PX.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({},PX.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(PX.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(PX.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())}}PX.type=oB.funnel3d,PX.mark=cF,PX.transformerConstructor=EX;const BX=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},RX=t=>{const e=t.mark.elements.filter((t=>t.diffState===BB.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}))},LX=(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]},OX=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=RX(i),a=LX(r,s,n);return BX(e.startAngle,a)*(n-s)+s},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=RX(i),a=LX(r,s,n);return BX(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}}}),IX=t=>{const e=$(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),i=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[e,i]},DX=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=RX(i),a=IX(r);return BX(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=RX(i),a=IX(r);return BX(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}}}),FX=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},jX=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):jX(t.children,e,i)))})),e};function zX(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=NX(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}},GX=(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=GX(t.children,e,t,n))})),s},WX=(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=WX(t.children,e,t,n)),n=e(t,s,i,n)})),n},UX={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:zX,slice:HX,sliceDice:function(t,e,i,s,n){(t.depth%2==1?HX:zX)(t,e,i,s,n)}};class YX{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({},YX.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?cb(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?VX(this.options.aspectRatio):null!==(e=UX[this.options.splitType])&&void 0!==e?e:UX.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=NX(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)}))}}YX.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const KX=(t,e)=>{const i=new YX(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 jX(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},XX={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class $X{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];zX(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),XX);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({},$X.defaultOpionts,t):Object.assign({},$X.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?cb(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+mb(this.options.center[0],t.width),s=t.y0+mb(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=>mb(t,n))):mb(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>mb(t,n))):mb(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=mb(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=NX(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)}}}$X.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const qX=4294967296;function ZX(t,e){let i,s;if(t$(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function t$(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 n$(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 r$(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 a$(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 o$(t){return{_:t,next:null,prev:null}}function l$(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];n$(n,s,r);let a,o,l,h,c,d,u,p=o$(s),g=o$(n),m=o$(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=NX(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)%qX)/qX}(),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:u$.defaultOpionts.nodeSort;GX([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)GX([o],h$(h)),WX([o],c$(this._getPadding,.5,a)),GX([o],d$(1,this._maxDepth));else{const t=Math.min(s.width,s.height);GX([o],h$(u$.defaultOpionts.setRadius)),WX([o],c$(ub,1,a)),c&&WX([o],c$(this._getPadding,o.radius/t,a)),GX([o],d$(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}u$.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const p$=(t,e={})=>{if(!t)return[];const i=[];return jX(t,i,e),i},g$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new $X(i).layout(t,{width:s,height:n})};class m$ extends oN{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var f$;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(f$||(f$={}));const v$=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===f$.DrillDown){return Y(sz(t,n,s,"children"))}if(i.type===f$.DrillUp){const e=nz(t,n,s,"children");if(e)return Y(e)}return t};class _${_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=_U(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;Dz(t,"drillFilter",v$),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:f$.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:f$.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:f$.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:f$.DrillUp},model:this}),r}}class y$ extends yY{constructor(){super(...arguments),this.type=oB.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:rG),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:yD},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),Dz(this._dataSet,"sunburstLayout",g$),Dz(this._dataSet,"flatten",p$),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:nG,operations:["max","min","values"]},{key:rG,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(Dz(t.dataSet,"addVChartProperty",JN),t.transform({type:"addVChartProperty",options:{beforeCall:hG.bind(this),call:cG}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t,e;if(!1===this._sunburst.visible)return;const i=this._createMark(y$.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()},Jz.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(y$.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},Jz.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new m$(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(uG(null===(e=hz.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),pG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(uG(null===(e=hz.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),pG(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]}}y$.type=oB.sunburst,y$.mark=_F,U(y$,_$);const b$=()=>{hz.registerSeries(y$.type,y$),PY(),aY(),$H(),hz.registerAnimation("sunburst",((t,e)=>({appear:FX(0,e),enter:OX(t),exit:DX(t),disappear:DX(t)})))},x$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new u$(i).layout(t,{width:s,height:n})};class S$ extends oN{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const A$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"};class k$ extends AG{constructor(){super(...arguments),this.type=oB.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:rG),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:yD},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),Dz(this._dataSet,"circlePackingLayout",x$),Dz(this._dataSet,"flatten",p$),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)||(Dz(t.dataSet,"addVChartProperty",JN),t.transform({type:"addVChartProperty",options:{beforeCall:hG.bind(this),call:cG}}))}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(k$.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},Jz.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(k$.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"},Jz.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:nG,operations:["max","min","values"]},{key:rG,operations:["values"]}])}initTooltip(){this._tooltipHelper=new S$(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(uG(null===(i=hz.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),pG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(uG(null===(e=hz.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),pG(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]}}k$.type=oB.circlePacking,k$.mark=xF,U(k$,_$);const M$=()=>{hz.registerSeries(k$.type,k$),PY(),aY(),XH(),hz.registerAnimation("circlePacking",((t,e)=>({appear:A$(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},T$=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=T$(t.children):t.value=0),e+=Math.abs(t.value)})),e};function w$(t){return t.depth}function C$(t,e){return e-1-t.endDepth}const E$=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),P$=(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},B$={left:w$,right:C$,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:w$,end:C$},R$=yt(0,1);class L${constructor(t){this._ascendingSourceBreadth=(t,e)=>E$(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>E$(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},L$.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?cb(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):B$[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)};bb(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))),bb(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=[];T$(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}`;if(n[r])return n[r].value+=wt(t.value),void n[r].datum.push(t);const a={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[t],value:t.value,parents:t.parents.map((t=>t.key))};i.push(a),s[t.source].sourceLinks.push(a),s[t.target].targetLinks.push(a),n[r]=a})),{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=[P$(s[t.source]),P$(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=Math.min(n>0?Math.max(this.options.nodeGap,n):this.options.nodeGap,this._viewBox.height/e);a=()=>i,this._gapY=i,this.options.equalNodeHeight?o=this._viewBox.height/e-i:r=t.reduce(((t,e)=>{const s=e.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-(e.length-1)*i)/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,n,0),p=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.max(e.value?i*R$(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&&(o/=i.length-1,n+o>0)){n+=o,this._gapY=Math.min(n);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(E$),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(E$),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 L$(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]:[]},I$=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&I$(t,e.children,i)}))},D$=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},F$=(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 L$(e),r=[];return r.push(n.layout(s,i)),r},j$=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:[]},z$=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 H$ extends oN{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 V$=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),N$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:V$(t),G$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class W$ extends zH{constructor(){super(...arguments),this.type=W$.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}}W$.type="linkPath";const U$=()=>{kR.registerGlyph("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(BO).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),kR.registerAnimationType("linkPathGrowIn",RO),kR.registerAnimationType("linkPathGrowOut",LO),kR.registerAnimationType("linkPathUpdate",OO),_O(),pO(),hz.registerMark(W$.type,W$)};class Y$ extends AG{constructor(){super(...arguments),this.type=oB.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=[Jz.STATE_SANKEY_EMPHASIS,Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:s})}else n.target===e.key?i.includes(n.source)||i.push(n.source):(t.removeState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState(Jz.STATE_SANKEY_EMPHASIS),e.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS)):(t.removeState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(Jz.STATE_SANKEY_EMPHASIS),void s.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(Jz.STATE_SANKEY_EMPHASIS),void s.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:h.value/r.value});s.removeState(Jz.STATE_SANKEY_EMPHASIS),s.addState(Jz.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=[Jz.STATE_SANKEY_EMPHASIS,Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS),void t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS),void t.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:o.value/i.value});t.removeState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.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){Dz(this._dataSet,"sankeyLayout",F$),Dz(this._dataSet,"sankeyFormat",D$),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:Xz.sankeyLayout});const{dataSet:a}=this._option;Dz(a,"sankeyNodes",j$),Dz(a,"flatten",p$);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:oG.bind(this),call:lG}},!1),this._nodesSeriesData=new sG(this._option,o),Dz(a,"sankeyLinks",z$);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:oG.bind(this),call:lG}},!1),this._linksSeriesData=new sG(this._option,l)}}initMark(){var t,e,i,s;const n=this._createMark(Y$.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(Y$.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(Y$.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},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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(uG(null===(i=hz.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(r,a),pG("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(uG(null===(s=hz.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(r,a),pG("link",this._spec,this._markAttributeContext))),this._labelMark&&this._labelMark.setAnimationConfig(uG(null===(n=hz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),pG("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([Jz.STATE_SANKEY_EMPHASIS_REVERSE,Jz.STATE_SANKEY_EMPHASIS]),e.includes(t.getDatum().key)||t.addState(Jz.STATE_SANKEY_EMPHASIS_REVERSE)}))}initTooltip(){this._tooltipHelper=new H$(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 HF;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 I$(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]}}Y$.type=oB.sankey,Y$.mark=mF;const K$=()=>{kR.registerTransform("sankey",{transform:O$,markPhase:"beforeJoin"},!0),EW(),U$(),aY(),hz.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:N$(t,e)},KH))),hz.registerAnimation("sankeyLinkPath",((t,e)=>({appear:G$(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),$H(),hz.registerSeries(Y$.type,Y$)},X$=(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=p$(n);return i=tG([{latestData:r}],e),i};class $$ extends oN{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}get defaultShapeType(){return"square"}}const q$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class Z$ extends yG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}class J$ extends AG{constructor(){super(...arguments),this.type=oB.treemap,this.transformerConstructor=Z$,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:rG),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:yD},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&&[rG,"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)&&(Dz(this._rawData.dataSet,"addVChartProperty",JN),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:hG.bind(this),call:cG}}))}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){Dz(this._dataSet,"hierarchyDimensionStatistics",X$),Dz(this._dataSet,"flatten",p$);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:nG,operations:["max","min","values"]},{key:rG,operations:["values"]}])}initMark(){var t,e,i,s;const n=this._createMark(J$.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(J$.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()},Jz.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()},Jz.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},Jz.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},Jz.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},Jz.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},Jz.STATE_NORMAL,t.AttributeLevel.Series))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(uG(null===(e=hz.getAnimationInKey("treemap"))||void 0===e?void 0:e(),pG(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 $$(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]}}J$.type=oB.treemap,J$.mark=gF,J$.transformerConstructor=Z$,U(J$,_$),U(J$,bU);const Q$=()=>{EW(),aY(),hz.registerAnimation("treemap",((t,e)=>({appear:q$(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),$H(),kR.registerTransform("treemap",{transform:KX,markPhase:"beforeJoin"},!0),hz.registerSeries(J$.type,J$)},tq={type:"fadeIn"};function eq(t,e){return"fadeIn"===e?tq:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class iq extends yG{constructor(){super(...arguments),this._supportStack=!1}}class sq extends mK{constructor(){super(...arguments),this.type=oB.gaugePointer,this.transformerConstructor=iq,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(sq.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},sq.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(sq.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(uG(null===(i=hz.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),pG("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}sq.type=oB.gaugePointer,sq.mark=vF,sq.transformerConstructor=iq;const nq=()=>{hz.registerSeries(sq.type,sq),gU(),EW(),hz.registerAnimation("gaugePointer",((t,e)=>{const i=eq(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),ZY(),$Y()};class rq extends yG{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class aq extends mK{constructor(){super(...arguments),this.type=oB.gauge,this.transformerConstructor=rq,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();Dz(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[OD]=t[this._angleField[0]],t[LD]=e>0?i[e-1][OD]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(aq.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(aq.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[LD])?this.angleAxisHelper.dataToPosition([t[LD]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[OD]])}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(uG(null===(i=hz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),pG("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}aq.type=oB.gauge,aq.mark=fF,aq.transformerConstructor=rq;class oq extends PG{constructor(){super(...arguments),this.type=oq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}oq.type="cell";const lq=()=>{hz.registerMark(oq.type,oq),fM(),_M(),kR.registerGraphic(RB.cell,bg),kR.registerMark(RB.cell,lD)};function hq(t){return!1===t?{}:{type:"fadeIn"}}class cq extends oN{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return p(i)&&"dimension"===t&&(i.visible=!1),i}}class dq extends yG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class uq extends AG{constructor(){super(...arguments),this.type=oB.heatmap,this.transformerConstructor=dq}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(uq.mark.cell,{morph:fG(this._spec,uq.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(uq.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=SG(this);this._cellMark.setAnimationConfig(uG(null===(i=hz.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),pG("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 cq(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]}}uq.type=oB.heatmap,uq.mark=SF,uq.transformerConstructor=dq;const pq=()=>{aY(),lq(),hz.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},KH),{appear:hq(e)}))),tW(),ZG(),hz.registerSeries(uq.type,uq)},gq=(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=mb(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=mb(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+mb(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+mb(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=cb(e.field),C=t.map(w),[E,P]=pb(C),B=E===P?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(P-E),R=u(e.radiusField)?w:cb(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?pb(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=mq(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),fq({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},fq=(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,[_D]:null==n?void 0:n[_D],[bD]:null==n?void 0:n[bD]}};class _q extends zH{constructor(){super(...arguments),this.type=_q.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}}_q.type="ripple";const yq=()=>{hz.registerMark(_q.type,_q),kR.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}}))),_O(),fO()},bq=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class xq extends yG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class Sq extends yY{constructor(){super(...arguments),this.type=oB.correlation,this.transformerConstructor=xq,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;Dz(this._dataSet,"correlation",gq);const s=new va;Fz(s,"dataview",ga),Dz(s,"correlationCenter",vq);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 sG(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(Sq.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:_D,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(Sq.mark.ripplePoint,{key:_D,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});a&&(this._ripplePointMark=a);const o=this._createMark(Sq.mark.centerPoint,{key:_D,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[gD],y:t=>t[mD],size:t=>t[fD],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},Jz.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},Jz.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},Jz.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)},Jz.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(uG(null===(e=hz.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),pG("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()}}Sq.type=oB.correlation,Sq.mark=AF,Sq.transformerConstructor=xq;const Aq=()=>{RG(),yq(),hz.registerSeries(Sq.type,Sq),hz.registerAnimation("correlation",((t,e)=>Object.assign({appear:bq(0,e)},YH)))};class kq extends zH{constructor(){super(...arguments),this.type=kq.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}}kq.type="liquid";const Mq=(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/2):t;class Tq extends oN{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 wq extends bG{constructor(){super(...arguments),this.type=oB.liquid,this.transformerConstructor=LG,this._liquidBackgroundMark=null,this._liquidOutlineMark=null}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){super.setAttrFromSpec(),this._marginSpec=$F(this._spec.outlineMargin),this._paddingSpec=$F(this._spec.outlinePadding),this.setValueField(this._spec.valueField)}rawDataUpdate(t){super.rawDataUpdate(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(wq.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(wq.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidMark=this._createMark(wq.mark.liquid,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_getPosAndSizeFormRegion(t=!1){const{top:e=0,bottom:i=0,left:s=0,right:n=0}=this._marginSpec,{top:r=0,bottom:a=0,left:o=0,right:l=0}=this._paddingSpec,{width:h,height:c}=this._region.getLayoutRect();return t?{x:h/2+(s-n)/2,y:c/2+(e-i)/2,size:Math.min(h-(s+n),c-(e+i))}:{x:h/2+(s+l-(n+l))/2,y:c/2+(e+r-(i+a))/2,size:Math.min(h-(s+n+o+l),c-(e+i+r+a))}}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),x:()=>this._getPosAndSizeFormRegion(!0).x,y:()=>this._getPosAndSizeFormRegion(!0).y,size:()=>this._getPosAndSizeFormRegion(!0).size,symbolType:()=>{var t;return Mq(null!==(t=this._spec.maskShape)&&void 0!==t?t:"circle",this._getPosAndSizeFormRegion(!0).size)}},"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:()=>{var t;const{x:e,y:i,size:s}=this._getPosAndSizeFormRegion();return[bg({x:e,y:i,size:s,symbolType:Mq(null!==(t=this._spec.maskShape)&&void 0!==t?t:"circle",s),fill:!0})]}},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setInteractive(!1)}_initLiquidMarkStyle(){const e=this._liquidMark;e&&this.setMarkStyle(e,{dx:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,y:()=>{const{y:t,size:e}=this._getPosAndSizeFormRegion();return t-e/2+e-e*this._heightRatio},height:()=>{const{size:t}=this._getPosAndSizeFormRegion();return t*this._heightRatio},fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new Tq(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}initInteraction(){this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i;const s={y:{from:()=>{const{y:t,size:e}=this._getPosAndSizeFormRegion();return t-e/2+e},to:()=>{const{y:t,size:e}=this._getPosAndSizeFormRegion();return t-e/2+e-e*this._heightRatio}},height:{from:0,to:()=>{const{size:t}=this._getPosAndSizeFormRegion();return t*this._heightRatio}}},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(uG(null===(i=hz.getAnimationInKey("liquid"))||void 0===i?void 0:i(s,n),pG("liquid",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=DM(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]}}wq.type=oB.liquid,wq.mark=MF,wq.transformerConstructor=LG;const Cq=t=>Y(t).join(",");class Eq extends oN{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>Cq(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>Cq(null==t?void 0:t[this.series.getDimensionField()[0]])}}class Pq extends yG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}class Bq extends bG{constructor(){super(...arguments),this.type=oB.venn,this.transformerConstructor=Pq,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:yD)}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(Bq.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(Bq.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()},Jz.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},Jz.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},Jz.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=>Cq(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)}},Jz.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=>Cq(t.sets)},Jz.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new Eq(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:Cq(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return Cq(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[Cq(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(Cq(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(uG(null===(e=hz.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),pG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(uG(null===(e=hz.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),pG(t.name,this._spec,this._markAttributeContext)))}))}}Bq.type=oB.venn,Bq.mark=TF,Bq.transformerConstructor=Pq;class Rq extends cW{_isValidSeries(t){return t===oB.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 Lq extends lW{constructor(){super(...arguments),this.transformerConstructor=Rq,this.type="map",this.seriesType=oB.map}}Lq.type="map",Lq.seriesType=oB.map,Lq.transformerConstructor=Rq;class Oq extends cW{_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 Iq extends Oq{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=PV(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,Tj({},s,l)),n&&Object.assign(o,Tj({},n,o))}}class Dq extends Oq{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 Fq extends Oq{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 jq extends lW{constructor(){super(...arguments),this.transformerConstructor=Fq}}jq.transformerConstructor=Fq;class zq extends jq{constructor(){super(...arguments),this.transformerConstructor=Fq,this.type="pie",this.seriesType=oB.pie}}zq.type="pie",zq.seriesType=oB.pie,zq.transformerConstructor=Fq;class Hq extends Fq{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class Vq extends jq{constructor(){super(...arguments),this.transformerConstructor=Hq,this.type="pie3d",this.seriesType=oB.pie3d}}Vq.type="pie3d",Vq.seriesType=oB.pie3d,Vq.transformerConstructor=Hq;class Nq extends Dq{_getDefaultSeriesSpec(t){var e,i,s;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:EB,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:EB,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=>Tj({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}class Gq extends lW{constructor(){super(...arguments),this.transformerConstructor=Nq,this.type="rose",this.seriesType=oB.rose,this._canStack=!0}}Gq.type="rose",Gq.seriesType=oB.rose,Gq.transformerConstructor=Nq;class Wq extends Dq{_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:Tj({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=>Tj({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class Uq extends lW{constructor(){super(...arguments),this.transformerConstructor=Wq,this.type="radar",this.seriesType=oB.radar,this._canStack=!0}}Uq.type="radar",Uq.seriesType=oB.radar,Uq.transformerConstructor=Wq;class Yq extends cW{_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")&&Tj(e,aH(this.type,t))})),this._transformAxisSpec(t)}}class Kq extends lW{constructor(){super(...arguments),this.transformerConstructor=Yq,this.type="common",this._canStack=!0}}Kq.type="common",Kq.transformerConstructor=Yq;class Xq extends dW{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 $q extends lW{constructor(){super(...arguments),this.transformerConstructor=Xq,this._canStack=!0}}$q.transformerConstructor=Xq;class qq extends Xq{transformSpec(t){super.transformSpec(t),sH(t)}}class Zq extends $q{constructor(){super(...arguments),this.transformerConstructor=qq,this.type="histogram",this.seriesType=oB.bar}}Zq.type="histogram",Zq.seriesType=oB.bar,Zq.transformerConstructor=qq;class Jq extends $q{constructor(){super(...arguments),this.transformerConstructor=qq,this.type="histogram3d",this.seriesType=oB.bar3d}}Jq.type="histogram3d",Jq.seriesType=oB.bar3d,Jq.transformerConstructor=qq;class Qq extends Iq{_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 tZ extends lW{constructor(){super(...arguments),this.transformerConstructor=Qq,this.type="circularProgress",this.seriesType=oB.circularProgress,this._canStack=!0}}tZ.type="circularProgress",tZ.seriesType=oB.circularProgress,tZ.transformerConstructor=Qq;class eZ extends Iq{_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:oB.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===oB.gauge||t.type===oB.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===oB.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 iZ extends lW{constructor(){super(...arguments),this.transformerConstructor=eZ,this.type="gauge",this.seriesType=oB.gaugePointer}}iZ.type="gauge",iZ.seriesType=oB.gaugePointer,iZ.transformerConstructor=eZ;class sZ extends cW{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class nZ extends lW{constructor(){super(...arguments),this.transformerConstructor=sZ,this.type="wordCloud",this.seriesType=oB.wordCloud}}nZ.transformerConstructor=sZ;class rZ extends sZ{_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 aZ extends nZ{constructor(){super(...arguments),this.transformerConstructor=rZ,this.type="wordCloud",this.seriesType=oB.wordCloud}}aZ.type="wordCloud",aZ.seriesType=oB.wordCloud,aZ.transformerConstructor=rZ;class oZ extends sZ{_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 lZ extends nZ{constructor(){super(...arguments),this.transformerConstructor=oZ,this.type="wordCloud3d",this.seriesType=oB.wordCloud3d}}lZ.type="wordCloud3d",lZ.seriesType=oB.wordCloud3d,lZ.transformerConstructor=oZ;class hZ extends cW{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 cZ extends lW{constructor(){super(...arguments),this.transformerConstructor=hZ,this.type="funnel",this.seriesType=oB.funnel}}cZ.type="funnel",cZ.seriesType=oB.funnel,cZ.transformerConstructor=hZ;class dZ extends lW{constructor(){super(...arguments),this.transformerConstructor=hZ,this.type="funnel3d",this.seriesType=oB.funnel3d}}dZ.type="funnel3d",dZ.seriesType=oB.funnel3d,dZ.transformerConstructor=hZ;class uZ extends dW{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=PV(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=PV(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class pZ extends lW{constructor(){super(...arguments),this.transformerConstructor=uZ,this.type="linearProgress",this.seriesType=oB.linearProgress,this._canStack=!0}}pZ.type="linearProgress",pZ.seriesType=oB.linearProgress,pZ.transformerConstructor=uZ;class gZ extends dW{_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),sH(t)}}class mZ extends lW{constructor(){super(...arguments),this.transformerConstructor=gZ,this.type="rangeColumn",this.seriesType=oB.rangeColumn}}mZ.type="rangeColumn",mZ.seriesType=oB.rangeColumn,mZ.transformerConstructor=gZ;class fZ extends dW{_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 vZ extends lW{constructor(){super(...arguments),this.transformerConstructor=fZ,this.type="rangeColumn3d",this.seriesType=oB.rangeColumn3d}}vZ.type="rangeColumn3d",vZ.seriesType=oB.rangeColumn3d,vZ.transformerConstructor=fZ;class _Z extends cW{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:CB,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=oB.sunburst;return s.type=n,s[n]=t[n],s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class yZ extends lW{constructor(){super(...arguments),this.transformerConstructor=_Z,this.type="sunburst",this.seriesType=oB.sunburst}}yZ.type="sunburst",yZ.seriesType=oB.sunburst,yZ.transformerConstructor=_Z;class bZ extends cW{_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=oB.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class xZ extends lW{constructor(){super(...arguments),this.transformerConstructor=bZ,this.type="circlePacking",this.seriesType=oB.circlePacking}}xZ.type="circlePacking",xZ.seriesType=oB.circlePacking,xZ.transformerConstructor=bZ;class SZ extends cW{_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 AZ extends lW{constructor(){super(...arguments),this.transformerConstructor=SZ,this.type="treemap",this.seriesType=oB.treemap}}AZ.type="treemap",AZ.seriesType=oB.treemap,AZ.transformerConstructor=SZ;class kZ extends IW{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),sH(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}class MZ extends DW{constructor(){super(...arguments),this.transformerConstructor=kZ,this.type="waterfall",this.seriesType=oB.waterfall}}MZ.type="waterfall",MZ.seriesType=oB.waterfall,MZ.transformerConstructor=kZ;class TZ extends dW{_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"}]),sH(t)}}class wZ extends lW{constructor(){super(...arguments),this.transformerConstructor=TZ,this.type="boxPlot",this.seriesType=oB.boxPlot}}wZ.type="boxPlot",wZ.seriesType=oB.boxPlot,wZ.transformerConstructor=TZ;class CZ extends cW{_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 EZ extends lW{constructor(){super(...arguments),this.transformerConstructor=CZ,this.type="sankey",this.seriesType=oB.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)}))}}EZ.type="sankey",EZ.seriesType=oB.sankey,EZ.transformerConstructor=CZ;class PZ extends dW{_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),sH(t)}}class BZ extends lW{constructor(){super(...arguments),this.transformerConstructor=PZ,this.type="rangeArea",this.seriesType=oB.rangeArea}}BZ.type="rangeArea",BZ.seriesType=oB.rangeArea,BZ.transformerConstructor=PZ;class RZ extends dW{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}class LZ extends lW{constructor(){super(...arguments),this.transformerConstructor=RZ,this.type="heatmap",this.seriesType=oB.heatmap}}LZ.type="heatmap",LZ.seriesType=oB.heatmap,LZ.transformerConstructor=RZ;class OZ extends cW{_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=oB.correlation;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class IZ extends lW{constructor(){super(...arguments),this.transformerConstructor=OZ,this.type="correlation",this.seriesType=oB.correlation}}IZ.type="correlation",IZ.seriesType=oB.correlation,IZ.transformerConstructor=OZ;function DZ(t){var e,i;const s=Object.assign({},t);return B(t.style)||(s.textStyle=lz(t.style)),B(t.textStyle)||Tj(s.textStyle,lz(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&lz(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&lz(s.background.style),s}const FZ=(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},jZ=(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:bD;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 zZ extends jG{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:()=>{sB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),sB(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=UF(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 DH(this._option,e),this._initSelectedData(),sB(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)||(sB(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(Tj({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(Tj({},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(Tj({},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}}zZ.specKey="legends";class HZ extends zZ{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),sB(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:Xz.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){Dz(this._option.dataSet,"discreteLegendFilter",jZ),Dz(this._option.dataSet,"discreteLegendDataMake",FZ);const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return sB(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(!rb(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=qj(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=DZ(s)),B(n.focusIconStyle)||lz(n.focusIconStyle),n.shape&&(n.shape=az(n.shape)),n.label&&(n.label=az(n.label)),n.value&&(n.value=az(n.value)),n.background&&(n.background=az(n.background)),YF(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),YF(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),YF(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)||lz(r.railStyle),B(r.sliderStyle)||lz(r.sliderStyle)):(B(r.textStyle)||lz(r.textStyle),r.handler&&az(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(Tj(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 uP}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(rP.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(rP.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(rP.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}=wV(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=wV(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}HZ.specKey="legends",HZ.type=r.discreteLegend;const VZ=(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[]},NZ=(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)?rz(t,+e,+i):t.filter((t=>t[o]>=e&&t[o]<=i))}return t};function GZ(t){return"color"===t||"size"===t}const WZ={color:vP,size:yP},UZ=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],YZ=[2,10];class KZ extends zZ{static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!y(e))return GZ(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)=>{GZ(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),sB(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData},level:Xz.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(){Dz(this._option.dataSet,"continuousLegendFilter",NZ),Dz(this._option.dataSet,"continuousLegendDataMake",VZ);const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>nB(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=qj(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!rb(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=qj(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?UZ:YZ);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=Tj({},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=DZ(s)),w.showHandler=!1!==n.visible,B(n.style)||(w.handlerStyle=lz(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),B(r.style)||(w.railStyle=lz(r.style)),B(a.style)||(w.trackStyle=lz(a.style)),w.startText=az(o),w.endText=az(l),w.handlerText=az(h),B(c)||(w.sizeBackground=lz(c)),d.visible&&!B(d.style)&&(Tj(w,d.style),p(d.padding)&&(w.padding=d.padding)),w}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return WZ[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))}}}KZ.specKey="legends",KZ.type=r.continuousLegend;class XZ{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=Tz(n,a,!0))&&void 0!==e?e:[],...null!==(i=gz(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(!jw(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=nN(s).includes(t):p(e.visible)||p(e.activeType)?d.visible=nN(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)&&(pN(s).every((t=>{var e;return!nN(null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec).includes("dimension")}))?d.visible=!1:p(e.visible)||p(e.activeType)?d.visible=nN(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=dN(t,i,s),m=uN(t,i,s),f=Tj({},I(e[t]),m),v=g.title,_=mN(void 0,f,u.shape,void 0,v);p(f.title)?f.title=hN(f.title,Object.assign(Object.assign({},v),_)):f.title=hN(v,_,!0);const y=Y(g.content);if(p(f.content)){const t=gN(y);f.content=cN(f.content,(e=>mN(e,f,u.shape,t)))}else f.content=cN(y,(t=>mN(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=SN(a,t,e),l=!!p(o)&&!1!==vN(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 $Z extends XZ{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 qZ extends XZ{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 ZZ extends XZ{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 JZ=t=>p(t)&&!y(t),QZ=t=>p(t)&&y(t);class tJ extends FG{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:s}=super._initTheme(t,e);return i.style=Tj({},this._theme,i.style),{spec:i,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h,c,d;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=nN(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:eb(this._option.mode)||!Qy(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=null===(d=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===d?void 0:d.getElementById(t.parentElement)):Qy(this._option.mode)&&(t.parentElement=null==Jy?void 0:Jy.body)}}class eJ extends jG{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=tJ,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._getMouseOutHandler=t=>e=>{var i,s,n;if(this._alwaysShow)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=Qy(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(!t&&this._clickLock)return;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&&JZ(this._cacheInfo)?a.mark=this._showTooltipByMouseEvent("mark",i,e,t,!0):r&&QZ(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),t&&this._clickLock&&(this._clickLock=!1))},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(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));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&sV.globalConfig.uniqueTooltip&&l&&sV.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._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?_N.canvas:_N.dom,n=hz.getComponentPluginInType(t);n||$y("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 qZ(this),dimension:new $Z(this),group:new ZZ(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)),(tb(i)||eb(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)))}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=iN(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(QZ(t)){if(JZ(this._cacheInfo))return!1;const e=this._cacheInfo;if(!(e.length===t.length&&t.every(((t,i)=>cz(t,e[i])))))return!1}else{if(QZ(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}}eJ.type=r.tooltip,eJ.transformerConstructor=tJ,eJ.specKey="tooltip";var iJ,sJ;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(iJ||(iJ={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(sJ||(sJ={}));const nJ={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class rJ extends jG{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=>{this._handleIn(t),this._clickLock=this._hasActive&&this._spec.lockAfterClick,this._clickLock&&S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._clickLock=!1,this._handleOutEvent()}),this.triggerOff))},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"}:tb(e)||eb(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=this.trigger||"hover",e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;if(y(t)){const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return[{click:"click"===t,in:i[t],out:e(t)}]}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)=>{nJ[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||t.yField)&&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){mz(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=>{jw(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[0],s=e.series.dataToPosition(e.datum[0]);(p(t.dimType)?"y"===t.dimType:fz(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=s.y:r=s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=e.x,a=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=rB(this._regions,"cartesian");if(!e)return;const{x:i,y:s,offsetWidth:n,offsetHeight:r,bandWidth:a,bandHeight:o}=zV(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=NV(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=GV(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 uT(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(n=new pT(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 QM(e)),null==s||s.add(t)),FV(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}aJ.specKey="crosshair",aJ.type=r.cartesianCrosshair;class oJ extends rJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return e.categoryField||e.valueField?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.polarCrosshair}]:void 0;const i=[];return e.forEach(((t,e)=>{(t.categoryField||t.valueField)&&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=>{jw(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=rB(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:"",Tj(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=EV(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=EV(s.getSpec())),c.angle=a.angle,c.axis=s,Tj(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}=wV(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}=wV(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 uT(Object.assign(Object.assign({},l),{lineStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===o&&(t=new mT(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 fT(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex+1})):new gT(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 QM(e),null==s||s.add(t),i(t)),FV(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair]}}oJ.specKey="crosshair",oJ.type=r.polarCrosshair;const lJ=(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)},hJ=(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 cJ extends jG{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 sB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),sB(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=_z(t),this._isHorizontal="horizontal"===yz(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=>!Dw(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(Dw(this._stateScale.type));this._stateScale.domain(e,!0),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={};sB(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=Dw(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 sB(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;Fz(s,"dataview",ga),Dz(s,"dataFilterComputeDomain",hJ);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 DH(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(Dw(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&&Dw(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,Dw(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=Dw(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 rC,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||(Dz(this._option.dataSet,"dataFilterWithNewDomain",lJ),sB(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:()=>Dw(this._stateScale.type)},level:Xz.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(Dw(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&&jw(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,jw(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(cJ,bU);class dJ extends FG{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=Tj({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 uJ extends cJ{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=dJ,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 TC;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(!Dw(t.type)||e[0]!==e[1])&&(!jw(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 rE(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:lz(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:lz(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:lz(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:lz(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:lz(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:lz(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:lz(g.style)},selectedBackgroundStyle:lz(this._spec.selectedBackground.style),dragMaskStyle:lz(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:Tj(lz(null===(l=m.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},lz(null===(h=m.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:Tj(lz(null===(c=f.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},lz(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}=wV(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()}}uJ.type=r.dataZoom,uJ.transformerConstructor=dJ,uJ.specKey="dataZoom";class pJ extends cJ{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 EM(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=$P(this._start,e)&&$P(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=lz(t.style)),B(null==e?void 0:e.style)||(s.sliderStyle=lz(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}pJ.type=r.scrollBar,pJ.specKey="scrollBar";const gJ=(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 mJ extends jG{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!==mJ.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(){Dz(this._option.dataSet,"indicatorFilter",gJ);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 DH(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=Tj({},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({},lz(e.style)),{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?ZF(this._spec.offsetX,this._computeLayoutRadius()):0,dy:this._spec.offsetY?ZF(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({},lz(this._spec.title.style)),{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 SP(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}}mJ.type=r.indicator,mJ.specKey="indicator";const fJ=["sum","average","min","max","variance","standardDeviation","median"];function vJ(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=X(s);return er}function _J(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&vJ(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=YF(t.x)?SJ(t.x,n)+r.x:l.getXAxisHelper().dataToPosition([t.x])+r.x,h}function yJ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&vJ(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=YF(t.y)?SJ(t.y,n)+r.y:l.getYAxisHelper().dataToPosition([t.y])+r.y,h}function bJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&vJ(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 xJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&vJ(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 SJ(t,e){return Number(t.substring(0,t.length-1))*e/100}function AJ(t){return fJ.includes(t)}function kJ(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=_J(t,m,n,d,h,a),i=yJ(t,f,n,d,c,a);u.push([{x:e,y:i}])}else if(e){const e=_J(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=yJ(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 MJ(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=bJ(t,l,n,r),i=xJ(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=bJ(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=xJ(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function TJ(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=YF(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=YF(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])&&vJ(_,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])&&vJ(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 wJ(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])&&vJ(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])&&vJ(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 CJ(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 YF(e)&&(e=SJ(e,r)),e+=s,YF(i)&&(i=SJ(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 YF(e)&&(e=SJ(e,s)),YF(i)&&(i=SJ(i,n)),{x:e,y:i}}))}function EJ(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 PJ(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},lz(r.style)):t.shape={visible:!1},!1!==s.visible?(t.panel=Object.assign({visible:!0},RJ(lz(s.style),i)),p(s.padding)&&(t.padding=ei(s.padding))):(t.panel={visible:!1},t.padding=0),n&&(t.textStyle=RJ(lz(n),i)),t}return{visible:!1}}function BJ(t,e){for(const i in t)d(t[i])&&(t[i]=t[i](e));return t}function RJ(t,e){return d(t)?t(e):t}function LJ(t,e){return d(t)?t(e):t}function OJ(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 IJ(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 DJ(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 FJ(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function jJ(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=>HJ(i,t,e))):s.x=HJ(i,t,e)}if(p(e.y)){const i=e.y;y(i)?s.y=i.map((i=>HJ(i,t,e))):s.y=HJ(i,t,e)}if(p(e.angle)){const i=e.angle;y(i)?s.angle=i.map((i=>HJ(i,t,e))):s.angle=HJ(i,t,e)}if(p(e.radius)){const i=e.radius;y(i)?s.radius=i.map((i=>HJ(i,t,e))):s.radius=HJ(i,t,e)}if(p(e.areaName)){const i=e.areaName;s.areaName=HJ(i,t,e)}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),i.push(s)})),i}const zJ={min:(t,e)=>qP(t[0].latestData,e.field),max:(t,e)=>ZP(t[0].latestData,e.field),sum:function(t,e){return JP(t[0].latestData,e.field)},average:function(t,e){return QP(t[0].latestData,e.field)},variance:function(t,e){return tB(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(tB(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 HJ(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 zJ[i](e,{field:s})}return t}class VJ extends jG{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)&&AJ(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])&&AJ(t[h])?i.x={field:h,aggrType:t[h]}:i.x=Y(h).map((e=>t[e])),_(t[c])&&AJ(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])&&AJ(t[o])?i.angle={field:o,aggrType:t[o]}:i.angle=Y(o).map((e=>t[e])),_(t[l])&&AJ(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=rB(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=KF(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=KF(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 NJ(t,e){return function(t,e,i){const{predict:s}=_b(t,(t=>t[e]),(t=>t[i])),n=qP(t,e),r=ZP(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 GJ(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 WJ extends VJ{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}=IJ(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:RJ(lz(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:PJ(y,this._markerData),state:{line:BJ(null!==(a=null===(r=this._spec.line)||void 0===r?void 0:r.state)&&void 0!==a?a:{},this._markerData),lineStartSymbol:BJ(null!==(l=null===(o=this._spec.startSymbol)||void 0===o?void 0:o.state)&&void 0!==l?l:{},this._markerData),lineEndSymbol:BJ(null!==(c=null===(h=this._spec.endSymbol)||void 0===h?void 0:h.state)&&void 0!==c?c:{},this._markerData),label:BJ(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:BJ(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:lz(b.style)}):S.startSymbol={visible:!1},x.visible?S.endSymbol=Object.assign(Object.assign({},x),{visible:!0,style:lz(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}=EJ([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}=IJ(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;Dz(this._option.dataSet,"markerAggregation",jJ),Dz(this._option.dataSet,"markerRegression",NJ),Dz(this._option.dataSet,"markerFilter",GJ);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}}WJ.specKey="markLine";class UJ extends WJ{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new UE(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:_}=IJ(e);let y=[];if(u||m||g||f||v||a&&l||a&&h){const t=kJ(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=TJ(i,r,d,e.coordinatesOffset):c&&(y=CJ(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(YF(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}=IJ(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}}}UJ.type=r.markLine,UJ.coordinateType="cartesian";class YJ extends WJ{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=IJ(this._spec);return e||i?new XE(t):new UE(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}=IJ(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=MJ(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=wJ(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}=IJ(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}}}YJ.type=r.polarMarkLine,YJ.coordinateType="polar";class KJ extends jG{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=UF(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 bP(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}}KJ.type=r.title,KJ.specKey=r.title;class XJ extends VJ{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=DJ(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:RJ(lz(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:PJ(u,this._markerData),state:{area:BJ(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData),label:BJ(null===(o=this._spec.label)||void 0===o?void 0:o.state,this._markerData),labelBackground:BJ(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}=EJ([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}=DJ(t);if(!(e||i||s||n||r||a||o))return null;const{options:l}=this._computeOptions(),h=this._getRelativeDataView();Dz(this._option.dataSet,"markerAggregation",jJ),Dz(this._option.dataSet,"markerFilter",GJ);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}}XJ.specKey="markArea";class $J extends XJ{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new KE(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}=DJ(e),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t;let u=[],g=[];if(l){g=kJ(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=kJ(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[...t,e[1],e[0]])}else h?u=TJ(i,r,d,e.coordinatesOffset):c&&(u=CJ(e.positions,r,e.regionRelative));return{points:u}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=DJ(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}}}$J.type=r.markArea,$J.coordinateType="cartesian";class qJ extends XJ{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=DJ(this._spec);return i||e||s?new $E(t):new KE(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}=DJ(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=MJ(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=wJ(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}=DJ(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}}}qJ.type=r.polarMarkArea,qJ.coordinateType="polar";const ZJ=t=>lz(Object.assign({},t)),JJ=t=>Object.assign(Object.assign({},t),{style:Object.assign({},lz(t.style))}),QJ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,m;const f=ZJ(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=ZJ(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:{},lz(Object.assign({},y)));var y;const b=JJ(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=JJ(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=JJ(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=JJ(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},tQ=t=>"left"===t||"right"===t,eQ=t=>"top"===t||"bottom"===t;class iQ extends jG{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({},QJ(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({},QJ(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 DP(t):this._playerComponent=new zP(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=tQ(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=tQ(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(PP.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(PP.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(PP.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(PP.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(PP.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(PP.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=tQ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=eQ(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)):tQ(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))):eQ(this._orient)?this._maxSize():t.height}_computeDx(t){return tQ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return eQ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}}iQ.specKey="player",iQ.type=r.player;class sQ extends jG{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)))}}sQ.type=r.label;class nQ extends rY{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}}nQ.type="text",nQ.constructorType="label";const rQ=()=>{hz.registerMark(nQ.constructorType,nQ),vO()};class aQ extends FG{_initTheme(t,e){return{spec:t,theme:this._theme}}}class oQ extends sQ{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=aQ,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),sB(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=Tj({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=HU[t])&&void 0!==i?i:HU.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}:VU(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}}oQ.type=r.label,oQ.specKey="label",oQ.transformerConstructor=aQ;class lQ extends sQ{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[PD]},"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 Tj({textStyle:{pickable:!0===this._spec.interactive},position:hQ(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[RD]))},a))}})).encode((e=>VU({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 hQ(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}lQ.type=r.totalLabel,lQ.specKey="totalLabel";class cQ extends VJ{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=FJ(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:LJ(E.offsetX,this._relativeSeries.getRegion()),offsetY:LJ(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:RJ(B.style,this._markerData)},state:{line:BJ(null!==(h=null===(l=this._spec.itemLine.line)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData),lineStartSymbol:BJ(null!==(d=null===(c=this._spec.itemLine.startSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData),lineEndSymbol:BJ(null!==(p=null===(u=this._spec.itemLine.endSymbol)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData),symbol:BJ(null!==(m=null===(g=this._spec.itemContent.symbol)||void 0===g?void 0:g.state)&&void 0!==m?m:{},this._markerData),image:BJ(null!==(v=null===(f=this._spec.itemContent.image)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData),text:BJ(null!==(y=null===(_=this._spec.itemContent.text)||void 0===_?void 0:_.state)&&void 0!==y?y:{},this._markerData),textBackground:BJ(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:BJ(null!==(A=null===(S=this._spec.itemContent.richText)||void 0===S?void 0:S.state)&&void 0!==A?A:{},this._markerData),customMark:BJ(null!==(M=null===(k=this._spec.itemContent.customMark)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData),targetItem:BJ(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=lz(RJ(L.style,this._markerData))),(null==O?void 0:O.style)&&(F.itemContent.imageStyle=RJ(O.style,this._markerData)),R&&(F.itemContent.textStyle=PJ(R,this._markerData)),(null==I?void 0:I.style)&&(F.itemContent.richTextStyle=RJ(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:lz(z.style)}):{visible:!1};return new ZE(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}=EJ([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:OJ(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:OJ(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}=FJ(t);if(!(p(t.coordinate)||e||i||s))return;Dz(this._option.dataSet,"markerAggregation",jJ),Dz(this._option.dataSet,"markerFilter",GJ);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}}cQ.specKey="markPoint";class dQ extends cQ{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=kJ(i,s,s,s,o)[0][0]:r?l=TJ(i,s,o,e.coordinatesOffset)[0]:a&&(l=CJ([e.position],s,e.regionRelative)[0]),{point:l}}_computeOptions(){const t=this._spec,{doXYProcess:e}=FJ(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}}}dQ.type=r.markPoint,dQ.coordinateType="cartesian";class uQ extends cQ{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=MJ(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}])]}}}uQ.type=r.polarMarkPoint,uQ.coordinateType="polar";class pQ extends cQ{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}])]}}}pQ.type=r.geoMarkPoint,pQ.coordinateType="geo";const gQ="inBrush",mQ="outOfBrush";class fQ extends jG{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),gQ,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),mQ,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 GP(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:lz(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(FP.drawStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(FP.moveStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(FP.drawing,(s=>{this._needInitOutState&&"single"===o&&this._initMarkBrushState(i,mQ),this._needInitOutState=!1,this._needDisablePickable=!0,this._handleBrushChange(t.ChartEvent.brushChange,e,s),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(FP.moving,(i=>{this._handleBrushChange(t.ChartEvent.brushChange,e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(FP.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(FP.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(FP.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({},lz(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(gQ),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(gQ),i.addState(mQ),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(gQ),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(gQ),i.addState(mQ),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(gQ),i.removeState(mQ),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}}}fQ.type=r.brush,fQ.specKey="brush";class vQ extends jG{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,`${hB}_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=uG({},pG(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}}}vQ.type=r.customMark,vQ.specKey="customMark";function _Q(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 yQ(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function bQ(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:yQ(t.rect),anchorCandidates:TQ(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=>_Q(t,r)));if(n.anchorCandidates)if(a&&(null===(e=n.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;t_Q(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 xQ(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=kQ(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(!kQ(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],SQ(AQ(t.point,l)))):t.point;n&&(s.x=n.x,s.y=n.y);const r=SQ(AQ(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=MQ(t.rect,a,0),t}));return bQ(h)}function SQ(t){return t>180?t-360:t}function AQ(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function kQ(t,e){for(let i=0;i{const{x:r,y:a}=MQ(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,s);n.push({x:r,y:a})})),n}class wQ extends jG{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:Xz.copyDataView},!1),this._data=new DH(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 ZE({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=$F(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=ku({});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=Tg(lz(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=bg(lz(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=mp(lz(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=mp(lz(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=MQ(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:lz(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]}))):bQ(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}}wQ.type=r.mapLabel,wQ.specKey="mapLabel";class CQ{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=>EQ(t))),a=n.filter((t=>!EQ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>EQ(t))),h=o.filter((t=>!EQ(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 EQ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}CQ.type="grid";sV.useRegisters([()=>{iI(),sI(),EG(),RG(),ZH(),XH(),tW(),ZG(),hz.registerSeries(nW.type,nW),hz.registerChart(pW.type,pW)},()=>{iI(),sI(),EG(),mW(),RG(),vW(),tW(),ZG(),hz.registerSeries(yW.type,yW),hz.registerChart(xW.type,xW)},()=>{OW(),hz.registerChart(DW.type,DW)},()=>{$W(),hz.registerChart(ZW.type,ZW)},()=>{OY(),hz.registerChart(zq.type,zq)},()=>{QY(),hz.registerChart(Gq.type,Gq)},()=>{oK(),hz.registerChart(Uq.type,Uq)},()=>{OW(),hz.registerChart(Zq.type,Zq)},()=>{TU(),hz.registerChart(Lq.type,Lq)},()=>{nq(),hz.registerSeries(aq.type,aq),PY(),_K(),$Y(),hz.registerChart(iZ.type,iZ)},()=>{oX(),hz.registerChart(aZ.type,aZ)},()=>{wX(),hz.registerChart(cZ.type,cZ)},()=>{ZU(),hz.registerChart(MZ.type,MZ)},()=>{sY(),RG(),XH(),tW(),ZG(),hz.registerSeries(nY.type,nY),hz.registerChart(wZ.type,wZ)},()=>{hz.registerSeries(bK.type,bK),PY(),_K(),$H(),ZY(),$Y(),hz.registerChart(tZ.type,tZ)},()=>{wK(),hz.registerChart(pZ.type,pZ)},()=>{mY(),hz.registerChart(mZ.type,mZ)},()=>{mW(),tW(),ZG(),hz.registerSeries(_Y.type,_Y),hz.registerChart(BZ.type,BZ)},()=>{b$(),hz.registerChart(yZ.type,yZ)},()=>{M$(),hz.registerChart(xZ.type,xZ)},()=>{Q$(),hz.registerChart(AZ.type,AZ)},()=>{K$(),hz.registerChart(EZ.type,EZ)},()=>{pq(),hz.registerChart(LZ.type,LZ)},()=>{Aq(),hz.registerChart(IZ.type,IZ)},()=>{hz.registerChart(Kq.type,Kq)},ZG,tW,()=>{GG(),hz.registerComponent(eW.type,eW)},()=>{GG(),hz.registerComponent(iW.type,iW)},()=>{GG(),hz.registerComponent(sW.type,sW)},ZY,$Y,()=>{hz.registerComponent(HZ.type,HZ)},()=>{hz.registerComponent(KZ.type,KZ)},()=>{hz.registerComponent(eJ.type,eJ)},()=>{hz.registerComponent(aJ.type,aJ)},()=>{hz.registerComponent(oJ.type,oJ)},()=>{hz.registerComponent(uJ.type,uJ)},()=>{hz.registerComponent(pJ.type,pJ)},()=>{hz.registerComponent(mJ.type,mJ)},AU,()=>{hz.registerComponent(UJ.type,UJ),WE()},()=>{hz.registerComponent($J.type,$J),YE()},()=>{hz.registerComponent(dQ.type,dQ),qE()},()=>{hz.registerComponent(YJ.type,YJ),XE._animate=TE,WE()},()=>{hz.registerComponent(qJ.type,qJ),$E._animate=CE,YE()},()=>{hz.registerComponent(uQ.type,uQ),qE()},()=>{hz.registerComponent(pQ.type,pQ),qE()},()=>{hz.registerComponent(KJ.type,KJ)},()=>{hz.registerComponent(iQ.type,iQ)},()=>{zO(),rQ(),HG(),hz.registerComponent(oQ.type,oQ,!0)},()=>{zO(),rQ(),HG(),hz.registerComponent(lQ.type,lQ,!0)},()=>{hz.registerComponent(fQ.type,fQ)},()=>{hz.registerComponent(vQ.type,vQ)},()=>{hz.registerComponent(wQ.type,wQ)},()=>{ql.load(cT)},()=>{hz.registerLayout(CQ.type,CQ)},ZN,pV,UR,WR]),sV.useRegisters([()=>{cA(ql)}]),t.ARC_END_ANGLE=xB,t.ARC_K=SB,t.ARC_MIDDLE_ANGLE=AB,t.ARC_QUADRANT=kB,t.ARC_RADIAN=MB,t.ARC_RATIO=yB,t.ARC_START_ANGLE=bB,t.ARC_TRANSFORM_VALUE=_B,t.AxisSyncPlugin=xV,t.BASE_EVENTS=hD,t.CORRELATION_SIZE=fD,t.CORRELATION_X=gD,t.CORRELATION_Y=mD,t.CanvasTooltipHandler=qN,t.DEFAULT_CHART_HEIGHT=dB,t.DEFAULT_CHART_WIDTH=cB,t.DEFAULT_CONICAL_GRADIENT_CONFIG=HD,t.DEFAULT_DATA_INDEX=_D,t.DEFAULT_DATA_KEY=yD,t.DEFAULT_DATA_SERIES_FIELD=bD,t.DEFAULT_GRADIENT_CONFIG=VD,t.DEFAULT_LABEL_ALIGN=pB,t.DEFAULT_LABEL_LIMIT=uB,t.DEFAULT_LABEL_TEXT=gB,t.DEFAULT_LABEL_VISIBLE=mB,t.DEFAULT_LABEL_X=fB,t.DEFAULT_LABEL_Y=vB,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_GRADIENT_CONFIG=jD,t.DEFAULT_MEASURE_CANVAS_ID=vD,t.DEFAULT_RADIAL_GRADIENT_CONFIG=zD,t.DEFAULT_SERIES_STYLE_NAME=xD,t.DomTooltipHandler=$N,t.Factory=hz,t.FormatterPlugin=uV,t.GradientType=FD,t.MediaQuery=lV,t.POLAR_DEFAULT_RADIUS=EB,t.POLAR_END_ANGLE=270,t.POLAR_END_RADIAN=wB,t.POLAR_START_ANGLE=CB,t.POLAR_START_RADIAN=TB,t.PREFIX=hB,t.SEGMENT_FIELD_END=OD,t.SEGMENT_FIELD_START=LD,t.STACK_FIELD_END=MD,t.STACK_FIELD_END_OffsetSilhouette=ED,t.STACK_FIELD_END_PERCENT=wD,t.STACK_FIELD_KEY=AD,t.STACK_FIELD_START=kD,t.STACK_FIELD_START_OffsetSilhouette=CD,t.STACK_FIELD_START_PERCENT=TD,t.STACK_FIELD_TOTAL=PD,t.STACK_FIELD_TOTAL_PERCENT=BD,t.STACK_FIELD_TOTAL_TOP=RD,t.ThemeManager=Wj,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=sV,t.WaterfallDefaultSeriesField=pD,t.builtinThemes=Lj,t.computeActualDataScheme=LF,t.darkTheme=yj,t.dataScheme=JF,t.default=sV,t.defaultThemeName=Oj,t.getActualColor=IF,t.getColorSchemeBySeries=zF,t.getDataScheme=RF,t.getMergedTheme=Nj,t.getTheme=zj,t.hasThemeMerged=Fj,t.isColorKey=DF,t.isProgressiveDataColorScheme=FF,t.isTokenKey=fj,t.lightTheme=_j,t.queryColorFromColorScheme=OF,t.queryToken=mj,t.registerCanvasTooltipHandler=ZN,t.registerChartPlugin=oV,t.registerDomTooltipHandler=()=>{XN($N)},t.registerFormatPlugin=pV,t.registerMediaQuery=()=>{oV(lV)},t.registerTheme=jj,t.removeTheme=Hj,t.themeExist=Vj,t.themes=Ij,t.token=vj,t.transformColorSchemeToStandardStruct=jF,t.version="1.11.4",t.vglobal=P_,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 V(t){return Object.prototype.toString.call(t)}function N(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(V(t)!==V(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=N(t),n=N(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 Vt(t){return t>1?0:t<-1?Et:Math.acos(t)}function Nt(t){return t>=1?Pt:t<=-1?-Pt:Math.asin(t)}function Gt(t,e,i,s,n){let r,a;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 Ve,Ne,Ge,We;function Ue(t){return Ve=1/0,Ne=1/0,Ge=-1/0,We=-1/0,t.forEach((t=>{Ve>t.x&&(Ve=t.x),Get.y&&(Ne=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},Vi=Math.sqrt,Ni=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=Vi(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=Ns},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=Vs,Rs=Os=t,Ls=Is=e}function Vs(t,e){Fs.add(Is*t-Os*e),Os=t,Is=e}function Ns(){Vs(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=Vi(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=Vi(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(Vi(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 Vn=16,Nn=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=Vi(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()):Vi(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 Ni((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)*Vi(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 Vr(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 Vr(s).parse(t)},Yr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Lr.DSV,Nr(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",Va="Function",Na="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 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 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 No(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 No("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){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"linearClosed":return ll(t,i)}}class cl 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 dl=["l",0,0,0,0,0,0,0];function ul(t,e,i){const s=dl[0]=t[0];if("a"===s||"A"===s)dl[1]=e*t[1],dl[2]=i*t[2],dl[3]=t[3],dl[4]=t[4],dl[5]=t[5],dl[6]=e*t[6],dl[7]=i*t[7];else if("h"===s||"H"===s)dl[1]=e*t[1];else if("v"===s||"V"===s)dl[1]=i*t[1];else for(let s=1,n=t.length;s{at.getInstance().warn("空函数")}}),Cl=Object.assign(Object.assign({},bl),{points:[],cornerRadius:0,closePath:!0}),El=Object.assign(Object.assign({},bl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},bl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const Pl=Object.assign(Object.assign({},bl),{symbolType:"circle",size:10,keepDirIn3d:!0}),Bl=Object.assign(Object.assign(Object.assign({},bl),vl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Rl=Object.assign(Object.assign(Object.assign({},bl),vl),{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}),Ll=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},bl),{fill:!0,cornerRadius:0}),Ol=Object.assign(Object.assign({},Ll),{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 Il=new class{},Dl={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"}},Fl=!0,jl=!1,zl=/\w|\(|\)|-/,Hl=/[.?!,;:/,。?!、;:]/,Vl=/\S/;function Nl(t,e,i,s,n){if(!e||e<=0)return 0;const r=Il.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=Gl(t,a)),a}function Gl(t,e){let i=e;for(;zl.test(t[i-1])&&zl.test(t[i])||Hl.test(t[i]);)if(i--,i<=0)return e;return i}function Wl(t,e){const i=Il.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 Ul=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Yl=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=Bl.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=Gl(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=Gl(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}};Yl=Ul([Oa()],Yl);var Kl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Xl=Symbol.for("TextMeasureContribution");let $l=class extends Yl{};$l=Kl([Oa()],$l);const ql=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 Va: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===Da&&(t.cache=e,t.activated=!0)}},Zl=Symbol.for("CanvasFactory"),Jl=Symbol.for("Context2dFactory");function Ql(t){return ql.getNamed(Zl,Il.global.env)(t)}const th=1e-4,eh=Math.sqrt(3),ih=1/3;function sh(t){return t>-vh&&tvh||t<-vh}const rh=[0,0],ah=[0,0],oh=[0,0];function lh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function hh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function ch(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 dh(t){return(t%=Rt)<0&&(t+=Rt),t}function uh(t,e,i,s,n,r){if(r>e&&r>s||rn?o:0}function ph(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 fh(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(sh(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 yh=[-1,-1,-1],bh=[-1,-1];function xh(){const t=bh[0];bh[0]=bh[1],bh[1]=t}function Sh(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(sh(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,ih):Math.pow(i,ih),s=s<0?-Math.pow(-s,ih):Math.pow(s,ih);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+eh*Math.sin(e)))/(3*a),h=(-o+i*(s-eh*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,yh);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&xh(),p=ch(e,s,r,o,bh[0]),u>1&&(g=ch(e,s,r,o,bh[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(sh(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,yh);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=hh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);yh[0]=-l,yh[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>=yh[0]+t&&a<=yh[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=yh[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 Mh(t){return Math.round(t/Et*1e8)/1e8%2*Et}function Th(t,e){let i=Mh(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-Mh(i-n)):e&&i1&&(i||(h+=uh(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;wh[0]=S,wh[1]=A,Th(wh,Boolean(a[6])),S=wh[0],A=wh[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(fh(c,d,f,v,e,s,n))return!0}else h+=uh(c,d,f,v,s,n)||0;c=f,d=v;break;case po.C:if(i){if(gh(c,d,f,v,_,y,b,x,e,s,n))return!0}else h+=Sh(c,d,f,v,_,y,b,x,s,n)||0;c=b,d=x;break;case po.Q:if(i){if(ph(c,d,f,v,_,y,e,s,n))return!0}else h+=Ah(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+=uh(c,d,o,l,s,n),i){if(mh(f,v,_,k,k+M,T,e,w,n))return!0}else h+=kh(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(fh(u,p,o,p,e,s,n)||fh(o,p,o,l,e,s,n)||fh(o,l,u,l,e,s,n)||fh(u,l,u,p,e,s,n))return!0}else h+=uh(o,p,o,l,s,n),h+=uh(u,l,u,p,s,n);break;case po.Z:if(i){if(fh(c,d,u,p,e,s,n))return!0}else h+=uh(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},Bh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Rh=Symbol.for("VWindow"),Lh=Symbol.for("WindowHandlerContribution");let Oh=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&&(ql.getNamed(Lh,t.env).configure(this,t),this.actived=!0)},this._uid=ba.GenAutoIncrementId(),this.global=Il.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)}};Oh=Ph([Oa(),Bh("design:paramtypes",[])],Oh);var Ih=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fh=function(t,e){return function(i,s){e(i,s,t)}};let jh=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=Il.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=Eh.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:vl.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:vl.fontFamily,fontSize:vl.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=ql.get(Rh),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 zh;jh=Ih([Oa(),Fh(0,Ra(qa)),Fh(0,Ia(Xl)),Dh("design:paramtypes",[Object])],jh),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(zh||(zh={}));const Hh=new oe;let Vh=class{constructor(){this.matrix=new oe}init(t){return this.mode=zh.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=zh.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Hh.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(Hh.a,Hh.b,Hh.c,Hh.d,Hh.e,Hh.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Hh.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(Hh.a,Hh.b,Hh.c,Hh.d,Hh.e,Hh.f),this}scale(t,e,i){return this.mode===zh.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===zh.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Hh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Hh.a,Hh.b,Hh.c,Hh.d,Hh.e,Hh.f),this}translate(t,e){return this.mode===zh.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===zh.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Vh=Ih([Oa(),Dh("design:paramtypes",[])],Vh);const Nh={arc:xl,area:Sl,circle:Al,line:Tl,path:wl,symbol:Pl,text:Bl,rect:El,polygon:Cl,richtext:Rl,richtextIcon:Ol,image:Ll,group:kl,glyph:Ml},Gh=Object.keys(Nh);function Wh(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Uh={arc:Object.assign({},Nh.arc),area:Object.assign({},Nh.area),circle:Object.assign({},Nh.circle),line:Object.assign({},Nh.line),path:Object.assign({},Nh.path),symbol:Object.assign({},Nh.symbol),text:Object.assign({},Nh.text),rect:Object.assign({},Nh.rect),polygon:Object.assign({},Nh.polygon),richtext:Object.assign({},Nh.richtext),richtextIcon:Object.assign({},Nh.richtextIcon),image:Object.assign({},Nh.image),group:Object.assign({},Nh.group),glyph:Object.assign({},Nh.glyph)};class Yh{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Gh.forEach((t=>{this._defaultTheme[t]=Object.create(Uh[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;Gh.forEach((s=>{const n=Object.create(Uh[s]);t&&t[s]&&Wh(n,t[s]),i[s]&&Wh(n,i[s]),e[s]&&Wh(n,e[s]),this.combinedTheme[s]=n})),e.common&&Gh.forEach((t=>{Wh(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 Kh=new Yh;function Xh(t,e){return t.glyphHost?Xh(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)):Kh.getTheme()}return null}(t)||t.attachedThemeGraphic&&Xh(t.attachedThemeGraphic)||Kh.getTheme()}var $h=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=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 $h(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 Qh))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(sc(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 Qh))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=sc(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 Qh))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=sc(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 Qh))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=sc(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 Qh))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=ic.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(sc(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(sc(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,sc(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 Qh))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"):sc(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 tc))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=ic.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 nc(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 Qh,this.rootWheelEvent=new tc,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 lc{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return lc.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 hc{static Avaliable(){return!0}avaliable(){return hc.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 cc{static Avaliable(){return!!Il.global.getRequestAnimationFrame()}avaliable(){return cc.Avaliable()}tick(t,e){Il.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var dc;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(dc||(dc={}));class uc{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-uc.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*uc.bounceIn(2*t):.5*uc.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}}}uc.quadIn=uc.getPowIn(2),uc.quadOut=uc.getPowOut(2),uc.quadInOut=uc.getPowInOut(2),uc.cubicIn=uc.getPowIn(3),uc.cubicOut=uc.getPowOut(3),uc.cubicInOut=uc.getPowInOut(3),uc.quartIn=uc.getPowIn(4),uc.quartOut=uc.getPowOut(4),uc.quartInOut=uc.getPowInOut(4),uc.quintIn=uc.getPowIn(5),uc.quintOut=uc.getPowOut(5),uc.quintInOut=uc.getPowInOut(5),uc.backIn=uc.getBackIn(1.7),uc.backOut=uc.getBackOut(1.7),uc.backInOut=uc.getBackInOut(1.7),uc.elasticIn=uc.getElasticIn(1,.3),uc.elasticOut=uc.getElasticOut(1,.3),uc.elasticInOut=uc.getElasticInOut(1,.3*1.5);class pc{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 gc=new pc;class mc{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(){}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 fc extends mc{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let vc=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]:gc;this.id=t,this.timeline=e,this.status=Ao.INITIAL,this.tailAnimate=new _c(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.duration===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 fc((()=>{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 _c(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()}};vc.mode=ko.NORMAL,vc.interpolateMap=new Map;class _c{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 yc(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?uc[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?uc[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 yc(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 yc{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 bc=200,xc="cubicOut",Sc=1e3,Ac="quadInOut";var kc;!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"}(kc||(kc={}));const Mc=[!1,!1,!1,!1],Tc=[0,0,0,0],wc=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Tc[0]=t[0],Tc[2]=t[0],Tc[1]=t[1],Tc[3]=t[1],Tc):t:t:0,Cc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Ec=[1,2,3,0,1,2,3,0];function Pc(t,e,i,s){for(;t>=Rt;)t-=Rt;for(;t<0;)t+=Rt;for(;t>e;)e+=Rt;Cc[0].x=i,Cc[1].y=i,Cc[2].x=-i,Cc[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]:Ic.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)}}Ic.TimeOut=1e3/60;const Dc=new Ic,Fc=(t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class jc extends mc{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 zc;!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"}(zc||(zc={}));class Hc extends mc{constructor(t,e,i,s,n){super(t,e,i,s,n),this.newPointAnimateType="appear"===(null==n?void 0:n.newPointAnimateType)?"appear":"grow"}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}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?[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=Bc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),i.points=this.points}}class Vc extends mc{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 Nc extends Vc{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=Il.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 Gc extends Vc{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=Il.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 Wc extends mc{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 Uc extends mc{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?uc[n]:n;e=r(e),s.onUpdate(t,e,i)})),this.updating=!1)}}function Yc(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 Kc(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 Qc(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 td(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 sd(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}))),ad=(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]},od=(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 ad(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return ad(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);od(n[0],s,i),od(n[1],e-s,i)}};var ld;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(ld||(ld={}));class hd{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ld.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===ld.Color1){const e=hd.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];hd.store1[t]=e,hd.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=hd.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&&(hd.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],hd.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===ld.Color1){if(hd.store1[t])return;hd.store1[t]=i,hd.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(hd.store255[t])return;hd.store255[t]=i,hd.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function cd(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 dd(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)=>ud(y(t)?t[r]:t,y(e)?e[r]:e,i,s))):ud(t,e,i,s,n)}function ud(t,e,i,s,n){if(!t||!e)return t&&cd(t)||e&&cd(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=hd.Get(t,ld.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=hd.Get(e,ld.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:cd(a)})))});return o?dd(r,l,i,s,n):dd(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:md(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:md(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:md(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),cd(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)}hd.store255={},hd.store1={};const pd=[0,0,0,0],gd=[0,0,0,0];function md(t,e,i){return hd.Get(t,ld.Color255,pd),hd.Get(e,ld.Color255,gd),`rgba(${Math.round(pd[0]+(gd[0]-pd[0])*i)},${Math.round(pd[1]+(gd[1]-pd[1])*i)},${Math.round(pd[2]+(gd[2]-pd[2])*i)},${pd[3]+(gd[3]-pd[3])*i})`}const fd=(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=dd(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},vd=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?Qc(t):[],n=Qc(e);i&&s&&(i.fromTransform&&td(s,i.fromTransform.clone().getInverse()),td(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})))},yd=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],bd=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!yd.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]?hd.Get(t[n],ld.Color255):t[n],to:"string"==typeof r?hd.Get(r,ld.Color255):r,key:n}):i.push({from:t[n],to:r,key:n}),s=!0)})),s?i:null};class xd extends mc{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;vd(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&fd(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Sd=(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=_d(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=bd(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 xd({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Sc,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Ac)),c};class Ad extends mc{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;vd(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&&fd(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const kd=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Lc.includes(t))(i)||(e[i]=t[i])})),e},Md=(t,e,i)=>{const s=kd(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=Il.graphicService.creator.rect({x:0,y:0,width:a,height:o});n.appendChild(i),e.push(i)}))}},Td=(t,e,i)=>{const s=[],n=i?null:kd(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:kd(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=id(t.attribute),n=sd(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(Il.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=sd(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(Il.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=sd(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(Il.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 nd(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 nd(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(Il.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:rd(i)}];const s=[];return od(i,e,s),s})(t,e).forEach((t=>{s.push(Il.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 od(r,e,h),h})(t,e).forEach((t=>{s.push(Il.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=Qc(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(Il.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(Il.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Md(t,s,e),s};class Cd{static GetImage(t,e){var i;const s=Cd.cache.get(t);s?"fail"===s.loadState?Il.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):Cd.loadImage(t,e)}static GetSvg(t,e){var i;let s=Cd.cache.get(t);s?"fail"===s.loadState?Il.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"},Cd.cache.set(t,s),s.dataPromise=Il.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=Cd.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"},Cd.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Il.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Il.global.loadBlob(t):"json"===e&&(i.dataPromise=Il.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Cd.isLoading&&Cd.toLoadAueue.length){Cd.isLoading=!0;const t=Cd.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Cd.cache.set(i,n),n.dataPromise=Il.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((()=>{Cd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Cd.loading()})).catch((t=>{console.error(t),Cd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Cd.loading()}))}}),0)}static loadImage(t,e){const i=Ed(t,Cd.toLoadAueue);if(-1!==i)return Cd.toLoadAueue[i].marks.push(e),void Cd.loading();Cd.toLoadAueue.push({url:t,marks:[e]}),Cd.loading()}static improveImageLoading(t){const e=Ed(t,Cd.toLoadAueue);if(-1!==e){const t=Cd.toLoadAueue.splice(e,1);Cd.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Ed(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;Dd.x=n+(null!==(i=t.scrollX)&&void 0!==i?i:0),Dd.y=r+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else Dd.x=n,Dd.y=r;return Dd}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Il.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Il.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]:Rd;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Rd;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(Il.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:bc,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:xc),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 Bd.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(Bd),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=pl.x,y:e=pl.y,scaleX:i=pl.scaleX,scaleY:s=pl.scaleY,angle:n=pl.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),Il.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(pl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Pd.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),Il.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=dd(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=dd(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=dd(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 Xh(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:Il.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 cl).fromString(t):this.pathProxy=new cl,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",Il.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new ec(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)}}}jd.mixin(rc);class zd{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 Hd(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Vd(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 Nd=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class Gd{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=Vd(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Hd(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Vd(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 zd(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 zd(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 Wd(t,e){return Ud(t)}function Ud(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 Zd=0;function Jd(){return Zd++}var Qd;function tu(t){const e=[];let i=0,s="";for(let n=0;neu.set(t,!0)));const iu=new Map;function su(t){if(eu.has(t))return!0;if(iu.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>iu.set(t,!0)));const nu=Jd(),ru=Jd(),au=Jd(),ou=Jd(),lu=Jd(),hu=Jd(),cu=Jd(),du=Jd(),uu=Jd(),pu=Jd();Jd();const gu=Jd();Jd();const mu=Jd(),fu=Jd(),vu=Jd(),_u=Symbol.for("GraphicService"),yu=Symbol.for("GraphicCreator"),bu={"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"},xu=Object.keys(bu);var Su;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Su||(Su={}));let Au=class t extends jd{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=hu,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 Yh),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Yh)}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;Il.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),Il.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=pl.x,y:e=pl.y,dx:i=pl.dx,dy:s=pl.dy,scaleX:n=pl.scaleX,scaleY:r=pl.scaleY,angle:a=pl.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=Xh(this).group;this._AABBBounds.clear();const i=Il.graphicService.updateGroupAABBBounds(t,e,this._AABBBounds,this),{boundsPadding:s=e.boundsPadding}=t,n=wc(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(),Il.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Il.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,Il.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{Il.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),Il.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=Il.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 ku(t){return new Au(t)}Au.NOWORK_ANIMATE_ATTR=Fd;class Mu extends Au{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 Yh,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=>{Il.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=>{Il.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 Tu=Symbol.for("TransformUtil"),wu=Symbol.for("GraphicUtil"),Cu=Symbol.for("LayerService"),Eu=Symbol.for("StaticLayerHandlerContribution"),Pu=Symbol.for("DynamicLayerHandlerContribution"),Bu=Symbol.for("VirtualLayerHandlerContribution");var Ru,Lu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)};let Iu=Ru=class{static GenerateLayerId(){return`${Ru.idprefix}_${Ru.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Il.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(Eu):"dynamic"===t?ql.get(Pu):ql.get(Bu),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 Mu(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Ru.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)}};Iu.idprefix="visactor_layer",Iu.prefix_count=0,Iu=Ru=Lu([Oa(),Ou("design:paramtypes",[])],Iu);var Du=new xa((t=>{t(io).to(ao).inSingletonScope(),t(Rh).to(Oh),t(wu).to(jh).inSingletonScope(),t(Tu).to(Vh).inSingletonScope(),t(Cu).to(Iu).inSingletonScope()}));function Fu(t,e){return!(!t&&!e)}function ju(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function zu(t,e,i){return i&&t*e>0}function Hu(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Vu(t,e){return t*e>0}function Nu(t,e,i,s){return t*e>0&&0!==i&&0!==s}function Gu(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 Uu(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(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:m,outerEndAngle:f,innerEndAngle:v,innerStartAngle:_}=t.getParsePadAngle(o,l),y=u,b=u,x=u,S=u,A=Math.max(b,y),k=Math.max(x,S);let M=A,T=k;const w=n*It(m),C=n*jt(m),E=r*It(v),P=r*jt(v);let B,R,L,O;if((k>Ct||A>Ct)&&(B=n*It(f),R=n*jt(f),L=r*It(_),O=r*jt(_),hCt){const t=Ft(y,M),r=Ft(b,M),o=Wu(L,O,w,C,n,t,Number(c)),l=Wu(B,R,E,P,n,r,Number(c));M0&&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+B,s+n*jt(f))}else!a||a[0]?(e.moveTo(i+w,s+C),e.arc(i,s,n,m,f,!c)):e.moveTo(i+n*It(f),s+n*jt(f));if(!(r>Ct)||g<.001)!a||a[1]?e.lineTo(i+E,s+P):e.moveTo(i+E,s+P),d=!0;else if(T>Ct){const t=Ft(S,T),n=Ft(x,T),o=Wu(E,P,B,R,r,-n,Number(c)),l=Wu(w,C,L,O,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),T0&&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+L,s+O)}else!a||a[1]?e.lineTo(i+E,s+P):e.moveTo(i+E,s+P),!a||a[2]?e.arc(i,s,r,v,_,c):e.moveTo(i+r*It(_),s+r*jt(_))}return a?a[3]&&e.lineTo(i+n*It(o),s+n*jt(o)):e.closePath(),d}class Yu{static GetCanvas(){try{return Yu.canvas||(Yu.canvas=Il.global.createCanvas({})),Yu.canvas}catch(t){return null}}static GetCtx(){if(!Yu.ctx){const t=Yu.GetCanvas();Yu.ctx=t.getContext("2d")}return Yu.ctx}}class Ku extends le{static getInstance(){return Ku._instance||(Ku._instance=new Ku),Ku._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=Yu.GetCanvas(),s=Yu.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 Ku(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Xu{static GetSize(t){for(let e=0;e=t)return Xu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Xu.GenKey(t,e,i,s,n),l=Xu.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=Xu.GenKey(t,e,i,s,n);Xu.cache[l]?Xu.cache[l].push({width:a,height:o,pattern:r}):Xu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}Xu.cache={},Xu.ImageSize=[20,40,80,160,320,640,1280,2560];const $u=Symbol.for("ArcRenderContribution"),qu=Symbol.for("AreaRenderContribution"),Zu=Symbol.for("CircleRenderContribution"),Ju=Symbol.for("GroupRenderContribution"),Qu=Symbol.for("ImageRenderContribution"),tp=Symbol.for("PathRenderContribution"),ep=Symbol.for("PolygonRenderContribution"),ip=Symbol.for("RectRenderContribution"),sp=Symbol.for("SymbolRenderContribution"),np=Symbol.for("TextRenderContribution"),rp=Symbol.for("InteractiveSubRenderContribution"),ap=["radius","startAngle","endAngle",...Rd];class op extends jd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=ou}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=Xh(this).circle;this._AABBBounds.clear();const i=this.attribute,s=Il.graphicService.updateCircleAABBBounds(i,Xh(this).circle,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=wc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xh(this).circle[t]}needUpdateTags(t){return super.needUpdateTags(t,ap)}needUpdateTag(t){return super.needUpdateTag(t,ap)}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 cl;return o.arc(0,0,n,r,a),o}clone(){return new op(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return op.NOWORK_ANIMATE_ATTR}}function lp(t){return new op(t)}function hp(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 cp(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function dp(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)}op.NOWORK_ANIMATE_ATTR=Fd;class up{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=vu,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=Xh(this).text;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=this.attribute,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}updateWrapAABBBounds(t){var e,i,s,n;const r=Xh(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=Fc(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=Il.graphicUtil.textMeasure,k=new up(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===Qd.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=cp(x,o),M=dp(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=Xh(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=Fc(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 _=Il.graphicUtil.textMeasure,y=new up(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=Xh(this).text,a=Il.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=Fc(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=cp(x,o),e=this.cache.verticalList.length*b,i=dp(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=>tu(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===Qd.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=cp(x,o),M=this.cache.verticalList.length*b,T=dp(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 Xh(this).text[t]}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pp;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pp;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function mp(t){return new gp(t)}gp.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Fd),gp.baselineMapAlign={top:"left",bottom:"right",middle:"center"},gp.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class fp{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 vp(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 _p=new class extends fp{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 vp(t,e/2,i,s,n)}drawOffset(t,e,i,s,n,r){return vp(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 yp=new class extends fp{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 bp(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 xp=new class extends fp{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 bp(t,e/2,i,s,n)}drawFitDir(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)}};function Sp(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Ap=new class extends fp{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Sp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Sp(t,e/2+n,i,s)}};class kp extends fp{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 Mp=new kp;var Tp=new class extends kp{constructor(){super(...arguments),this.type="triangle"}};const wp=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Cp=Math.sin(Bt/10)*wp,Ep=-Math.cos(Bt/10)*wp;function Pp(t,e,i,s){const n=Cp*e,r=Ep*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 Bp=new class extends fp{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 Pp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Pp(t,e/2+n,i,s)}};const Rp=zt(3);function Lp(t,e,i,s){const n=e,r=n/Rp,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 Op=new class extends fp{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 Lp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Lp(t,e/2+n,i,s)}};function Ip(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 Dp=new class extends fp{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Ip(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Ip(t,e/2+n,i,s)}};function Fp(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var jp=new class extends fp{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}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)}};const zp=-.5,Hp=zt(3)/2,Vp=1/zt(12);function Np(t,e,i,s){const n=e/2,r=e*Vp,a=n,o=e*Vp+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(zp*n-Hp*r+i,Hp*n+zp*r+s),t.lineTo(zp*a-Hp*o+i,Hp*a+zp*o+s),t.lineTo(zp*l-Hp*h+i,Hp*l+zp*h+s),t.lineTo(zp*n+Hp*r+i,zp*r-Hp*n+s),t.lineTo(zp*a+Hp*o+i,zp*o-Hp*a+s),t.lineTo(zp*l+Hp*h+i,zp*h-Hp*l+s),t.closePath(),!1}var Gp=new class extends fp{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 Np(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Np(t,e/2+n,i,s)}};var Wp=new class extends fp{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 Up=new class extends fp{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 Yp=new class extends fp{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 Kp=zt(3);function Xp(t,e,i,s){const n=e*Kp;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var $p=new class extends kp{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Xp(t,e/2/Kp,i,s)}drawOffset(t,e,i,s,n){return Xp(t,e/2/Kp+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 Zp=new class extends fp{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 Jp(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 Qp=new class extends fp{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 Jp(t,e/4,i,s)}drawOffset(t,e,i,s,n){return Jp(t,e/4+n,i,s)}};function tg(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 eg=new class extends fp{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 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-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var sg=new class extends fp{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 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,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var rg=new class extends fp{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return ng(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return ng(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 ag(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var og=new class extends fp{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return ag(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return ag(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 lg(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 hg=new class extends fp{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 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-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function cg(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function dg(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var ug=new class extends fp{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)?dg(t,e,i,s):cg(t,e,i,s)}drawOffset(t,e,i,s,n){return S(e)?dg(t,e+2*n,i,s):cg(t,[e[0]+2*n,e[1]+2*n],i,s)}};const pg=new Qt;class gg{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;pg.x1=s.bounds.x1*t,pg.y1=s.bounds.y1*t,pg.x2=s.bounds.x2*t,pg.y2=s.bounds.y2*t,e.union(pg)}))}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 mg={};[_p,yp,xp,Ap,$p,Tp,Bp,Op,Dp,jp,Gp,Wp,Up,Mp,Yp,Zp,Qp,eg,sg,ug,rg,og,hg].forEach((t=>{mg[t.type]=t}));const fg={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"},vg=new Qt,_g=["symbolType","size",...Rd];let yg=class t extends jd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=fu}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=Xh(this).symbol;let{symbolType:i=e.symbolType}=this.attribute,s=mg[i];if(s)return this._parsedPath=s,s;if(s=t.userSymbolMap[i],s)return this._parsedPath=s,s;if(i=fg[i]||i,!0===((n=i).startsWith("{const e=(new cl).fromString(t.d),i={};xu.forEach((e=>{t[e]&&(i[bu[e]]=t[e])})),r.push({path:e,attribute:i}),vg.union(e.bounds)}));const a=vg.width(),o=vg.height(),l=1/Dt(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new gg(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var n;const r=(new cl).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 gg(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=Xh(this).symbol;this._AABBBounds.clear();const i=this.attribute,s=Il.graphicService.updateSymbolAABBBounds(i,Xh(this).symbol,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=wc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xh(this).symbol[t]}needUpdateTags(t){return super.needUpdateTags(t,_g)}needUpdateTag(t){return super.needUpdateTag(t,_g)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new cl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new cl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function bg(t){return new yg(t)}yg.userSymbolMap={},yg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Fd);const xg=["segments","points","curveType",...Rd];let Sg=class t extends jd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=du}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=Rc(i,s,e))}doUpdateAABBBounds(){const t=Xh(this).line;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateLineAABBBounds(e,Xh(this).line,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xh(this).line[t]}needUpdateTags(t){return super.needUpdateTags(t,xg)}needUpdateTag(t){return super.needUpdateTag(t,xg)}toCustomPath(){const t=this.attribute,e=new cl,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 Ag(t){return new Sg(t)}Sg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Fd);const kg=["width","x1","y1","height","cornerRadius",...Rd];class Mg extends jd{constructor(t){super(t),this.type="rect",this.numberType=gu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}doUpdateAABBBounds(){const t=Xh(this).rect;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateRectAABBBounds(e,Xh(this).rect,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xh(this).rect[t]}needUpdateTags(t){return super.needUpdateTags(t,kg)}needUpdateTag(t){return super.needUpdateTag(t,kg)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:s,height:n}=id(t),r=new cl;return r.moveTo(e,i),r.rect(e,i,s,n),r}clone(){return new Mg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Mg.NOWORK_ANIMATE_ATTR}}function Tg(t){return new Mg(t)}Mg.NOWORK_ANIMATE_ATTR=Fd;class wg extends jd{constructor(t){super(t),this.type="glyph",this.numberType=lu,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=Il.graphicService.updateGlyphAABBBounds(this.attribute,Xh(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 wg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return wg.NOWORK_ANIMATE_ATTR}}function Cg(t){return new wg(t)}wg.NOWORK_ANIMATE_ATTR=Fd;class Eg{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=Dl[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 Pg{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const s=Fc(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}=Wl(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}=Wl(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=Nl(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}=Wl(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||jl;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||Fl;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=Nl(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Wl(this.text.slice(t),this.character);return i+this.ellipsisWidth-s}return i}}const Bg=["width","height","image",...Rd];class Rg extends jd{constructor(t){super(t),this.type="image",this.numberType=cu,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=Xh(this).image;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateImageAABBBounds(e,Xh(this).image,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Ll[t]}needUpdateTags(t){return super.needUpdateTags(t,Bg)}needUpdateTag(t){return super.needUpdateTag(t,Bg)}clone(){return new Rg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Rg.NOWORK_ANIMATE_ATTR}}function Lg(t){return new Rg(t)}Rg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Fd);class Og extends Rg{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=wc(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=wc(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=Ll.width,height:e=Ll.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 Ig{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 Og?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=Dl[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Pg){const e=Vl.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 Og)break;if("vertical"===this.direction&&"vertical"!==s.direction){s.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";s.ellipsisStr=r;const{width:a}=Wl(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 Og)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 Og)break;const{width:n}=Wl(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 Og?t.width:t.getWidthWithEllips(this.direction)})),i}}class Dg{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=Dl[this.direction]}store(t){if(t instanceof Og){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 Ig(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 Og?"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=Nl(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 Pg(i,t.newLine,t.character),new Pg(s,!0,t.character)]}(t,s);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const Fg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...Rd];class jg extends jd{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=mu}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Rl.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:Rl.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:Rl.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:Rl.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:Rl.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:Rl.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:Rl.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:Rl.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=Xh(this).richtext;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateRichTextAABBBounds(e,Xh(this).richtext,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Rl[t]}needUpdateTags(t){return super.needUpdateTags(t,Fg)}needUpdateTag(t){return super.needUpdateTag(t,Fg)}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(){var t;const{textConfig:e=[],maxWidth:i,maxHeight:s,width:n,height:r,ellipsis:a,wordBreak:o,verticalDirection:l,textAlign:h,textBaseline:c,layoutDirection:d,singleLine:u,disableAutoWrapLine:p}=this.attribute,g=[];for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,g.push(t)}}else{const i=this.combinedStyleToCharacter(e[t]);if(S(i.text)&&(i.text=`${i.text}`),i.text&&i.text.includes("\n")){const t=i.text.split("\n");for(let e=0;e0,f="number"==typeof s&&Number.isFinite(s)&&s>0,v="number"==typeof n&&Number.isFinite(n)&&n>0&&(!m||n<=i),_="number"==typeof r&&Number.isFinite(r)&&r>0&&(!f||r<=s),y=new Eg(0,0,(v?n:m?i:0)||0,(_?r:f?s:0)||0,a,o,l,h,c,d||"horizontal",!v&&m,!_&&f,u||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),b=new Dg(y);if(p){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 jg.NOWORK_ANIMATE_ATTR}}function zg(t){return new jg(t)}jg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Fd);const Hg=["path","customPath",...Rd];class Vg extends jd{constructor(t){super(t),this.type="path",this.numberType=uu}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=Xh(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof cl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof cl?this.cache:t.path)}doUpdateAABBBounds(){const t=Xh(this).path;this.doUpdatePathShape(),this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updatePathAABBBounds(e,Xh(this).path,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new cl).fromString(t.path):t.customPath&&(this.cache=new cl,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Xh(this).path[t]}needUpdateTags(t){return super.needUpdateTags(t,Hg)}needUpdateTag(t){return super.needUpdateTag(t,Hg)}toCustomPath(){return(new cl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Vg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Vg.NOWORK_ANIMATE_ATTR}}function Ng(t){return new Vg(t)}Vg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Fd);const Gg=["segments","points","curveType",...Rd];class Wg extends jd{constructor(t){super(t),this.type="area",this.numberType=au}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=Xh(this).area;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updateAreaAABBBounds(e,Xh(this).area,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Rc(i,s,e))}getDefaultAttribute(t){return Xh(this).area[t]}needUpdateTags(t){return super.needUpdateTags(t,Gg)}needUpdateTag(t){return super.needUpdateTag(t,Gg)}toCustomPath(){const t=new cl,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 Wg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Wg.NOWORK_ANIMATE_ATTR}}function Ug(t){return new Wg(t)}Wg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Fd);const Yg=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Rd];class Kg extends jd{constructor(t){super(t),this.type="arc",this.numberType=nu}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=Xh(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);return Math.min(S(e,!0)?e:a*parseFloat(e)/100,a/2)}getParsedAngle(){const t=Xh(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=Xh(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=Nt(Number(l)/o*jt(g)),n=Nt(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=Xh(this).arc;this._AABBBounds.clear();const i=this.attribute,s=Il.graphicService.updateArcAABBBounds(i,Xh(this).arc,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=wc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return super.needUpdateTags(t,Yg)}needUpdateTag(t){return super.needUpdateTag(t,Yg)}getDefaultAttribute(t){return Xh(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 Kg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Kg.NOWORK_ANIMATE_ATTR}}function Xg(t){return new Kg(t)}Kg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Fd);const $g=["points","cornerRadius",...Rd];class qg extends jd{constructor(t){super(t),this.type="polygon",this.numberType=pu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=Xh(this).polygon;this._AABBBounds.clear();const e=this.attribute,i=Il.graphicService.updatePolygonAABBBounds(e,Xh(this).polygon,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=wc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Rc(i,s,e))}getDefaultAttribute(t){return Xh(this).polygon[t]}needUpdateTags(t){return super.needUpdateTags(t,$g)}needUpdateTag(t){return super.needUpdateTag(t,$g)}toCustomPath(){const t=this.attribute.points,e=new cl;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 Zg(t){return new qg(t)}qg.NOWORK_ANIMATE_ATTR=Fd;class Jg extends Au{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 Qg(t){return new Jg(t)}class tm{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 em extends tm{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 im{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 im.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},am=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},om=function(t,e){return function(i,s){e(i,s,t)}};function lm(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 hm(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 cm(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 dm(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),lm(t,t,[n+o,r+l,a+h]),lm(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),lm(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=nm.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]}lm(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),lm(i,i,[-s[0],-s[1],0]),cm(t,t,i)}}let um=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 tm],this._symbolBoundsContribitions=[new em],this._imageBoundsContribitions=[new tm],this._circleBoundsContribitions=[new tm],this._arcBoundsContribitions=[new tm],this._pathBoundsContribitions=[new tm]}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,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}=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 h=this.tempAABBBounds1,c=this.tempAABBBounds2;return h.setValue(i.x1,i.y1,i.x2,i.y2),c.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=dp(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=cp(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),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}=t,r=i;return n.forEach((t=>{r.add(t.x,t.y)})),r}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{r.add(t.x,t.y)}))})),r}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):Pc(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):(Pc(h,l,n,i),Pc(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&&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)}};um=rm([Oa(),om(0,Ra(yu)),am("design:paramtypes",[Object])],um);const pm=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 gm,mm;function fm(t){return gm||(gm=pm.CreateGraphic("text",{})),gm.initAttributes(t),gm.AABBBounds}const vm={x:0,y:0,z:0,lastModelMatrix:null};class _m{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=zu(o,l,n),p=Vu(o,c),g=Fu(n,r),m=ju(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;vm.x=n,vm.y=r,vm.z=a,vm.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=nm.allocate(),n=nm.allocate();dm(n,t,e),cm(s,d||s,n),vm.x=0,vm.y=0,vm.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),nm.free(n)}if(g&&!d){const s=t.getOffsetXY(e);vm.x+=s.x,vm.y+=s.y,vm.z=a,i.setTransformForCurrent()}else if(p)vm.x=0,vm.y=0,vm.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);vm.x+=s.x,vm.y+=s.y,this.transformWithoutTranslate(i,vm.x,vm.y,vm.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),vm.x=0,vm.y=0,vm.z=0;return vm}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=Xh(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,_=zu(d,u,h),y=Vu(d,g),b=Fu(h),x=ju(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&&nm.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}const ym=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 bm{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(bm.IsGradientStr(t))try{const e=ym(t)[0];if(e){if("linear"===e.type)return bm.ParseLinear(e);if("radial"===e.type)return bm.ParseRadial(e);if("conic"===e.type)return bm.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 xm(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 Sm(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 Am=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},km=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mm=function(t,e){return function(i,s){e(i,s,t)}};class Tm{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=Xh(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=Eh.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),Eh.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 wm=new Tm;let Cm=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)}))}};Cm=Am([Oa(),Mm(0,Ra(qa)),Mm(0,Ia(rp)),km("design:paramtypes",[Object])],Cm);class Em{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=Eh.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])),Eh.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 Pm=new Em;const Bm=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=xm(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T+r,innerRadius:M-r,startAngle:_-a,endAngle:y+a}),e.beginPath(),Uu(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=xm(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T-r,innerRadius:M+r,startAngle:_+a,endAngle:y-a}),e.beginPath(),Uu(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})}},Rm=Pm,Lm=wm;const Om=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=xm(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=xm(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()}}}},Im=Pm,Dm=wm;const Fm=new class extends Tm{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()}},jm=Et/2;function zm(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],-jm,0,!1)}if(t.lineTo(_[0],_[1]),!q(v,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,jm,!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],jm,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+jm,!1)}return t.closePath(),t}var Hm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Vm{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=xm(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(),zm(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=xm(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(),zm(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 Nm=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)}};Nm=Hm([Oa()],Nm);let Gm=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()}}};Gm=Hm([Oa()],Gm);const Wm=new Vm,Um=Pm,Ym=wm;const Km=new class extends Vm{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)}},Xm=new class extends Tm{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=Xh(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=wc(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?zm(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 $m=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=xm(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=xm(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=Pm,Zm=wm;var Jm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},tf=function(t,e){return function(i,s){e(i,s,t)}};let ef=class extends _m{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=nu,this.builtinContributions=[Bm,Lm,Rm],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||T>Ct)&&(O=n*It(y),I=n*jt(y),D=r*It(x),F=r*jt(x),uCt){const t=Ft(S,C),r=Ft(A,C),a=Wu(D,F,P,B,n,t,Number(p)),o=Wu(O,I,R,L,n,r,Number(p));if(C0&&e.arc(i+o.cx,s+o.cy,r,Ot(o.y11,o.x11),Ot(o.y01,o.x01),!p)}}else e.moveTo(i+P,s+B);if(!(r>Ct)||v<.001)e.lineTo(i+R,s+L),g=!0;else if(E>Ct){const t=Ft(M,E),n=Ft(k,E),a=Wu(R,L,O,I,r,-n,Number(p)),o=Wu(P,B,D,F,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),E0&&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(x),s+r*jt(x));return g}drawShape(t,e,i,s,n,r,a,o){const l=Xh(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++)Mc[s]=t,i&&(i=!(null!==(e=Mc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Mc[e]=!!t[e],i&&(i=!!Mc[e]);else Mc[0]=!1,Mc[1]=!1,Mc[2]=!1,Mc[3]=!1;return{isFullStroke:i,stroke:Mc}})(d);if((v||C)&&(e.beginPath(),Uu(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(),Uu(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),dd(o.color,l.color,h,!1)}(0,0,h,n);a||zu&&(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=Xh(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}};ef=Jm([Oa(),tf(0,Ra(qa)),tf(0,Ia($u)),Qm("design:paramtypes",[Object])],ef);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 _m{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=ou,this.builtinContributions=[Om,Dm,Im],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Xh(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=Xh(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function of(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 lf(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),of(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 cf=class extends _m{constructor(){super(...arguments),this.numberType=du}draw(t,e,i,s){const n=Xh(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;lf(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(),lf(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"===f)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=hl(t.points,f,{startPoint:e});return s=n,n})).filter((t=>!!t)),"linearClosed"===f){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===v){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],v,_,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=v*r;let g=0,m=!1;t.cache.forEach(((r,f)=>{if(m)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(m=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[f],[l,t.attribute],Ft(y,1),_,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,v,_,i,s,t,a,o)}};function df(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 uf(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),of(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),of(t,l,1,s),o=!1):o=!0}t.closePath()}cf=hf([Oa()],cf);const pf=new class extends Em{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:Oc(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Oc(l,"textureColor")),textureSize:b=(null!==(m=t.attribute.textureSize)&&void 0!==m?m:Oc(l,"textureSize")),texturePadding:x=(null!==(f=t.attribute.texturePadding)&&void 0!==f?f:Oc(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},gf=wm;var mf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ff=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)}};function _f(t,e,i){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"linearClosed":return ll(t,i)}}let yf=class extends _m{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=au,this.builtinContributions=[pf,gf],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=Xh(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}=t.attribute,b=this.valid(t,g,a,o);if(!b)return;const{doFill:x,doStroke:S}=b,{clipRange:A=g.clipRange,closePath:k,points:M,segments:T}=t.attribute;let{curveType:w=g.curveType}=t.attribute;if(k&&"linear"===w&&(w="linearClosed"),1===A&&!T&&!M.some((t=>!1===t.defined))&&"linear"===w)return this.drawLinearAreaHighPerformance(t,e,!!m,S,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(T&&T.length){let e,i;const s=T.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=_f(t.points,w,{startPoint:e});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=T.length-1;t>=0;t--){const e=T[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=T[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=_f(i,"stepBefore"===w?"stepAfter":"stepAfter"===w?"stepBefore":w),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!M||!M.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=M,i=[];for(let t=M.length-1;t>=0;t--)i.push({x:null!==(u=M[t].x1)&&void 0!==u?u:M[t].x,y:null!==(p=M[t].y1)&&void 0!==p?p:M[t].y});const s=_f(e,w),n=_f(i,"stepBefore"===w?"stepAfter":"stepAfter"===w?"stepBefore":w);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===A){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,x,v,S,y,r[c],[g,t.attribute],A,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=A*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,x,v,S,y,r[u],[g,t.attribute],Ft(m,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,x,v,S,y,t.attribute,g,A,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Xh(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=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),df(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),df(t,e,i,s),e.length=0,i.length=0)}n=o})),df(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},Af=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kf=function(t,e){return function(i,s){e(i,s,t)}};let Mf=class extends _m{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=uu,this.builtinContributions=[xf,bf],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:Xh(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=Xh(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Mf=Sf([Oa(),kf(0,Ra(qa)),kf(0,Ia(tp)),Af("design:paramtypes",[Object])],Mf);var Tf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 _m{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=gu,this.builtinContributions=[Wm,Ym,Um],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Xh(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=Hu(g,m,k,M,c),w=Nu(g,v,k,M),C=Fu(c,d),E=ju(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(),zm(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=Xh(t,null==s?void 0:s.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Ef=Tf([Oa(),Cf(0,Ra(qa)),Cf(0,Ia(ip)),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 _m{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=fu,this.builtinContributions=[$m,Zm,qm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=Xh(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=Xh(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Lf=Pf([Oa(),Rf(0,Ra(qa)),Rf(0,Ia(sp)),Bf("design:paramtypes",[Object])],Lf);const Of=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 If=new class extends Tm{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=Of.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=fm(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?(zm(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&&Of.free(C),w()}};var Df=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ff=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jf=function(t,e){return function(i,s){e(i,s,t)}};let zf=class extends _m{constructor(t){super(),this.textRenderContribitions=t,this.numberType=vu,this.builtinContributions=[If],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Xh(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=Fc(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=sm.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),sm.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=Xh(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=cp(l,f),_=dp(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=dp("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 Hf(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},Yf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kf=function(t,e){return function(i,s){e(i,s,t)}};let Xf=class extends _m{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=pu,this.builtinContributions=[Wf,Gf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Xh(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))?Hf(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 Hf(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=Vf(d,u),b=Vf(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*f);const S=Nf(h,_,y,d,u),A=Nf(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Vf(k,M),w=Nf(h,Vf(_,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=Xh(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Xf=Uf([Oa(),Kf(0,Ra(qa)),Kf(0,Ia(ep)),Yf("design:paramtypes",[Object])],Xf);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},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)}};const Jf=["","repeat-x","repeat-y","repeat"];let Qf=class extends _m{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=cu,this.builtinContributions=[Km,Xm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Xh(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(),zm(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,Jf[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 Cd.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Xh(t).image;this._draw(t,a,!1,i)}};Qf=$f([Oa(),Zf(0,Ra(qa)),Zf(0,Ia(Qu)),qf("design:paramtypes",[Object])],Qf);const tv=Symbol.for("IncrementalDrawContribution"),ev=Symbol.for("ArcRender"),iv=Symbol.for("AreaRender"),sv=Symbol.for("CircleRender"),nv=Symbol.for("GraphicRender"),rv=Symbol.for("GroupRender"),av=Symbol.for("LineRender"),ov=Symbol.for("PathRender"),lv=Symbol.for("PolygonRender"),hv=Symbol.for("RectRender"),cv=Symbol.for("SymbolRender"),dv=Symbol.for("TextRender"),uv=Symbol.for("RichTextRender"),pv=Symbol.for("GlyphRender"),gv=Symbol.for("ImageRender"),mv=Symbol.for("DrawContribution");var fv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)};const _v=Symbol.for("DrawItemInterceptor"),yv=new Qt,bv=new Qt;class xv{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return t.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){yv.copy(s.dirtyBounds),bv.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(yv),s.backupDirtyBounds.copy(bv)),!0}}class Sv{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 Av=class{constructor(){this.order=1,this.interceptors=[new xv,new Mv,new kv,new Sv]}afterDrawItem(t,e,i,s,n){for(let r=0;r(e=t.numberType===ru,!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&&nm.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Tv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},Cv=function(t,e){return function(i,s){e(i,s,t)}};const Ev=Symbol.for("RenderService");let Pv=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}};Pv=Tv([Oa(),Cv(0,Ra(mv)),wv("design:paramtypes",[Object])],Pv);var Bv=new xa((t=>{t(Ev).to(Pv)}));const Rv=Symbol.for("PickerService"),Lv=Symbol.for("GlobalPickerService");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};const Iv=Symbol.for("PickItemInterceptor");let Dv=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){if(!t.shadowRoot)return null;const{parentMatrix:r}=n||{};if(!r)return null;const a=e.pickContext;a.highPerformanceSave();const o=t.shadowRoot,l=sm.allocateByObj(r),h=new $t(l.a*i.x+l.c*i.y+l.e,l.b*i.x+l.d*i.y+l.f),c=e.pickGroup(o,h,l,s);return a.highPerformanceRestore(),c}};Dv=Ov([Oa()],Dv);let Fv=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}};Fv=Ov([Oa()],Fv);let jv=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===ru,!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()}};jv=Ov([Oa()],jv);var zv=new xa(((t,e,i)=>{i(Rv)||(t(Lv).toSelf(),t(Rv).toService(Lv)),t(jv).toSelf().inSingletonScope(),t(Iv).toService(jv),t(Dv).toSelf().inSingletonScope(),t(Iv).toService(Dv),t(Fv).toSelf().inSingletonScope(),t(Iv).toService(Fv),Ja(t,Iv)})),Hv=new xa((t=>{t(_u).to(um).inSingletonScope(),t(yu).toConstantValue(pm)}));const Vv=Symbol.for("AutoEnablePlugins"),Nv=Symbol.for("PluginService");var Gv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},Uv=function(t,e){return function(i,s){e(i,s,t)}};let Yv=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(Vv)&&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=[]}};Yv=Gv([Oa(),Uv(0,Ra(qa)),Uv(0,Ia(Vv)),Wv("design:paramtypes",[Object])],Yv);var Kv=new xa((t=>{t(Nv).to(Yv),function(t,e){t(qa).toDynamicValue((t=>{let{container:i}=t;return new Za(e,i)})).whenTargetNamed(e)}(t,Vv)})),Xv=new xa((t=>{Ja(t,eo)})),$v=new xa((t=>{t(Xl).to($l).inSingletonScope(),Ja(t,Xl)})),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)};let Jv=class{constructor(){this.type="static",this.offscreen=!1,this.global=Il.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=Ql({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()}};Jv=qv([Oa(),Zv("design:paramtypes",[])],Jv);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},t_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let e_=class{constructor(){this.offscreen=!1,this.type="virtual",this.global=Il.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(){}};e_=Qv([Oa(),t_("design:paramtypes",[])],e_);var i_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},s_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let n_=class{constructor(){this.offscreen=!0,this.type="dynamic",this.global=Il.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;const s=Ql({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){}};n_=i_([Oa(),s_("design:paramtypes",[])],n_);var r_=new xa((t=>{t(Jv).toSelf(),t(n_).toSelf(),t(e_).toSelf(),t(Eu).toService(Jv),t(Pu).toService(n_),t(Bu).toService(e_)}));var a_=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 o_(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 a_(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,s)}))}function h_(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 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)},u_=function(t,e){return function(i,s){e(i,s,t)}};let p_=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=Il.global,this.layerService=Il.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:bl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:bl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,sm.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=h_(e,i,bl.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=Of.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=sm.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))})):o_(t,bl.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),Of.free(n),sm.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(tv);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},m_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},f_=function(t,e){return function(i,s){e(i,s,t)}};let v_=class{constructor(t){this.groupRenderContribitions=t,this.numberType=hu}drawShape(t,e,i,s,n,r,a,o){const l=Xh(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=Hu(u,f,p,g,h),k=Nu(u,v,p,g),M=Fu(h,c),T=ju(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(),zm(e,i,s,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Fm));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=Xh(t,null==s?void 0:s.theme).group,l=n.modelMatrix;if(n.camera){const e=nm.allocate(),i=nm.allocate();dm(i,t,o),cm(e,l||e,i),n.modelMatrix=e,nm.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&&nm.free(n.modelMatrix),n.modelMatrix=l,n.baseGlobalAlpha/=a,d&&d.then?d.then((()=>{r?n.restore():n.highPerformanceRestore()})):r?n.restore():n.highPerformanceRestore()}};v_=g_([Oa(),f_(0,Ra(qa)),f_(0,Ia(Ju)),m_("design:paramtypes",[Object])],v_);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};let y_=class extends cf{constructor(){super(...arguments),this.numberType=du}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=Xh(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=zu(u,p,c),_=Vu(u,g),y=Fu(c),b=ju(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())}};y_=__([Oa()],y_);var b_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 x_=class extends yf{constructor(){super(...arguments),this.numberType=au}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=Xh(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=zu(u,d,c),m=Fu(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())}};x_=b_([Oa()],x_);var S_,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},k_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},M_=function(t,e){return function(i,s){e(i,s,t)}},T_=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"}(S_||(S_={}));let w_=class extends p_{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=S_.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 T_(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:bl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:bl.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 T_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return T_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>T_(this,void 0,void 0,(function*(){if(2!==t.count)yield l_(t,bl.zIndex,((i,s)=>{if(this.status===S_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return T_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return T_(this,void 0,void 0,(function*(){this.rendering&&(this.status=S_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=S_.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 T_(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:()=>T_(this,void 0,void 0,(function*(){yield l_(t,bl.zIndex,(t=>T_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};w_=A_([Oa(),M_(0,La(nv)),M_(1,Ra(y_)),M_(2,Ra(x_)),M_(3,Ra(qa)),M_(3,Ia(_v)),k_("design:paramtypes",[Array,Object,Object,Object])],w_);var C_=new xa((t=>{t(Tm).toSelf().inSingletonScope(),t(Em).toSelf().inSingletonScope(),t(mv).to(p_),t(tv).to(w_),t(rv).to(v_).inSingletonScope(),t(nv).toService(rv),Ja(t,Ju),t(Cm).toSelf().inSingletonScope(),Ja(t,rp),Ja(t,nv),t(Av).toSelf().inSingletonScope(),t(_v).toService(Av),Ja(t,_v)}));function E_(){E_.__loaded||(E_.__loaded=!0,ql.load(Du),ql.load(Hv),ql.load(Bv),ql.load(zv),ql.load(Kv),function(t){t.load(Xv),t.load($v),t.load(r_)}(ql),function(t){t.load(C_)}(ql))}E_.__loaded=!1,E_();const P_=ql.get(io);Il.global=P_;const B_=ql.get(wu);Il.graphicUtil=B_;const R_=ql.get(Tu);Il.transformUtil=R_;const L_=ql.get(_u);Il.graphicService=L_;const O_=ql.get(Cu);Il.layerService=O_;class I_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ba.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Il.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),Il.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){Il.graphicService.hooks.onAttributeUpdate.taps=Il.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onSetStage.taps=Il.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class D_{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 F_{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,Il.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))})),Il.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){Il.graphicService.hooks.onAddIncremental.taps=Il.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onClearIncremental.taps=Il.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Il.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 j_{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)),Il.graphicService.hooks.onRemove.unTap(this.key),Il.graphicService.hooks.onRelease.unTap(this.key),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?Il.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:Il.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return function(t){const e={};return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[ni(i)]=t[i])})),["fontSize","lineHeight"].forEach((i=>{const s=ni(i);u(t[i])||(e[s]=/^[0-9]*$/.test(`${t[i]}`)?`${t[i]}px`:`${t[i]}`)})),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:Xh(t).text)}getTransformOfText(t){const e=Xh(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=Il.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),f=o+m.left-p.left,v=l+m.top-p.top;if(a.left=`${f}px`,a.top=`${v}px`,"text"===t.type&&"position"===c&&(a=Object.assign(Object.assign({},a),this.getTransformOfText(t))),d(n.style)){const e=n.style({top:v,left:f,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)));Il.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"===Il.global.env&&(t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:bl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:bl.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&&Il.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"===Il.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 z_=new Qt;class H_{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()})),Il.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&&(z_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(z_,t.parent&&t.parent.globalTransMatrix)))})),Il.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))})),Il.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){Il.graphicService.hooks.beforeUpdateAABBBounds.taps=Il.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.afterUpdateAABBBounds.taps=Il.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)),Il.graphicService.hooks.onRemove.taps=Il.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const V_=new Qt;class N_{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=Xh(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,Il.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),Il.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&V_.copy(s)})),Il.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(V_.equals(i)||this.tryLayout(t,!1))})),Il.graphicService.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1)}))}deactivate(t){Il.graphicService.hooks.onAttributeUpdate.taps=Il.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.beforeUpdateAABBBounds.taps=Il.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.afterUpdateAABBBounds.taps=Il.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onSetStage.taps=Il.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const G_=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===dc.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=dc.INITIAL,Il.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),Il.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:cc},{mode:"timeout",cons:hc},{mode:"manual",cons:lc}];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!==dc.INITIAL&&(this.status=dc.PAUSE,!0)}resume(){return this.status!==dc.INITIAL&&(this.status=dc.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===dc.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===dc.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=dc.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=dc.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};G_.addTimeline(gc),G_.setFPS(60);class W_{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=hd.Get(e,ld.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)?hd.Get(e,ld.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}function U_(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 Y_(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 K_{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=nm.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=nm.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()})),i&&Il.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))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])this.htmlMap[o].root.render(r);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t){const i=n.createRoot(t);i.render(r),this.htmlMap||(this.htmlMap={}),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}}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 Z_="white";class J_ extends Au{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:Z_}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 Yh,this.hooks={beforeRender:new to(["stage"]),afterRender:new to(["stage"])},this.global=Il.global,!this.global.env&&$_()&&this.global.setEnv("browser"),this.window=ql.get(Rh),this.renderService=ql.get(Ev),this.pluginService=ql.get(Nv),this.layerService=ql.get(Cu),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:Z_,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||G_,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new pc,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 oc(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 W_(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 K_(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 D_))}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 I_))}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 F_))}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 H_,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 N_))}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 j_))}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){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(){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){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(){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];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];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){this.pickerService||(this.pickerService=ql.get(Rv));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){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){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;const e=ql.get(Rh),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;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 Q_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ty=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ey=new oe(1,0,0,1,0,0),iy={x:0,y:0};let sy=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 cl,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 sm.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(sm.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(sm.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},iy),function(t,e,i){return Ch(t,0,!1,e,i)}(this.path.commandList,iy.x,iy.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},iy);const i=xm(this,this.lineWidth,this.dpr);return function(t,e,i,s){return Ch(t,e,!0,i,s)}(this.path.commandList,i,iy.x,iy.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(ey,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=>sm.free(t))),this.stack.length=0}};sy=Q_([Oa(),ty("design:paramtypes",[Object,Number])],sy);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},ry=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ay={WIDTH:500,HEIGHT:500,DPR:1};let oy=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=ay.WIDTH,height:n=ay.HEIGHT,dpr:r=ay.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)}};oy.env="browser",oy=ny([Oa(),ry("design:paramtypes",[Object])],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};let hy=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}}};hy=ly([Oa()],hy);var cy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let uy=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}};uy=cy([Oa(),dy("design:paramtypes",[])],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)},my=function(t,e){return function(i,s){e(i,s,t)}};let fy=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=Il.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=nm.allocate();if(hm(i,e),a){if(i){const t=nm.allocate();r.modelMatrix=cm(t,a,i),nm.free(i)}}else hm(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=Xh(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=Xh(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&&nm.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),sm.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function vy(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&&vy(t,e,a,s,n),n.push(t[a],t[a+1]),i-a>2&&vy(t,a,i,s,n))}function _y(t,e){const i=t.length-1,s=[t[0]];return vy(t,0,i,e,s),s.push(t[i]),s}fy=py([Oa(),my(0,Ra(qa)),my(0,Ia(Iv)),gy("design:paramtypes",[Object])],fy);let yy=!1;const by=new xa((t=>{yy||(yy=!0,t(ef).toSelf().inSingletonScope(),t(ev).to(ef).inSingletonScope(),t(nv).toService(ev),t($u).toService(Cm),Ja(t,$u))}));let xy=!1;const Sy=new xa((t=>{xy||(xy=!0,t(Ef).toSelf().inSingletonScope(),t(hv).to(Ef).inSingletonScope(),t(nv).toService(hv),t(Gm).toSelf(),t(Nm).toSelf(),t(ip).toService(Gm),t(ip).toService(Nm),t(ip).toService(Cm),Ja(t,ip))}));let Ay=!1;const ky=new xa((t=>{Ay||(Ay=!0,t(cf).toSelf().inSingletonScope(),t(y_).toSelf().inSingletonScope(),t(av).to(cf).inSingletonScope(),t(nv).toService(av))}));let My=!1;const Ty=new xa((t=>{My||(My=!0,t(yf).toSelf().inSingletonScope(),t(iv).to(yf).inSingletonScope(),t(nv).toService(iv),t(qu).toService(Cm),Ja(t,qu),t(x_).toSelf().inSingletonScope())}));let wy=!1;const Cy=new xa((t=>{wy||(wy=!0,t(Lf).toSelf().inSingletonScope(),t(cv).to(Lf).inSingletonScope(),t(nv).toService(cv),t(sp).toService(Cm),Ja(t,sp))}));let Ey=!1;const Py=new xa((t=>{Ey||(Ey=!0,t(af).toSelf().inSingletonScope(),t(sv).to(af).inSingletonScope(),t(nv).toService(sv),t(Zu).toService(Cm),Ja(t,Zu))}));let By=!1;const Ry=new xa((t=>{By||(By=!0,t(dv).to(zf).inSingletonScope(),t(nv).toService(dv),t(np).toService(Cm),Ja(t,np))}));let Ly=!1;const Oy=new xa((t=>{Ly||(Ly=!0,t(Mf).toSelf().inSingletonScope(),t(ov).to(Mf).inSingletonScope(),t(nv).toService(ov),t(tp).toService(Cm),Ja(t,tp))}));let Iy=!1;const Dy=new xa((t=>{Iy||(Iy=!0,t(lv).to(Xf).inSingletonScope(),t(nv).toService(lv),t(ep).toService(Cm),Ja(t,ep))}));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};let jy=class{constructor(){this.numberType=lu}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=Xh(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};jy=Fy([Oa()],jy);let zy=!1;const Hy=new xa((t=>{zy||(zy=!0,t(pv).to(jy).inSingletonScope(),t(nv).toService(pv))}));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},Ny=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Gy=class extends _m{constructor(){super(),this.numberType=mu,this.builtinContributions=[If],this.init()}drawShape(t,e,i,s,n){const r=Xh(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=zu(o,l,!0),d=zu(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=Xh(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(),zm(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=Xh(t).richtext;this._draw(t,s,!1,i)}};Gy=Vy([Oa(),Ny("design:paramtypes",[])],Gy);let Wy=!1;const Uy=new xa((t=>{Wy||(Wy=!0,t(uv).to(Gy).inSingletonScope(),t(nv).toService(uv))}));let Yy=!1;const Ky=new xa((t=>{Yy||(Yy=!0,t(gv).to(Qf).inSingletonScope(),t(nv).toService(gv),t(Qu).toService(Cm),Ja(t,Qu))}));const Xy=(t,e)=>(d(qy.warnHandler)&&qy.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),$y=(t,e,i)=>{if(!d(qy.errorHandler))throw new Error(t);qy.errorHandler.call(null,t,e)},qy={silent:!1,warnHandler:!1,errorHandler:!1},Zy=$_(),Jy=Zy&&globalThis?globalThis.document:void 0;function Qy(t){return("desktop-browser"===t||"mobile-browser"===t)&&Zy}function tb(t){return eb(t)||"mobile-browser"===t}function eb(t){return t.includes("miniApp")||"lynx"===t||"wx"===t}let ib=0;function sb(){return ib>=9999999&&(ib=0),ib++}function nb(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function rb(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const ab=(t,e,i)=>(t.fields=e||[],t.fname=i,t),ob=t=>e=>R(e,t),lb=t=>{at.getInstance().error(t)},hb=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||lb("Access path missing open bracket: "+t),o>0&&h(),o=0,s=n+1):n>s?h():s=n+1}return o&&lb("Access path missing closing bracket: "+t),a&&lb("Access path missing closing quote: "+t),n>s&&(n+=1,h()),e})(t),n=1===s.length?s[0]:t;return ab((i&&i.get||ob)(s),[n],e||n)},cb=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(y(t)){const s=t.map((t=>hb(t,e,i)));return t=>s.map((e=>e(t)))}return hb(t,e,i)};cb("id");const db=ab((function(t){return t}),[],"identity"),ub=ab((function(){return 0}),[],"zero");ab((function(){return 1}),[],"one"),ab((function(){return!0}),[],"true"),ab((function(){return!1}),[],"false"),ab((function(){return{}}),[],"emptyObject");const pb=(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=>gb(t,r,n)))))},mb=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t;function fb(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 vb(t,e,i,s,n){let r=0,a=0;return fb(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function _b(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;fb(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:vb(t,e,i,n,h)}}function yb(t){return"horizontal"===t}function bb(t){return"vertical"===t}const xb=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Sb extends Au{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,xb.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=>xb.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"},Zb=(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 Jb 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=ic.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=ic.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=Zb(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=ic.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=Zb(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=ic.now()-i>this.config.press.time&&Zb(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},tx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ex=[0,0,0];let ix=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({},gl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},fl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},vl),{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 sm.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&&(sm.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(sm.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&&Xu.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&&(Y_(ex,[t,e,i],this.modelMatrix),t=ex[0],e=ex[1],i=ex[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&&(Y_(ex,[t,e,i],this.modelMatrix),t=ex[0],e=ex[1],i=ex[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Y_(ex,[e,i,s],this.modelMatrix),e=ex[0],i=ex[1],s=ex[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]:Il.global.measureTextMethod;var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Il.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:vl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:vl.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&&(Y_(ex,[e,i,s],this.modelMatrix),e=ex[0],i=ex[1],s=ex[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=Sm(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=xm(this,l,this.dpr),r.strokeStyle=Sm(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=hp(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=hp(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=>sm.free(t))),this.stack.length=0}};ix.env="browser",ix=Qb([Oa(),tx("design:paramtypes",[Object,Number])],ix);var 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},nx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let rx=class extends oy{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Il.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new ix(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 ax(t,e){return new xa((i=>{i(Zl).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Jl).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}rx.env="browser",rx=sx([Oa(),nx("design:paramtypes",[Object])],rx);const ox=ax(rx,ix);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},hx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cx=function(t,e){return function(i,s){e(i,s,t)}};let dx=class extends fy{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=Eh.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 px=class{constructor(){this.type="group",this.numberType=hu}contains(t,e,i){return!1}};px=ux([Oa()],px);const gx=new xa(((t,e,i,s)=>{gx.__vloaded||(gx.__vloaded=!0,t(Kb).to(px).inSingletonScope(),t(Xb).toService(Kb),Ja(t,Xb))}));gx.__vloaded=!1;var mx=gx;const fx=new xa(((t,e,i,s)=>{i(dx)||t(dx).toSelf().inSingletonScope(),i(Rv)?s(Rv).toService(dx):t(Rv).toService(dx)}));var vx,_x=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let bx=vx=class extends uy{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${vx.idprefix}_${vx.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Il.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:vx.GenerateCanvasId(),canvasControled:!0};this.canvas=new rx(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 rx({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)}};bx.env="browser",bx.idprefix="visactor_window",bx.prefix_count=0,bx=vx=_x([Oa(),yx("design:paramtypes",[])],bx);const xx=new xa((t=>{t(bx).toSelf(),t(Lh).toDynamicValue((t=>t.container.get(bx))).whenTargetNamed(bx.env)}));var 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)};class kx{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 Mx(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 Tx=class extends hy{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 kx(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 Mx(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Mx(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}}};Tx=Sx([Oa(),Ax("design:paramtypes",[])],Tx);const wx=new xa((t=>{wx.isBrowserBound||(wx.isBrowserBound=!0,t(Tx).toSelf().inSingletonScope(),t(eo).toService(Tx))}));function Cx(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Cx.__loaded||(Cx.__loaded=!0,t.load(wx),t.load(ox),t.load(xx),e&&function(t){t.load(mx),t.load(fx)}(t))}wx.isBrowserBound=!1,Cx.__loaded=!1;var Ex=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Px=class extends ix{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}};Px.env="feishu",Px=Ex([Oa()],Px);var Bx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Rx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Lx=class extends oy{constructor(t){super(t)}init(){this._context=new Px(this,this._dpr)}release(){}};Lx.env="feishu",Lx=Bx([Oa(),Rx("design:paramtypes",[Object])],Lx);const Ox=ax(Lx,Px);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)},Fx=function(t,e){return function(i,s){e(i,s,t)}};class jx{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 zx=class extends uy{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new jx}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 Lx(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 Lx({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()}};zx.env="feishu",zx=Ix([Oa(),Fx(0,Ra(io)),Dx("design:paramtypes",[Object])],zx);const Hx=new xa((t=>{t(zx).toSelf(),t(Lh).toDynamicValue((t=>t.container.get(zx))).whenTargetNamed(zx.env)}));var Vx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Gx=function(t,e){return function(i,s){e(i,s,t)}};let Wx=class extends fy{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 sy(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}};Wx=Vx([Oa(),Gx(0,Ra(qa)),Gx(0,Ia(Ab)),Gx(1,Ra(qa)),Gx(1,Ia(Iv)),Nx("design:paramtypes",[Object,Object])],Wx);const Ux=new xa((t=>{Ux.__vloaded||(Ux.__vloaded=!0,Ja(t,Ab))}));Ux.__vloaded=!1;var Yx=Ux,Kx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$x=function(t,e){return function(i,s){e(i,s,t)}};let qx=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=nu}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=Xh(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}};qx=Kx([Oa(),$x(0,Ra(ev)),Xx("design:paramtypes",[Object])],qx);let Zx=!1;const Jx=new xa(((t,e,i,s)=>{Zx||(Zx=!0,t(kb).to(qx).inSingletonScope(),t(Ab).toService(kb))}));var Qx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},eS=function(t,e){return function(i,s){e(i,s,t)}};let iS=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=au}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=Xh(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}};iS=Qx([Oa(),eS(0,Ra(iv)),tS("design:paramtypes",[Object])],iS);let sS=!1;const nS=new xa(((t,e,i,s)=>{sS||(sS=!0,t(Mb).to(iS).inSingletonScope(),t(Ab).toService(Mb))}));var rS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oS=function(t,e){return function(i,s){e(i,s,t)}};let lS=class{constructor(t){this.canvasRenderer=t,this.type="circle",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=Xh(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}};lS=rS([Oa(),oS(0,Ra(sv)),aS("design:paramtypes",[Object])],lS);let hS=!1;const cS=new xa(((t,e,i,s)=>{hS||(hS=!0,t(Tb).to(lS).inSingletonScope(),t(Ab).toService(Tb))}));var dS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pS=function(t,e){return function(i,s){e(i,s,t)}};let gS=class{constructor(t){this.canvasRenderer=t,this.type="glyph",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=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}};gS=dS([Oa(),pS(0,Ra(pv)),uS("design:paramtypes",[Object])],gS);let mS=!1;const fS=new xa(((t,e,i,s)=>{mS||(mS=!0,t(Ob).to(gS).inSingletonScope(),t(gS).toService(Ob))}));var vS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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{constructor(){this.type="image",this.numberType=cu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};_S=vS([Oa()],_S);let yS=!1;const bS=new xa(((t,e,i,s)=>{yS||(yS=!0,t(wb).to(_S).inSingletonScope(),t(_S).toService(wb))}));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},SS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},AS=function(t,e){return function(i,s){e(i,s,t)}};let kS=class{constructor(t){this.canvasRenderer=t,this.type="line",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=Xh(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}};kS=xS([Oa(),AS(0,Ra(av)),SS("design:paramtypes",[Object])],kS);let MS=!1;const TS=new xa(((t,e,i,s)=>{MS||(MS=!0,t(Cb).to(kS).inSingletonScope(),t(Ab).toService(Cb))}));var wS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ES=function(t,e){return function(i,s){e(i,s,t)}};let PS=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=pu}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=Xh(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}};PS=wS([Oa(),ES(0,Ra(lv)),CS("design:paramtypes",[Object])],PS);let BS=!1;const RS=new xa(((t,e,i,s)=>{BS||(BS=!0,t(Lb).to(PS).inSingletonScope(),t(Ab).toService(Lb))}));var LS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},OS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IS=function(t,e){return function(i,s){e(i,s,t)}};let DS=class{constructor(t){this.canvasRenderer=t,this.type="path",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=Xh(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}};DS=LS([Oa(),IS(0,Ra(ov)),OS("design:paramtypes",[Object])],DS);let FS=!1;const jS=new xa(((t,e,i,s)=>{FS||(FS=!0,t(Eb).to(DS).inSingletonScope(),t(Ab).toService(Eb))}));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},HS=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)}};const NS=new Qt;let GS=class{constructor(t){this.canvasRenderer=t,this.type="rect",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=Xh(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;NS.setValue(i.x1,i.y1,i.x2,i.y2),NS.expand(-r/2),h=!NS.containsPoint(e)}}return s.highPerformanceRestore(),h}};GS=zS([Oa(),VS(0,Ra(hv)),HS("design:paramtypes",[Object])],GS);let WS=!1;const US=new xa(((t,e,i,s)=>{WS||(WS=!0,t(Pb).to(GS).inSingletonScope(),t(Ab).toService(Pb))}));let YS=!1;const KS=new xa(((t,e,i,s)=>{YS||(YS=!0,t(wb).to(_S).inSingletonScope(),t(_S).toService(wb))}));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},$S=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qS=function(t,e){return function(i,s){e(i,s,t)}};let ZS=class{constructor(t){this.canvasRenderer=t,this.type="symbol",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=Xh(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}};ZS=XS([Oa(),qS(0,Ra(cv)),$S("design:paramtypes",[Object])],ZS);let JS=!1;const QS=new xa(((t,e,i,s)=>{JS||(JS=!0,t(Bb).to(ZS).inSingletonScope(),t(Ab).toService(Bb))}));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};let eA=class{constructor(){this.type="text",this.numberType=vu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};eA=tA([Oa()],eA);let iA=!1;const sA=new xa(((t,e,i,s)=>{iA||(iA=!0,t(Rb).to(eA).inSingletonScope(),t(Ab).toService(Rb))})),nA=new xa(((t,e,i,s)=>{i(Wx)||t(Wx).toSelf().inSingletonScope(),i(Rv)?s(Rv).toService(Wx):t(Rv).toService(Wx)}));class rA{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 aA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let lA=class extends hy{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 rA(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 Dc.call(t)}}getCancelAnimationFrame(){return t=>{Dc.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}};lA=aA([Oa(),oA("design:paramtypes",[])],lA);const hA=new xa((t=>{hA.isFeishuBound||(hA.isFeishuBound=!0,t(lA).toSelf().inSingletonScope(),t(eo).toService(lA))}));function cA(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];cA.__loaded||(cA.__loaded=!0,t.load(hA),t.load(Ox),t.load(Hx),e&&function(t){t.load(Yx),t.load(nA),t.load(Jx),t.load(nS),t.load(cS),t.load(fS),t.load(bS),t.load(TS),t.load(RS),t.load(jS),t.load(US),t.load(KS),t.load(QS),t.load(sA)}(t))}hA.isFeishuBound=!1,cA.__loaded=!1;var dA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let pA=class extends ix{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(){}};pA.env="node",pA=dA([Oa(),uA("design:paramtypes",[Object,Number])],pA);var gA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let fA=class extends oy{constructor(t){super(t)}init(){this._context=new pA(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};fA.env="node",fA=gA([Oa(),mA("design:paramtypes",[Object])],fA);const vA=ax(fA,pA);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)},bA=function(t,e){return function(i,s){e(i,s,t)}};let xA=class extends uy{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 fA(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 fA({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){}};xA.env="node",xA=_A([Oa(),bA(0,Ra(io)),yA("design:paramtypes",[Object])],xA);const SA=new xa((t=>{t(xA).toSelf(),t(Lh).toDynamicValue((t=>t.container.get(xA))).whenTargetNamed(xA.env)}));var AA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 kA=class extends hy{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 Dc.call(t)}}getCancelAnimationFrame(){return t=>{Dc.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};kA=AA([Oa()],kA);const MA=new xa((t=>{MA.isNodeBound||(MA.isNodeBound=!0,t(kA).toSelf().inSingletonScope(),t(eo).toService(kA))}));function TA(t){TA.__loaded||(TA.__loaded=!0,t.load(MA),t.load(vA),t.load(SA))}MA.isNodeBound=!1,TA.__loaded=!1;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},CA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},EA=function(t,e){return function(i,s){e(i,s,t)}};let PA=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=nu}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=Xh(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=xm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};PA=wA([Oa(),EA(0,Ra(ev)),CA("design:paramtypes",[Object])],PA);let BA=!1;const RA=new xa(((t,e,i,s)=>{BA||(BA=!0,t(Ib).to(PA).inSingletonScope(),t(Xb).toService(Ib))}));var LA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},OA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IA=function(t,e){return function(i,s){e(i,s,t)}};const DA=new Qt;let FA=class{constructor(t){this.canvasRenderer=t,this.type="rect",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=Xh(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=xm(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;DA.setValue(i.x1,i.y1,i.x2,i.y2),DA.expand(-r/2),h=!DA.containsPoint(e)}}return s.highPerformanceRestore(),h}};FA=LA([Oa(),IA(0,Ra(hv)),OA("design:paramtypes",[Object])],FA);let jA=!1;const zA=new xa(((t,e,i,s)=>{jA||(jA=!0,t(Vb).to(FA).inSingletonScope(),t(Xb).toService(Vb))}));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 VA=class extends _m{};VA=HA([Oa()],VA);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},GA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},WA=function(t,e){return function(i,s){e(i,s,t)}};let UA=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="line",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;s.highPerformanceSave();const n=Xh(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=xm(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&nm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};UA=NA([Oa(),WA(0,Ra(av)),GA("design:paramtypes",[Object])],UA);let YA=!1;const KA=new xa(((t,e,i,s)=>{YA||(YA=!0,t(zb).to(UA).inSingletonScope(),t(Xb).toService(zb))}));var XA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},qA=function(t,e){return function(i,s){e(i,s,t)}};let ZA=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=au}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=Xh(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=xm(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h})),s.highPerformanceRestore(),h}};ZA=XA([Oa(),qA(0,Ra(iv)),$A("design:paramtypes",[Object])],ZA);let JA=!1;const QA=new xa(((t,e,i,s)=>{JA||(JA=!0,t(Db).to(ZA).inSingletonScope(),t(Xb).toService(Db))}));var tk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ik=function(t,e){return function(i,s){e(i,s,t)}};let sk=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=fu}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=Xh(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=xm(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&nm.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};sk=tk([Oa(),ik(0,Ra(cv)),ek("design:paramtypes",[Object])],sk);let nk=!1;const rk=new xa(((t,e,i,s)=>{nk||(nk=!0,t(Nb).to(sk).inSingletonScope(),t(Xb).toService(Nb))}));var ak=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ok=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lk=function(t,e){return function(i,s){e(i,s,t)}};let hk=class{constructor(t){this.canvasRenderer=t,this.type="circle",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=Xh(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=xm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};hk=ak([Oa(),lk(0,Ra(sv)),ok("design:paramtypes",[Object])],hk);let ck=!1;const dk=new xa(((t,e,i,s)=>{ck||(ck=!0,t(Fb).to(hk).inSingletonScope(),t(Xb).toService(Fb))}));var uk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gk=function(t,e){return function(i,s){e(i,s,t)}};let mk=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=vu}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=Xh(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=dp(a,u,n),v=cp(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&&nm.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};mk=uk([Oa(),gk(0,Ra(dv)),pk("design:paramtypes",[Object])],mk);let fk=!1;const vk=new xa(((t,e,i,s)=>{fk||(fk=!0,t(Gb).to(mk).inSingletonScope(),t(Xb).toService(Gb))}));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},yk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bk=function(t,e){return function(i,s){e(i,s,t)}};let xk=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="path",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=Xh(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=xm(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&nm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};xk=_k([Oa(),bk(0,Ra(ov)),yk("design:paramtypes",[Object])],xk);let Sk=!1;const Ak=new xa(((t,e,i,s)=>{Sk||(Sk=!0,t(Hb).to(xk).inSingletonScope(),t(Xb).toService(Hb))}));var kk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mk=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 wk=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=pu}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=Xh(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=xm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};wk=kk([Oa(),Tk(0,Ra(lv)),Mk("design:paramtypes",[Object])],wk);let Ck=!1;const Ek=new xa(((t,e,i,s)=>{Ck||(Ck=!0,t(Wb).to(wk).inSingletonScope(),t(Xb).toService(Wb))}));var Pk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rk=function(t,e){return function(i,s){e(i,s,t)}};let Lk=class{constructor(t){this.canvasRenderer=t,this.type="glyph",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=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}};Lk=Pk([Oa(),Rk(0,Ra(pv)),Bk("design:paramtypes",[Object])],Lk);let Ok=!1;const Ik=new xa(((t,e,i,s)=>{Ok||(Ok=!0,t(Yb).to(Lk).inSingletonScope(),t(Xb).toService(Yb))}));var Dk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Fk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jk=function(t,e){return function(i,s){e(i,s,t)}};let zk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=mu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};zk=Dk([Oa(),jk(0,Ra(uv)),Fk("design:paramtypes",[Object])],zk);let Hk=!1;const Vk=new xa(((t,e,i,s)=>{Hk||(Hk=!0,t(Ub).to(zk).inSingletonScope(),t(Xb).toService(Ub))}));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};let Gk=class{constructor(){this.type="image",this.numberType=cu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Gk=Nk([Oa()],Gk);let Wk=!1;const Uk=new xa(((t,e,i,s)=>{Wk||(Wk=!0,t(jb).to(Gk).inSingletonScope(),t(Xb).toService(jb))})),Yk=$_();function Kk(){Kk.__loaded||(Kk.__loaded=!0,pm.RegisterGraphicCreator("arc",Xg),ql.load(by),ql.load(Yk?RA:Jx))}Kk.__loaded=!1;const Xk=Kk;function $k(){$k.__loaded||($k.__loaded=!0,pm.RegisterGraphicCreator("area",Ug),ql.load(Ty),ql.load(Yk?QA:nS))}$k.__loaded=!1;const qk=$k;function Zk(){Zk.__loaded||(Zk.__loaded=!0,pm.RegisterGraphicCreator("circle",lp),ql.load(Py),ql.load(Yk?dk:cS))}Zk.__loaded=!1;const Jk=Zk;function Qk(){Qk.__loaded||(Qk.__loaded=!0,pm.RegisterGraphicCreator("glyph",Cg),ql.load(Hy),ql.load(Yk?Ik:fS))}Qk.__loaded=!1;const tM=Qk;function eM(){eM.__loaded||(eM.__loaded=!0,pm.RegisterGraphicCreator("group",ku))}eM.__loaded=!1;const iM=eM;function sM(){sM.__loaded||(sM.__loaded=!0,pm.RegisterGraphicCreator("image",Lg),ql.load(Ky),ql.load(Yk?Uk:bS))}sM.__loaded=!1;const nM=sM;function rM(){rM.__loaded||(rM.__loaded=!0,pm.RegisterGraphicCreator("line",Ag),ql.load(ky),ql.load(Yk?KA:TS))}rM.__loaded=!1;const aM=rM;function oM(){oM.__loaded||(oM.__loaded=!0,pm.RegisterGraphicCreator("path",Ng),ql.load(Oy),ql.load(Yk?Ak:jS))}oM.__loaded=!1;const lM=oM;function hM(){hM.__loaded||(hM.__loaded=!0,pm.RegisterGraphicCreator("polygon",Zg),ql.load(Dy),ql.load(Yk?Ek:RS))}hM.__loaded=!1;const cM=hM;function dM(){dM.__loaded||(dM.__loaded=!0,pm.RegisterGraphicCreator("rect",Tg),ql.load(Sy),ql.load(Yk?zA:US))}dM.__loaded=!1;const uM=dM;function pM(){pM.__loaded||(pM.__loaded=!0,pm.RegisterGraphicCreator("richtext",zg),ql.load(Uy),ql.load(Yk?Vk:KS))}pM.__loaded=!1;const gM=pM;function mM(){mM.__loaded||(mM.__loaded=!0,pm.RegisterGraphicCreator("shadowRoot",Qg))}mM.__loaded=!1;const fM=mM;function vM(){vM.__loaded||(vM.__loaded=!0,pm.RegisterGraphicCreator("symbol",bg),ql.load(Cy),ql.load(Yk?rk:QS))}vM.__loaded=!1;const _M=vM;function yM(){yM.__loaded||(yM.__loaded=!0,pm.RegisterGraphicCreator("text",mp),ql.load(Ry),ql.load(Yk?vk:sA))}yM.__loaded=!1;const bM=yM;function xM(){iM(),uM()}const SM=-.5*Math.PI,AM=1.5*Math.PI,kM="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 MM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(MM||(MM={}));const TM={[MM.selectedReverse]:{},[MM.selected]:{},[MM.hover]:{},[MM.hoverReverse]:{}},wM={container:"",width:30,height:30,style:{}},CM={debounce:xt,throttle:St};xM();let EM=class t extends Sb{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"===P_.env?(P_.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),P_.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:CM[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"===P_.env?(P_.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),P_.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",CM[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 PM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&PM(t,e)}))}EM.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 BM=t=>!u(t)&&!1!==t.visible;function RM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function LM(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 IM=["#ffffff","#000000"];function DM(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 FM(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(...IM);for(const n of a)if(t!==n&&FM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function FM(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?jM(t,e)>s:"largeText"===i?jM(t,e)>3:jM(t,e)>4.5}function jM(t,e){const i=zM(t),s=zM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function zM(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 HM(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 VM(t,e){return[t[0]*e,t[1]*e]}function NM(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 GM=(t,e,i,s)=>new Qe(Object.assign({defaultFontParams:Object.assign({fontFamily:kM,fontSize:14},s),getTextBounds:i?void 0:fm,specialCharSet:"-/: .,@%'\"~"+Qe.ALPHABET_CHAR_SET+Qe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function WM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const s=fm({text:t,fontFamily:e.fontFamily||i.fontFamily||kM,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 UM(t){return"rich"===YM(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type")}function YM(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 KM(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 XM(t){const e=YM(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?pm.richtext(KM(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)),pm.text(t))}function $M(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 ZM(){iM(),uM(),_M(),gM(),bM()}var JM=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);nh&&(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,V=JM(a,["visible"]);if(m&&c(H)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},V),{visible:H&&!!s,x:I,y:D,width:k,height:M}),"rect");B(null==f?void 0:f.panel)||(t.states=f.panel),this._bgRect=t}}this._textShape=P}}QM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const tT={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}},eT={poptip:z({},tT)};var iT=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]]}}}}nT.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 rT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 aT=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,nT.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new nT(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,eT.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}))}};aT=rT([Oa()],aT);var oT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 lT=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)}};lT=oT([Oa()],lT);let hT=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)}};hT=oT([Oa()],hT);const cT=new xa(((t,e,i,s)=>{i(aT)||(t(aT).toSelf().inSingletonScope(),t(rp).toService(aT)),i(lT)||(t(lT).toSelf(),t(Vv).toService(lT)),i(hT)||(t(hT).toSelf(),t(Vv).toService(hT))}));class dT extends Sb{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}iM(),aM();class uT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},uT.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})}}uT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},iM(),uM();class pT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},pT.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})}}pT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},iM(),Xk();class gT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},gT.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)}}gT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},iM(),Xk();class mT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},mT.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=SM,endAngle:s=AM}=this.attribute,n=s-i,r=ee(ne(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}mT.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},iM(),lM();class fT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fT.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)}}fT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const vT=new Uint32Array(33),_T=new Uint32Array(33);_T[0]=0,vT[0]=~_T[0];for(let t=1;t<=32;++t)_T[t]=_T[t-1]<<1|1,vT[t]=~_T[t];function yT(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]&vT[31&l]&_T[1+(31&h)])return!0}else{if(i[c]&vT[31&l])return!0;if(i[d]&_T[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,vT[31&n]&_T[1+(31&r)]);else for(s(a,vT[31&n]),s(o,_T[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,_T[31&i]|vT[1+(31&s)]);else for(n(r,_T[31&i]),n(a,vT[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 bT(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 xT(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=bT(t,r),!(s&&e.outOfBounds(r)||e.getRange(r))}function ST(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 ST(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 ST(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 ST(t,e,n,s,h,c)}return!1}const kT=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],MT=["top","inside-top","inside"];function TT(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 wT={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 CT(t,e){var i,s;return null!==(s=null===(i=wT[e])||void 0===i?void 0:i.call(wT,t))&&void 0!==s?s:{from:{},to:{}}}const ET=(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 PT(t,e,i,s){t.attribute.text!==e.attribute.text&&k(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new jc({text:t.attribute.text},{text:e.attribute.text},i,s))}const BT={mode:"same-time",duration:300,easing:"linear"};function RT(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 LT(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 OT(t){return 3===t||4===t}function IT(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 DT=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)}},FT=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 jT(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 zT(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)}}iM(),bM(),gM(),aM();class HT extends Sb{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},HT.defaultAttributes,t)),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(MM.hover,!0),PM(this,(t=>{t===e||B(t.states)||t.addState(MM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(PM(this,(t=>{B(t.states)||(t.removeState(MM.hoverReverse),t.removeState(MM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void PM(this,(t=>{B(t.states)||(t.removeState(MM.selectedReverse),t.removeState(MM.selected))}));B(e.states)||(e.addState(MM.selected,!0),PM(this,(t=>{t===e||B(t.states)||t.addState(MM.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:[];(this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)]).forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(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[zT(g,m,c,d,a,o),zT(-g,-m,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds);if(i){const t=pm.line({points:i});return e&&e.attribute.fill&&t.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&t.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(t),t}}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)),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 XM(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&&y.setRange(bT(v,t.AABBBounds,!0))}))),m.length>0&&m.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&&y.setRange(bT(v,t.AABBBounds,!0))})):t.AABBBounds&&y.setRange(bT(v,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 i=new Map,s=this._graphicToText||new Map,n=[],r=[],{visible:a}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{const o=this.getRelatedGraphic(t.attribute),l=t.attribute.id,h=this._isCollectionBase?l:o,c=(null==s?void 0:s.get(h))?"update":"enter";let d;if(a&&(d=this._createLabelLine(t,o)),"enter"===c){if(n.push(t),i.set(h,d?{text:t,labelLine:d}:{text:t}),o){const{from:i,to:s}=CT(t.attribute,"fadeIn");this.add(t),d&&(r.push(d),this.add(d)),this._syncStateWithRelatedGraphic(o),this._animationConfig.enter.duration>0&&o.once("animate-bind",(a=>{t.setAttributes(i),d&&d.setAttributes(i);const l=this._afterRelatedGraphicAttributeUpdate(t,n,d,r,e,o,s,this._animationConfig.enter);o.on("afterAttributeUpdate",l)}))}}else if("update"===c){const e=s.get(h);s.delete(h),i.set(h,e);const n=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&&PT(t,e,s,n))}i.forEach(((i,s)=>{const{duration:n,easing:r,increaseEffect:a=!0,channel:o}=i,{from:l,to:h}=ET(t,e,o,i.options);B(h)||t.animate().to(h,n,r),"text"in l&&"text"in h&&a&&PT(t,e,n,r)}))})(n,t,this._animationConfig.update),e.labelLine&&d&&e.labelLine.animate().to(d.attribute,r,a)}})),s.forEach((t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(CT(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=i}_renderWithOutAnimation(t){var e;const i=new Map,s=this._graphicToText||new Map,{visible:n}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach((t=>{const e=this.getRelatedGraphic(t.attribute),r=(null==s?void 0:s.get(e))?"update":"enter",a=this._isCollectionBase?t.attribute.id:e;let o;if(n&&(o=this._createLabelLine(t,e)),"enter"===r)i.set(a,o?{text:t,labelLine:o}:{text:t}),this.add(t),o&&this.add(o),this._syncStateWithRelatedGraphic(e);else if("update"===r){const e=s.get(a);s.delete(a),i.set(a,e),e.text.setAttributes(t.attribute),e.labelLine&&o&&e.labelLine.setAttributes(o.attribute)}})),s.forEach((t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)})),this._graphicToText=i}_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)}}VT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};class NT extends HT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},NT.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}}}NT.tag="rect-label",NT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};let GT=class t extends HT{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 jT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};GT.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class WT{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 UT extends HT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UT.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:"…"}),n=this._createLabelText(s),r=this.getGraphicBounds(n),a=r.x2-r.x1,o=e.map((t=>t.attribute)),l=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),o,i,a);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=LT(l.endAngle-d/2),p=RT(h.x,h.y,l.outerRadius,o),g=RT(h.x,h.y,a+e.line.line1MinLength,o),m=new WT(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);m.pointA=RT(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):OT(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=RT(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=OT(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=OT(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=OT(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?OT(t.quadrant)?"left":"right":OT(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*(OT(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;e1&&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 jT(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 extends HT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},KT.defaultAttributes,t)),this.name="line-data-label"}labeling(t,e){return DT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}KT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const XT={rect:NT,symbol:VT,arc:UT,line:GT,area:YT,"line-data":KT};class $T extends Sb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},$T.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=yT(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(){iM(),aM(),cM(),_M()}function ZT(){iM(),aM(),Xk(),_M()}$T.defaultAttributes={pickable:!1},qT();class JT extends Sb{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({},JT.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=pm.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=pm.line;Y(i)[0].cornerRadius&&(t=pm.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=pm.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}}JT.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}}},ZT();class QT extends JT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JT.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=pm.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 tw,ew;!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"}(tw||(tw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(ew||(ew={}));const iw={[ew.selectedReverse]:{},[ew.selected]:{},[ew.hover]:{},[ew.hoverReverse]:{}},sw={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}}},nw=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 rw(t,e,i){return!mt(t,e,0,1e-6)&&!gt(t,i,0,1e-6)}function aw(t,e,i,s){const n=fm(Object.assign({text:i},s)),r=n.width(),a=n.height(),o=nw(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=rw(o,-l,-h)?((o+l)/c-.5)*r:rw(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=rw(o,-l,-h)?.5*-a:rw(o,h,l)?.5*a:Math.cos(o)>=0?(.5-(h-o)/c)*a:(.5-nw(o-l)/c)*a,{x:p,y:g-m}}function ow(t){const e={};return PM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function lw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function hw(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 VM(r,(s?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}const cw=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!B(s.states)?(s.addState(MM.hover,!0),PM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(MM.hoverReverse,!0)})),s):i},dw=(t,e,i)=>i?(PM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(MM.hoverReverse),t.removeState(MM.hover))})),null):i,uw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(MM.selected)?(PM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(MM.selectedReverse),t.removeState(MM.selected))})),null):s.name&&!B(s.states)?(s.addState(MM.selected,!0),PM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(MM.selectedReverse,!0)})),s):i};class pw extends Sb{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=cw(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=dw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=uw(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=pm.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&&ow(this._innerView),this.removeAllChild(!0),this._innerView=pm.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=pm.group({x:0,y:0,zIndex:1});if(a.name=tw.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=pm.group({x:0,y:0,pickable:!1});t.name=tw.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=pm.group({x:0,y:0,pickable:!1});i.name=tw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=pm.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=tw.tick,r.id=this._getNodeId(t.id),B(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=TM;else{const t=this.data[s],e=z({},TM,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=pm.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=tw.subTick,r.id=this._getNodeId(`${n}`),B(s.state))r.states=TM;else{const i=z({},TM,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=pm.group({x:0,y:0,pickable:!1});return r.name=`${tw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=XM(this._getLabelAttribute(t,e,n,i));if(a.name=tw.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=TM;else{const s=z({},TM,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 QM(Object.assign({},e));i.name=tw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return lw(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({},sw.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 gw(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 mw(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 fw={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&&vw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function vw(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 _w(t,e){for(let i,s=1,n=t.length,r=t[0];s1&&e.height()>1}function bw(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Aw(t,e.attribute.angle)),{angle:Sw(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({},kw(t,e.attribute.angle)),{angle:Sw(e.attribute.angle)}))}))}(t,e),gw(e)}function Sw(){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 Aw(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=Sw(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 kw(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=Sw(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 Mw{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 VM([s[1],-1*s[0]],t*(e?1:-1)*i)}}function Tw(){iM(),aM(),gM(),bM()}var ww=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=NM(_,[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({},iw,c.text),shape:z({},iw,c.shape),panel:z({},iw,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 Aw(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return kw(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)})),xw(i,t),!bw(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(yw);if(B(i))return;let s;s=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i),gw(s);const{method:n="parity",separation:r=0}=e,a=d(n)?n:fw[n]||fw.parity;if(s.length>=3&&_w(s,r)){do{s=a(s,r)}while(s.length>=3&&_w(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&&vw(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=pm.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=tw.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=WM(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}}Cw.defaultAttributes=sw,U(Cw,Mw);class Ew{isInValidValue(t){const{startAngle:e=SM,endAngle:i=AM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=SM,endAngle:i=AM,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 hw(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 Pw,Bw=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=pm.circle(c);d.name=tw.line,d.id=this._getNodeId("line"),B(a.state)||(d.states=z({},iw,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=Bw(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({},iw,d.text),shape:z({},iw,d.shape),panel:z({},iw,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 aw(t,e,i,s)}}Rw.defaultAttributes=sw,U(Rw,Ew);class Lw extends mc{constructor(){super(...arguments),this.mode=ko.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},PM(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{Iw[t]=!0}));const Hw=t=>-Math.log(-t),Vw=t=>-Math.exp(-t),Nw=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,Gw=t=>10===t?Nw:t===Math.E?Math.exp:e=>Math.pow(t,e),Ww=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Uw=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),Yw=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function Kw(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 Xw(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function $w(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),$w(t,i,s)*(e/(1-i))}function Zw(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function Jw(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 eC{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=Zw(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 iC=Symbol("implicit");class sC extends eC{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=Pw.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=iC}clone(){const t=(new sC).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!==iC)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 rC extends sC{constructor(t){super(),this.type=Pw.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:nC(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 nC(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 rC(!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:aC}=xe;function oC(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=aC(_e.parseColorString(t),s);return t=>e(t).formatRgb()}return At(Number(t),Number(e))}return e instanceof ye?aC(t,e):e instanceof _e?aC(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 lC extends eC{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:zw,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zw;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=zw,this._piecewise=Xw,this._interpolate=oC}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?Jw:Xw,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:zw),this.rescale(i)):this._clamp!==zw}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 hC=Math.sqrt(50),cC=Math.sqrt(10),dC=Math.sqrt(2),uC=[1,2,5,10],pC=(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=vC(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?mC(0,-(e-1)/s,s):mC((e-1)/s,0,s)},gC=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 pC(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return pC(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=mC(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=mC(t,e,l);return n&&r.reverse(),r})),vC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=uC[0];return i>=hC?s=uC[3]:i>=cC?s=uC[2]:i>=dC&&(s=uC[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function _C(t,e,i){const s=(e-t)/Math.max(0,i);return vC(s)}function yC(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=_C(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 xC(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 SC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),AC=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})),kC=ft(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=fC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?SC(t,e,n):SC(t,e,tC(n)),h=SC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),MC=ft(((t,e,i,s,n)=>yC(s(t),s(e),i).map((t=>tC(n(t))))));class TC extends lC{constructor(){super(...arguments),this.type=Pw.Linear}clone(){return(new TC).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 gC(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=fC(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 yC(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=xC(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=bC(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=bC(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=bC(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function wC(t){return e=>-t(-e)}function CC(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class EC extends lC{constructor(){super(Ww(10),Gw(10)),this.type=Pw.Log,this._limit=CC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new EC).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=Ww(this._base),s=Gw(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=wC(i),this._pows=wC(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=Hw,this.untransformer=Vw):(this._logs=i,this._pows=s,this._limit=CC(),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 zw}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 AC(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 kC(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 MC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return MC(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=xC(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=Qw(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 PC extends TC{constructor(){super(Uw(1),Yw(1)),this.type=Pw.Symlog,this._const=1}clone(){return(new PC).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=Uw(t),this.untransformer=Yw(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 AC(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 kC(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 MC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return MC(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=xC(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=Qw(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 BC{constructor(){this.type=Pw.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 BC).domain(this._domain).range(this._range).unknown(this._unknown)}}const RC=t=>t.map(((t,e)=>({index:e,value:t}))),LC=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 OC(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function IC(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=GM(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=DC(S,y,m[0],m[m.length-1]):a&&c&&s===e.length-1?T=DC(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=DC(A,b,m[0],m[m.length-1]):a&&d&&s===e.length-1?w=DC(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},jC=(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=GM(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=lw(o,hw(s,o,e,n));return aw(l,hw(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},zC={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&OC(i.AABBBounds,t.AABBBounds,e)||(i=t,0))))}},HC=(t,e,i,s)=>FC(t,e,i).map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),VC=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},NC=(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&&!VC(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?NC(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&&LC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},UC=(t,e)=>{if(Dw(t.type))return((t,e)=>{if(!Dw(t.type))return RC(t.domain());const i=t.range(),s=Math.abs(i[i.length-1]-i[0]);if(s<2)return RC([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=FC(t,h,e).map(((t,e)=>({AABBBounds:t,value:h[e]})));for(;n.length>=3&&IC(n,i);)n=zC.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 RC(h)})(t,e);if(jw(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?RC([s[s.length-1]]):RC([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=HC(t,s,e,c),l=Math.min(...n.map((t=>t[2]))),h=GC(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=HC(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 RC(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=jC(t,i,e),r=$(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=WC(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 RC(c)})(t,e)}return RC(t.domain())};function YC(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 KC(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 XC(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=YC(t,!!n),o=YC(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=KC(e,t,!1,!!n),o=KC(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=YC(t,!!n),o=YC(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class $C extends Sb{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&ow(this._innerView),this.removeAllChild(!0),this._innerView=pm.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 lw(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?`${tw.grid}-sub`:`${tw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=YC(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=KC(t,o,!1,!!a)}const u=pm.path(Object.assign({path:c,z:l},d(r)?z({},this.skipDefault?null:$C.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=YC(o,!!a),f=Lt(o[0].x-o[1].x),v=Lt(o[0].y-o[1].y),_=pm.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:$C.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,Mw);var ZC=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(JC,Ew);const QC="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",tE={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:QC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:QC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},eE={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 iE;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(iE||(iE={}));var sE=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=iE.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=iE.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=iE.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=iE.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=iE.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t),"browser"===P_.env&&(P_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),P_.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===iE.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===iE.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=iE.endHandler):h+=l:this._activeTag===iE.endHandler&&(c+l{t.preventDefault();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===iE.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"===P_.env&&(P_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),P_.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===iE.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===iE.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=sE(i,["formatMethod"]),{formatMethod:a}=s,o=sE(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:V={},brushSelect:N,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=V.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:N?"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),N&&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:N?"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:N?"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"},eE.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=V.symbolType)&&void 0!==y?y:"square"},eE.horizontal),V),{pickable:!G&&(null===(b=V.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},eE.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},eE.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"},eE.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=V.symbolType)&&void 0!==R?R:"square"},eE.vertical),V),{pickable:!G&&(null===(L=V.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},eE.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},eE.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 _y(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 QM(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 aE,oE,lE,hE;function cE(){iM(),ZM()}function dE(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 uE(t,e){const{dx:i,dy:s}=dE(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}rE.defaultAttributes=tE,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"}(aE||(aE={})),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"}(oE||(oE={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(lE||(lE={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(hE||(hE={}));class pE extends Sb{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=cw(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=dw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=uw(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=pm.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=pm.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=pm.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 gE(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 mE(t,e,i,s){t&&(gE(t.startSymbol,e,i,s),t.lines.forEach((t=>gE(t,e,i,s))),gE(t.line,e,i,s),gE(t.endSymbol,e,i,s))}function fE(t,e,i,s){t&&(gE(t.getTextShape(),e,i,s),gE(t.getBgRect(),e,i,s))}function vE(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 _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,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;gE(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)})),gE(t.endSymbol,s+r+a,o,n),gE(e.getTextShape(),s+r+a+o,l,n),gE(e.getBgRect(),s+r+a+o,l,n)}function xE(t,e,i,s,n){mE(t,s,i,n),fE(e,s,i,n)}function SE(t,e,i,s,n){gE(t,s,i,n),fE(e,s,i,n)}function AE(t,e,i,s,n){gE(t,s,i,n),fE(e,s,i,n)}function kE(t,e,i,s,n,r){var a;mE(t,n,s,r),gE(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?fE(i,n,s,r):gE(i,n,s,r)}function ME(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;gE(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)})),gE(e,n+o+l,h,r),gE(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(gE(i.getTextShape(),n+o+l+h+c,d,r),gE(i.getBgRect(),n+o+l+c,d,r)):gE(i,n+o+l+c,d,r)}function TE(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?bE(t,e,s,r,a):"fadeIn"===i&&xE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?bE(t,e,s,n,a):"fadeIn"===i&&xE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){_E(t,s,i,n),yE(e,s,i,n)}(t,e,i,s,n)}}function wE(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&&SE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&SE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){vE(t,s,i,n),yE(e,s,i,n)}(t,e,i,s,n)}}function CE(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&&AE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&AE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){vE(t,s,i,n),yE(e,s,i,n)}(t,e,i,s,n)}}function EE(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?kE(n,r,e,i,s,o):"callIn"===t&&ME(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?kE(n,r,e,i,s,a):"callIn"===t&&ME(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;_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)}(n,r,e,t,i,s)}}const PE={type:"clipIn",duration:500,easing:"linear",delay:0},BE={type:"fadeIn",duration:500,easing:"linear",delay:0},RE={type:"callIn",duration:500,easing:"linear",delay:0},LE={type:"fadeOut",duration:500,easing:"linear",delay:0};class OE extends pE{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=PE,this.defaultExitAnimation=LE}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;uE(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 QM(Object.assign(Object.assign({},e),{state:{panel:z({},TM,null==i?void 0:i.labelBackground),text:z({},TM,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({},TM,null==e?void 0:e.labelBackground),text:z({},TM,null==e?void 0:e.label)}})),this.setLabelPos())}}const IE=.001,DE={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:aE.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]}},FE={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"}}},jE={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:lE.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]}},zE={interactive:!0,label:{position:oE.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}},HE={interactive:!0,label:{position:lE.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}},VE={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"}},NE={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"}},GE={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 WE(){UE._animate=TE}cE(),qT();class UE extends OE{markerAnimate(t){UE._animate&&this._animationConfig&&UE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UE.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(RM(t)?t:t-Math.PI)+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}getTextStyle(t,e,i){return LM(Math.abs(e),Math.PI/2,IE)||LM(Math.abs(e),3*Math.PI/2,IE)?OM(i,e,t):RM(e)?FE.postiveXAxis[t]:FE.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new JT({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},TM,null==a?void 0:a.line),startSymbol:z({},TM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},TM,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({},TM,null==a?void 0:a.line),startSymbol:z({},TM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},TM,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 YE(){KE._animate=wE}UE.defaultAttributes=DE,cE(),cM();class KE extends pE{markerAnimate(t){KE._animate&&this._animationConfig&&KE._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({},KE.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=BE,this.defaultExitAnimation=LE}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({},NE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;uE(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=pm.polygon(Object.assign({points:e},s));r.states=z({},TM,null==n?void 0:n.area),r.name="mark-area-polygon",this._area=r,t.add(r);const a=new QM(Object.assign(Object.assign({},i),{state:{panel:z({},TM,null==n?void 0:n.labelBackground),text:z({},TM,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({},TM,null==s?void 0:s.area)),this._label&&this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},e),{state:{panel:z({},TM,null==s?void 0:s.labelBackground),text:z({},TM,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}}KE.defaultAttributes=zE,cE(),ZT();class XE extends OE{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,{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 lE.arcInnerStart:l=s;case lE.arcOuterStart:l=s;break;case lE.arcInnerEnd:l=n;case lE.arcOuterEnd:l=n;break;case lE.center:case lE.arcInnerMiddle:case lE.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 VE[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 QT({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},TM,null==o?void 0:o.line),startSymbol:z({},TM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},TM,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({},TM,null==o?void 0:o.line),startSymbol:z({},TM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},TM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}}XE.defaultAttributes=jE,cE(),Xk();class $E extends pE{markerAnimate(t){$E._animate&&this._animationConfig&&$E._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({},$E.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcArea",this.defaultUpdateAnimation=BE,this.defaultExitAnimation=LE}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 lE.center:h=(i+s)/2,c=(n+r)/2;break;case lE.arcInnerStart:h=i,c=n;break;case lE.arcOuterStart:h=s,c=n;break;case lE.arcInnerEnd:h=i,c=r;break;case lE.arcOuterEnd:h=s,c=r;break;case lE.arcInnerMiddle:h=i,c=(n+r)/2;break;case lE.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({},VE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;uE(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=pm.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));h.states=z({},TM,null==l?void 0:l.area),h.name="polar-mark-area-area",this._area=h,t.add(h);const c=new QM(Object.assign(Object.assign({},o),{state:{panel:z({},TM,null==l?void 0:l.labelBackground),text:z({},TM,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({},TM,null==o?void 0:o.area)),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},a),{state:{panel:z({},TM,null==o?void 0:o.labelBackground),text:z({},TM,null==o?void 0:o.label)}})),this.setLabelPos())}isValidPoints(){return!0}}function qE(){ZE._animate=EE}$E.defaultAttributes=HE,cE(),qT(),ZT(),_M(),nM(),aM();class ZE extends pE{markerAnimate(t){ZE._animate&&this._animationConfig&&ZE._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ZE.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=RE,this.defaultExitAnimation=LE,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return LM(Math.abs(s),Math.PI/2,IE)||LM(Math.abs(s),3*Math.PI/2,IE)?OM(t,s,n):RM(s)?GE.postiveXAxis[n]:GE.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=hE.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({},TM,null==m?void 0:m.textBackground),text:z({},TM,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({},TM,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({},TM,null==m?void 0:m.image));const y=RM(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=pm.symbol(Object.assign(Object.assign({},i),r)),h.states=z({},TM,null==s?void 0:s.symbol)):"text"===n?h=new QM(Object.assign(Object.assign({},i),{state:{panel:z({},TM,null==s?void 0:s.textBackground),text:z({},TM,null==s?void 0:s.text)}})):"richText"===n?(h=pm.richtext(Object.assign(Object.assign({},i),a)),h.states=z({},TM,null==s?void 0:s.richText)):"image"===n?(h=pm.image(Object.assign(Object.assign({},i),o)),h.states=z({},TM,null==s?void 0:s.image)):"custom"===n&&l&&(h=l(),h.states=z({},TM,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=LM(c,0,IE)||LM(d,0,IE),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(aP.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(aP.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===aP.focus||"focus"===o){const s=a.hasState(nP.focus);a.toggleState(nP.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[nP.unSelected,nP.unSelectedHover,nP.focus],t),this._setLegendItemState(e,nP.selected,t)})):(this._setLegendItemState(a,nP.selected,t),this._removeLegendItemState(a,[nP.unSelected,nP.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[nP.selected,nP.selectedHover,nP.focus],t),this._setLegendItemState(e,nP.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(nP.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(nP.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(rP.legendItemClick,a,t);i?(this._removeLegendItemState(a,[nP.selected,nP.selectedHover],t),this._setLegendItemState(a,nP.unSelected,t)):(this._setLegendItemState(a,nP.selected,t),this._removeLegendItemState(a,[nP.unSelected,nP.unSelectedHover],t))}else this._setLegendItemState(a,nP.selected,t),this._removeLegendItemState(a,[nP.unSelected,nP.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[nP.selected,nP.selectedHover],t),this._setLegendItemState(e,nP.unSelected,t))}))}this._dispatchLegendEvent(rP.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,nP.selected),this._removeLegendItemState(e,[nP.unSelected,nP.unSelectedHover])):(this._removeLegendItemState(e,[nP.selected,nP.selectedHover]),this._setLegendItemState(e,nP.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=eP,spaceRow:h=iP}=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;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):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=pm.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,aP.item,t,w)):(w=pm.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,aP.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?nP.selected:nP.unSelected);const C=pm.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=pm.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,aP.itemShape,t,w,S.state),s.addState(e?nP.selected:nP.unSelected),C.add(s)}let O=0;if(d){const e=R(g,"size",10);E=pm.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},g),{visible:!0,pickMode:"imprecise",boundsPadding:T})),this._appendDataToShape(E,aP.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=XM(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,aP.itemLabel,t,w,A.state),D.addState(e?nP.selected:nP.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=XM(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,aP.itemValue,t,w,k.state),r.addState(e?nP.selected:nP.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(),V=p(this.attribute.item.width)?this.attribute.item.width:z+T[1]+T[3],N=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=V,w.attribute.height=N,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 tP(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 tP(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 EM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:12},t),{width:e})):new EM(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=pm.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=eP,spaceRow:a=iP}=s,o=this._itemsContainer,{space:l=sP,defaultCurrent:h=1}=n,c=cP(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 _=pm.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(nP.selected)?this._setLegendItemState(t,nP.selectedHover,e):this._setLegendItemState(t,nP.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===aP.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(rP.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(nP.unSelectedHover)||t.hasState(nP.selectedHover))&&(i=!0),t.removeState(nP.unSelectedHover),t.removeState(nP.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(nP.unSelectedHover)&&!t.hasState(nP.selectedHover)||(i=!0),t.removeState(nP.unSelectedHover),t.removeState(nP.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===aP.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(rP.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(rP.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!==aP.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(rP.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!==aP.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(rP.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(nP.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({},dP,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(nP.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 pP;function gP(t){return y(t)?t:[t,t]}function mP(t){return t?"ew-resize":"ns-resize"}uP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:eP,spaceRow:iP,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:sP,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"}(pP||(pP={})),lP();class fP extends Sb{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({},fP.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"===P_.env?(P_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),P_.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"===P_.env?(P_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),P_.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"===P_.env?(P_.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),P_.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"===P_.env?(P_.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),P_.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:gP(d)[0],endValue:gP(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const m=pm.group({x:0,y:0});m.name=pP.innerView,this.add(m),this._innerView=m;let f,v=0;if(r&&r.visible){f=pm.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=pP.startText,m.add(f);const e=p(r.space)?r.space:0;v+=(g?f.AABBBounds.width():f.AABBBounds.height())+e}const _=pm.group({x:g?v:0,y:g?0:v});m.add(_);const y=pm.group({x:0,y:0});let b;if(y.name=pP.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=pm.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=pP.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=pm.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=pP.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]=gP(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":mP(p)},r));if(v.name=pP.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=f,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=pP.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":mP(p)},r));if(i.name=pP.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(m,"end");e.name=pP.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=pm.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=pP.trackContainer;const f=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===f?"pointer":mP(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=pm.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=pP.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return pm.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":mP(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),pm.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=pm.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=pm.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===pP.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===pP.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===pP.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===pP.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}}}fP.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}}},hP(),lP();class vP extends oP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},vP.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 _P(){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`}vP.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"}}},hP(),lP(),lM();class yP extends oP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},yP.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=pm.group({x:0,y:0});this._innerView.add(x);const S=new fP({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:_P(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=pm.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))}}yP.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)"}},iM(),bM(),gM();let bP=class t extends Sb{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,V,N,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},wM),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},wM),$),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!==(V=K.width)&&void 0!==V?V: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!==(N=$.width)&&void 0!==N?N: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"))}}}};bP.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 xP={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"}}};iM(),bM(),gM();let SP=class extends Sb{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==e)return void(o&&o.hideAll());if(p(i))if(!1!==i.visible){const t=z({},R(xP,"title.style"),i.style);UM(t)?this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},KM(t)),{visible:i.visible,x:0,y:0}),"richtext"):this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},t),{lineHeight:p(t.lineHeight)?t.lineHeight:t.fontSize,visible:i.visible,x:0,y:0}),"text"),i.autoFit&&k(a)&&this._setLocalAutoFit(a,this._title,i),i.autoLimit&&k(r)&&this._title.setAttribute("maxLineWidth",a)}else{const t=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}if(p(s)){const t=Y(s),e=[];t.forEach(((t,s)=>{if(!1!==t.visible){const n=z({},R(xP,"content.style"),t.style);let l;l=UM(n)?o.createOrUpdateChild("indicator-content-"+s,Object.assign(Object.assign({},KM(n)),{visible:i.visible,x:0,y:0}),"richtext"):o.createOrUpdateChild("indicator-content-"+s,Object.assign(Object.assign({},n),{lineHeight:p(n.lineHeight)?n.lineHeight:n.fontSize,visible:t.visible,x:0,y:0}),"text"),t.autoFit&&k(a)&&this._setLocalAutoFit(a,l,t),t.autoLimit&&k(r)&&l.setAttribute("maxLineWidth",a),e.push(l)}else{const t=o.find((t=>t.name==="indicator-content-"+s),!1);t&&o.removeChild(t)}})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.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=WM(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 AP extends yg{constructor(t){super(t)}}var kP,MP;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(kP||(kP={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(MP||(MP={}));class TP extends Sb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},TP.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"},TP.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"},TP.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},TP.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},TP.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 AP(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new AP(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new AP(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(kP.OnPlay)},this.pause=()=>{this._dispatchEvent(kP.OnPause)},this.forward=()=>{this._dispatchEvent(kP.OnForward)},this.backward=()=>{this._dispatchEvent(kP.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()}}TP.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},TP.defaultAttributes={[MP.Start]:{},[MP.Pause]:{},[MP.Backward]:{},[MP.Forward]:{}};const wP={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},CP=[200,10];var EP,PP;!function(t){t.Default="default",t.Reverse="reverse"}(EP||(EP={})),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"}(PP||(PP={}));const BP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===EP.Default&&s===i})({direction:e,maxIndex:i,dataIndex:n})||(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===EP.Reverse&&s===i})({direction:e,minIndex:s,dataIndex:n})},RP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===EP.Default&&s===i})({direction:e,minIndex:s,dataIndex:n})||(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===EP.Reverse&&s===i})({direction:e,maxIndex:i,dataIndex:n})},LP=t=>"top"===t||"bottom"===t;class OP extends Sb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},OP.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(LP(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:CP[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:CP[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 fP(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 LP(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 TP(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=LP(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:CP[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?(LP(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:LP(this._orient)?t+s:(this._size.width-r)/2,y:LP(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:LP(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:LP(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:LP(this._orient)?t+s:(this._size.width-r)/2,y:LP(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 IP(){lP(),iM(),_M()}OP.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({},wP),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},wP),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},wP),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},wP),{key:"backward",position:"start"})}},IP();class DP extends OP{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:EP.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(kP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(kP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(kP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(kP.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(PP.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(BP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||RP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===EP.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(PP.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=P_.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(PP.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(PP.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=P_.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(),P_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(PP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,P_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(PP.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(PP.change),this.dispatchCustomEvent(PP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var FP,jP=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())}))};IP();class zP extends OP{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(kP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(kP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(kP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(kP.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(PP.change))},this.play=()=>jP(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(PP.play),this._rafId=P_.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=P_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,P_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(PP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,P_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(PP.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(PP.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(PP.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"}(FP||(FP={}));const HP={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}},VP=5;const NP={debounce:xt,throttle:St};iM(),cM();let GP=class t extends Sb{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:NP[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(FP.brushClear,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._container.incrementalClearChild(),this._brushMaskAABBBoundsDict={}):(this._activeDrawState&&this._dispatchEvent(FP.drawEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._activeMoveState&&this._dispatchEvent(FP.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=HP.trigger,updateTrigger:e=HP.updateTrigger,endTrigger:i=HP.endTrigger,resetTrigger:s=HP.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(FP.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(FP.moveStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_drawing(t){var e,i;const s=this.eventPosToStagePos(t),{sizeThreshold:n=VP,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(FP.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(FP.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=pm.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)})},UP=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}},YP={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:kM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:kM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:kM,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},KP=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];iM(),uM(),_M(),bM(),gM();let XP=class t extends Sb{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:BM(u)&&BM(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:BM(u)&&BM(u.value)},UP(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:BM(u)&&BM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:BM(u)&&BM(u.value)},UP(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},wM),u.value),visible:BM(u)&&BM(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=BM(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 _=BM(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(!BM(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)+(BM(n.key)?r+n.key.spacing:0)+(BM(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&&($M(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:BM(n.key)||"right"===c||(t="left"),m.setAttribute("textAlign",t),$M(c,m,t,u,a),m.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(BM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Fc(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(BM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},UP(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},UP(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},wM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(BM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},UP(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},UP(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=>KP.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)&&BM(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=BM(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=GM(u),y=GM(p);let b=0;if(BM(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(BM(p)){const{width:t,height:e}=y.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}f&&mg[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 WP({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return WP({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};XP.defaultAttributes=YP;const $P=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 ZP(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function JP(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function QP(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 tB(t,e){const i=QP(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 eB(t,e){const i=iB(t),s=iB(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 iB(t,e={x:0,y:0}){return qt.distancePP(t,e)}function sB(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 nB(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const rB=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var oB,lB;!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"}(oB||(oB={})),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.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(lB||(lB={}));const hB="__VCHART",cB=500,dB=500,uB=`${hB}_LABEL_LIMIT`,pB=`${hB}_LABEL_ALIGN`,gB=`${hB}_LABEL_TEXT`,mB=`${hB}_LABEL_VISIBLE`,fB=`${hB}_LABEL_X`,vB=`${hB}_LABEL_Y`,_B=`${hB}_ARC_TRANSFORM_VALUE`,yB=`${hB}_ARC_RATIO`,bB=`${hB}_ARC_START_ANGLE`,xB=`${hB}_ARC_END_ANGLE`,SB=`${hB}_ARC_K`,AB=`${hB}_ARC_MIDDLE_ANGLE`,kB=`${hB}_ARC_QUADRANT`,MB=`${hB}_ARC_RADIAN`,TB=-Math.PI/2,wB=3*Math.PI/2,CB=-90,EB=.6;var PB,BB,RB,LB,OB,IB,DB,FB,jB,zB,HB,VB,NB,GB,WB;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(PB||(PB={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(BB||(BB={})),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"}(RB||(RB={})),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"}(LB||(LB={})),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"}(OB||(OB={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(IB||(IB={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(DB||(DB={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(FB||(FB={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(jB||(jB={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(zB||(zB={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(HB||(HB={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(VB||(VB={})),t.VGRAMMAR_HOOK_EVENT=void 0,(NB=t.VGRAMMAR_HOOK_EVENT||(t.VGRAMMAR_HOOK_EVENT={})).BEFORE_EVALUATE_DATA="beforeEvaluateData",NB.AFTER_EVALUATE_DATA="afterEvaluateData",NB.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",NB.AFTER_EVALUATE_SCALE="afterEvaluateScale",NB.BEFORE_PARSE_VIEW="beforeParseView",NB.AFTER_PARSE_VIEW="afterParseView",NB.BEFORE_TRANSFORM="beforeTransform",NB.AFTER_TRANSFORM="afterTransform",NB.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",NB.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",NB.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",NB.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",NB.BEFORE_STAGE_RESIZE="beforeStageResize",NB.AFTER_STAGE_RESIZE="afterStageResize",NB.BEFORE_VRENDER_DRAW="beforeVRenderDraw",NB.AFTER_VRENDER_DRAW="afterVRenderDraw",NB.BEFORE_MARK_JOIN="beforeMarkJoin",NB.AFTER_MARK_JOIN="afterMarkJoin",NB.BEFORE_MARK_UPDATE="beforeMarkUpdate",NB.AFTER_MARK_UPDATE="afterMarkUpdate",NB.BEFORE_MARK_STATE="beforeMarkState",NB.AFTER_MARK_STATE="afterMarkState",NB.BEFORE_MARK_ENCODE="beforeMarkEncode",NB.AFTER_MARK_ENCODE="afterMarkEncode",NB.BEFORE_DO_LAYOUT="beforeDoLayout",NB.AFTER_DO_LAYOUT="afterDoLayout",NB.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",NB.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",NB.BEFORE_DO_RENDER="beforeDoRender",NB.AFTER_DO_RENDER="afterDoRender",NB.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",NB.AFTER_MARK_RENDER_END="afterMarkRenderEnd",NB.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",NB.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",NB.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",NB.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",NB.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",NB.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",NB.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",NB.BEFORE_ELEMENT_STATE="beforeElementState",NB.AFTER_ELEMENT_STATE="afterElementState",NB.BEFORE_ELEMENT_ENCODE="beforeElementEncode",NB.AFTER_ELEMENT_ENCODE="afterElementEncode",NB.ANIMATION_START="animationStart",NB.ANIMATION_END="animationEnd",NB.ELEMENT_ANIMATION_START="elementAnimationStart",NB.ELEMENT_ANIMATION_END="elementAnimationEnd",NB.ALL_ANIMATION_START="allAnimationStart",NB.ALL_ANIMATION_END="allAnimationEnd",function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(GB||(GB={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(WB||(WB={}));const UB="__vgrammar_scene_item__",YB=[RB.line,RB.area],KB=[RB.arc3d,RB.rect3d,RB.pyramid3d],XB="key",$B=[{}],qB=["key"],ZB=!0,JB=!0,QB=!1,tR=!0,eR="VGRAMMAR_IMMEDIATE_ANIMATION",iR=0,sR=1e3,nR=0,rR=0,aR=!1,oR=!1,lR="quintInOut",hR={stopWhenStateChange:!1,immediatelyApply:!0};function cR(t,e){return Y(t).reduce(((t,i)=>{const s=_(i)?e.getGrammarById(i):i;return s&&t.push(s),t}),[])}function dR(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 cR(t.dependency,e);var i;return[]}function uR(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function pR(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 gR(t,e){return mR(t)?t.output():e[t]}const mR=t=>t&&!u(t.grammarType),fR=t=>d(t)?t:e=>e[t];function vR(t){return!!(null==t?void 0:t.scale)}function _R(t){return!!(null==t?void 0:t.field)}function yR(t,e){if(!t)return[];let i=[];return t.scale&&(i=mR(t.scale)?[t.scale]:Y(e.getScaleById(t.scale))),i.concat(dR(t,e))}function bR(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 xR(t,e,i,s,n){i&&(uR(i)?e.forEach((e=>{const n=pR(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 RB.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case RB.group:case RB.rect:case RB.image:return["width","height","y1"].includes(e);case RB.path:case RB.shape:return["path","customPath"].includes(e);case RB.line:return"defined"===e;case RB.area:return["x1","y1","defined"].includes(e);case RB.rule:return["x1","y1"].includes(e);case RB.symbol:return"size"===e;case RB.polygon:return"points"===e;case RB.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(vR(l)){const t=gR(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?cb(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(_R(l)){const t=cb(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=pR(l,s,e.datum,t)}))})))}function SR(t,e,i,s){if(!t)return null;if(uR(t))return pR(t,s,e,i);const n={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(vR(h)){const t=gR(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?cb(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(_R(h)){const t=cb(h.field);n[r]=t(e)}else n[r]=pR(h,s,e,i)})),n}class AR{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 kR=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]}};kR._plotMarks={},kR._marks={},kR._components={},kR._graphicComponents={},kR._transforms={},kR._grammars={},kR._glyphs={},kR._animations={},kR._interactions={},kR._graphics={},kR.registerGlyph=(t,e,i,s,n)=>(kR._glyphs[t]=new AR(e,i,s,n),kR._glyphs[t]),kR.registerAnimationType=(t,e)=>{kR._animations[t]=e},kR.getAnimationType=t=>kR._animations[t],kR.registerInteraction=(t,e)=>{kR._interactions[t]=e},kR.registerGraphic=(t,e)=>{kR._graphics[t]=e},kR.getGraphicType=t=>kR._graphics[t],kR.createGraphic=(t,e)=>{const i=kR._graphics[t];return i?i(e):null};const MR=t=>!!RB[t];function TR(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var s;const n=kR.getGraphicType(e)?kR.createGraphic(e,i):kR.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 wR=t=>{t&&(t[UB]=null,t.release(),t.parent&&t.parent.removeChild(t))},CR=["fillOpacity"],ER=(t,e,i)=>{var s;return"fillOpacity"===e?(t.fillOpacity=null!==(s=i.fillOpacity)&&void 0!==s?s:1,["fillOpacity"]):[]};const PR={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"}],[RB.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"}],[RB.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"}],[RB.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 BR=(t,e,i,s)=>{const n={},r=e?Object.keys(e):[],a=_(t)?PR[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||(CR.includes(r)?ER(n,r,e):n[r]=e[r])}))}else r.forEach((t=>{CR.includes(t)?ER(n,t,e):n[t]=e[t]}));return n},RR=(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),LR=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],OR=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(LR);function IR(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)?OR:LR,r=[];let a=null;return t.forEach(((t,e)=>{a&&n.every((e=>RR(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=DR(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function DR(t){const e={};return t?(Object.keys(t).forEach((i=>{"x"!==i&&"y"!==i&&"x1"!==i&&"y1"!==i&&"defined"!==i&&"size"!==i&&"width"!==i&&"height"!==i&&"context"!==i&&(e[i]=t[i])})),e):e}let FR=class{constructor(t){this.data=null,this.states=[],this.diffState=BB.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:{}})));xR(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?BR(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[UB]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?BR(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t)))}updateGraphicItem(){if(!this.graphicItem)return;this.diffState===BB.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&&(wR(this.graphicItem),this.graphicItem[UB]=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=fR(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(pR(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===BB.unChange&&(this.diffState=BB.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&(this.mark.isCollectionMark()&&delete t.defined,Object.assign(e,t)),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==BB.enter&&this.diffState!==BB.update||!this.states.length||this.useStates(this.states),this.mark.markType===RB.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 cl))}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[PB.update],a=e[PB.enter],o=e[PB.exit],l=this.mark.isLargeMode()||n&&!this.mark.getSpec().enableSegments;this.diffState===BB.enter?(a&&xR(this,t,a,s,l),r&&xR(this,t,r,s,l)):this.diffState===BB.update?((n&&a||i)&&xR(this,t,a,s,l),r&&xR(this,t,r,s,l)):this.diffState===BB.exit&&o&&(i&&xR(this,t,a,s,l),xR(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)gb(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[RB.line,RB.area,RB.largeRects,RB.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(s=l.nextAttrs)||void 0===s?void 0:s.points)&&(!0===i||bR(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[PB.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=DR(h),e===RB.line||e===RB.area){const i=function(t,e,i,s){return t&&t.length&&(1!==t.length||e)?t.some((t=>bR(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===RB.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=IR(e.items,e.points,i);if(s)return void s.forEach((e=>{t.push(e)}))}const n=DR(e.items[0]);n.points=e.points,t.push(n)})),t}return s?IR(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=SR(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=IR(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t)}else h.points=i,h.segments=null}else e===RB.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===RB.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}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&&(wR(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 jR{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 zR=(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 HR extends jR{constructor(t,e){super(t,e),this.type=HR.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({},HR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=zR(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()}}HR.type="element-select",HR.defaultOptions={state:WB.selected,trigger:"click"};class VR extends jR{constructor(t,e){super(t,e),this.type=VR.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},VR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=zR(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 NR(t){if(t)return t.type===Pw.Band?t.bandwidth():t.type===Pw.Point?t.step():void 0}VR.type="element-highlight",VR.defaultOptions={highlightState:WB.highlight,blurState:WB.blur,trigger:"pointerover",triggerOff:"pointerout"};class GR{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 WR=()=>{U(HR,GR),kR.registerInteraction(HR.type,HR)},UR=()=>{U(VR,GR),kR.registerInteraction(VR.type,VR)},YR=(t,e)=>mR(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,KR=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,s)=>{const n=t[s];return i[s]=YR(n,e),i}),{}):t.map((t=>YR(t,e))):t;let XR=-1;class $R extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++XR}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(dR(this.spec[e],this.view)),this.spec[e]=t,this.attach(dR(t,this.view)),this.commit(),this}}const qR=(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=dR(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}},ZR=(t,e)=>{const i=kR.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(cR(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(y(e)){const s=e.map((e=>qR(t,e,i)));return{references:s.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:s.map((t=>t.value))}}return qR(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}},JR=(t,e)=>{if(null==t?void 0:t.length){const i=[];let s=[];return t.forEach((t=>{var n;const r=ZR(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},QR={csv:Yr,dsv:Ur,tsv:Kr,json:function(t){if(!_(t))return Y(t);try{return Y(JSON.parse(t))}catch(t){return[]}}};class tL extends $R{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||!QR[e.type])return Y(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return QR[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?dR(t.format,this.view)[0]:null;if(s&&e.push(s),t.values){const s=dR(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=dR(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=mR(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=JR(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=JR(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 eL="window",iL="view",sL={trap:!1},nL="width",rL="height",aL="viewWidth",oL="viewHeight",lL="padding",hL="viewBox",cL="autoFit";function dL(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 uL(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,dL(t,e,n,s)}class pL{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 dL(this.nodes,e,0,this.compare),uL(this.nodes,e,null,this.compare)}return this.nodes.push(t),dL(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)),dL(this.nodes,e,0,this.compare),uL(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,uL(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class gL{constructor(t){this.list=[],this.ids={},this.idFunc=t||db}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 mL{constructor(){this.grammars=[],this.logger=at.getInstance(),this._curRank=0,this._committed=new gL((t=>t.uid)),this._heap=new pL(((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 gL((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 fL=(t,e,i,s,n)=>{const r=t=>{if(n||!t||s&&!s(t)||i.call(null,t),t.markType===RB.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}n&&(!t||s&&!s(t)||i.call(null,t))};r(t)};class vL{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 $d(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Il.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 J_(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 $b(o)),null===(r=this._eventConfig)||void 0===r?void 0:r.gesture){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new Jb(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 _L(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 yL(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 bL(t,e,i,s,n){if(n===eL){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{yL(t,_L(t),!1)}))}));const e=_L(t);yL(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e}class xL extends $R{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?pR(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}},ML=(t,e)=>e&&e.debounce?xt(t,e.debounce):e&&e.throttle?St(t,e.throttle):t;class TL extends FR{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 xR(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[UB]=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?BR(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);this.graphicItem||this.initGraphicItem(),this.diffState===BB.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==BB.enter&&this.diffState!==BB.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.diffState===BB.enter&&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=BR(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=PR[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===RB.shape&&(o.datum=d[0].datum)})),s}}_generateGlyphItems(t,e,i){const s=e.map((t=>Object.assign({},t,{nextAttrs:i})));return YB.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)gb(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[UB]=null})),this.glyphGraphicItems=null),super.release()}}const wL=t=>t.markType===RB.glyph?new TL(t):new FR(t);function CL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(XB,i?t.slice().sort(i):t.slice()),{keys:qB,data:s};const n=fR(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 EL{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?CL(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 PL=(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=bR(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=bR(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 BL=(t,e,i,s,n)=>d(i)?i(t.getDatum(),t,n):i;class RL extends mc{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 LL extends mc{getEndProps(){return this.to}onBind(){var t;const e=null!==(t=this.target.constructor.NOWORK_ANIMATE_ATTR)&&void 0!==t?t:Fd,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)}}vc.mode|=ko.SET_ATTR_IMMEDIATELY;let OL=0;const IL=t=>!u(t)&&(t.prototype instanceof mc||"onBind"in t.prototype&&"onStart"in t.prototype&&"onEnd"in t.prototype&&"onUpdate"in t.prototype);class DL{constructor(t,e,i){this.id=OL++,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||!kR.getAnimationType(e.type))return null;const r=kR.getAnimationType(e.type)(t,n,i);return PL(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?BL(t,0,n[i].from,0,s):void 0,e.to[i]=l?BL(t,0,n[i].to,0,s):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),PL(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=IL(o);return u(o)||IL(o)?h?new o(r.from,r.to,a,t.easing,l):r.to?new LL(r.from,r.to,a,t.easing):void 0:new RL(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 Uc(a,e))}r>0&&t.wait(r)}}function FL(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(jL(i,t[i]))})),e}function jL(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:iR,totalTime:h.totalTime,oneByOne:null!==(i=h.oneByOne)&&void 0!==i?i:oR,loop:null!==(s=h.loop)&&void 0!==s?s:aR,controlOptions:z({},hR,null!==(n=h.controlOptions)&&void 0!==n?n:{}),timeSlices:[{duration:null!==(r=h.duration)&&void 0!==r?r:sR,delay:null!==(a=h.delay)&&void 0!==a?a:nR,delayAfter:null!==(o=h.delayAfter)&&void 0!==o?o:rR,effects:[{type:h.type,channel:h.channel,custom:h.custom,easing:null!==(l=h.easing)&&void 0!==l?l:lR,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:iR,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:oR,loop:null!==(d=t.loop)&&void 0!==d?d:aR,controlOptions:z({},hR,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:nR,delayAfter:null!==(i=t.delayAfter)&&void 0!==i?i:rR,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:lR,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 zL(t,e,i){return d(t)?t.call(null,e.getDatum(),e,i):t}class HL{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 VL{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=FL(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=FL(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!==BB.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 HL(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=jL(eR,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 HL(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===BB.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 DL(s,i,e);if(l.animate(n,r),!l.isAnimating)return;s.diffState===BB.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=pR(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,s,n){const r=[],a=zL(t.startTime,e,n),o=zL(t.totalTime,e,n),l=zL(t.oneByOne,e,n),h=zL(t.loop,e,n);let c=0;t.timeSlices.forEach((t=>{var i;const a=zL(t.delay,e,n),l=zL(t.delayAfter,e,n),h=null!==(i=zL(t.duration,e,n))&&void 0!==i?i:o/s,d=Y(t.effects).map((t=>Object.assign({},t,{customParameters:zL(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===BB.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===BB.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===eR,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===BB.exit&&0===o[BB.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 NL extends $R{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new VL(this,{}),this.differ=new EL([]),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===BB.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(e,i){var s;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===VB.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:$B,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===RB.group)return;const e=CL(null!=t?t:$B,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(BB.update,t,e,i)}encodeState(t,e,i,s){if(t===BB.enter&&(this._isReentered=!0),this.spec.encode[t]){const n=this.spec.encode[t];if(uR(n))this.detach(yR(n,this.view));else{const r=_(e);r&&s||!r&&i?(Object.keys(n).forEach((t=>{this.detach(yR(n[t],this.view))})),this.spec.encode[t]={}):r?this.detach(yR(n[e],this.view)):Object.keys(e).forEach((t=>{this.detach(yR(n[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),_(e)?(this.spec.encode[t][e]=i,this.attach(yR(i,this.view))):uR(e)?(this.spec.encode[t]=e,this.attach(yR(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(yR(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=JR(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=JR(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 YB.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!==BB.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===GB.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&&!uR(n)&&Object.keys(n).forEach((t=>{vR(n[t])&&(e[t]=gR(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];uR(s)||Object.keys(s).forEach((t=>{_R(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[UB];if((null==s?void 0:s.mark)===this){const i=bL(this.view,t,s,0,iL);this.emitGrammarEvent(e,i,s)}},this.initEvent()),this.animate||(this.animate=new VL(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=gR(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!==RB.group){if(!this.graphicItem){const t=TR(this,RB.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||KB.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||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==RB.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=fR(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:()=>XB),a=fR(null!==(n=this.spec.groupBy)&&void 0!==n?n:()=>XB),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===BB.enter))),c=[];this.differ.setCallback(((t,e,i)=>{const s=t;let n;if(u(e))n=this.elementMap.get(s),n&&(n.diffState=BB.exit);else if(u(i)){n=this.elementMap.has(s)?this.elementMap.get(s):wL(this),n.diffState===BB.exit&&(n.diffState=BB.enter,this.animate.getElementAnimators(n,BB.exit).forEach((t=>t.stop("start")))),n.diffState=BB.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=BB.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:$B;l||this.differ.setCurrentData(CL(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]=SR(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[PB.group],s);e.forEach((t=>{this.markType===RB.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._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:TR(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!==RB.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=fR(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:()=>XB),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=wL(this);e.diffState=BB.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=wL(this);i.diffState=BB.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!==RB.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=TR(this,RB.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!==BB.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:PR[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=BB.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&&wR(this.graphicItem),this.detachAll(),super.release()}}let GL=class extends NL{constructor(t,e){super(t,RB.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===RB.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 PR.rect}evaluateJoin(t){if(!this.elements.length){const t=wL(this);t.updateData(XB,$B,(()=>""),this.view),this.elements=[t],this.elementMap.set(XB,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 xR(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[PB.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:TR(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 WL(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 UL(t,e){return Math.min(t<0?t+e:t-1,e)}function YL(t,e,i){let s=UL(t,i),n=UL(e,i);if(k(t)||k(e)?k(t)?k(e)||(s=UL(Math.max(0,n-1),i)):n=UL(s+1,i):(s=1,n=2),s>n){const t=n;n=s,s=t}return{start:s,end:n}}const KL=(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=>WL(t,i))),u=l.map((t=>WL(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}=YL(e,i,r),{start:h,end:c}=YL(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()}))},XL={[LB.axis]:0,[LB.legend]:1,[LB.slider]:2,[LB.player]:3,[LB.datazoom]:4},$L=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=XL[t.componentType])&&void 0!==s?s:1/0},qL=(t,e,i,s)=>{const n=i.clone(),r=t.getSpec().layout,a=mb(r.maxChildWidth,n.width()),o=mb(r.maxChildHeight,n.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=kL(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&&d$L(t)-$L(e)));for(let t=0,e=f.length;t{null==t||t.forEach((t=>{var s;if(t.markType!==RB.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=qL(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(aL,o),i.updateSignal(oL,l),i.updateSignal(lL,h)}else qL(t,n,a,e);else"grid"===r.display&&KL(t,n,a);ZL(n,e,i)}}))};class JL extends NL{constructor(t,e,i){super(t,RB.glyph,i),this.glyphType=e,this.glyphMeta=kR.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(!kR.getGraphicType(RB.glyph))return;const s=kR.createGraphic(RB.glyph,i),n=e.getMarks(),r=Object.keys(n).map((t=>{if(kR.getGraphicType(n[t])){const e=kR.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 QL=Symbol.for("key");class tO{diffGrammar(t,e){return function(t,e,i){const s={enter:[],exit:[],update:[]},n=new EL(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(CL(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!==RB.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==RB.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=CL(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=CL(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=fR(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 EL(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(CL(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:QL})),r=CL(e,(t=>{var e;return null!==(e=s(t))&&void 0!==e?e:QL}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==QL){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=pR(i.animation.delay,n,o,l),d=pR(i.animation.duration,n,o,l),u=pR(i.animation.oneByOne,n,o,l),p=pR(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)?Td:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:wd)(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);Sd(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)?Td:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:wd)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>_d(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>bd(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 xd({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Sc,null!==(l=i.easing)&&void 0!==l?l:Ac))}))}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 Ad({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Sc,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Ac))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Sd(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 eO{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 iO extends eO{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===RB.group&&s.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===RB.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=>{const s=t.mark;s.markType===RB.group&&s.includesChild(e,!1)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===RB.group&&e.includesChild(s,!1)&&(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 sO{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 nO extends NL{addGraphicItem(t,e){const i=t&&t.limitAttrs,s=TR(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?RB.richtext:RB.text,t);return super.addGraphicItem(t,e,s)}release(){super.release()}}nO.markType=RB.text;const rO={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)"}}},aO={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},oO=Object.assign({},rO);oO.axis=Object.assign({},oO.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),oO.circleAxis=Object.assign({},oO.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),oO.grid=Object.assign({},oO.grid,{style:{stroke:"#404349"}}),oO.circleGrid=Object.assign({},oO.circleGrid,{style:{stroke:"#404349"}}),oO.rectLabel=Object.assign({},oO.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),oO.lineLabel=Object.assign({},oO.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),oO.symbolLabel=Object.assign({},oO.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),oO.title=Object.assign({},oO.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const lO={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:aO,components:oO},hO={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:aO,components:rO};let cO=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")}};cO._themes=new Map,cO.registerTheme("default",hO),cO.registerTheme("dark",lO);class dO extends NL{constructor(t,e,i,s){super(t,RB.component,i),this._componentDatum={[XB]: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:kR.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,XB)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[XB]+=1}evaluateJoin(t){return this.spec.key=XB,t?(t[XB]=this._componentDatum[XB],this._componentDatum=t):this._componentDatum={[XB]:this._componentDatum[XB]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}class uO 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[UB],n=bL(0,t,s,0,iL);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(mR(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)):MR(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 xL(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 tL(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=kR.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=kR.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 RB.group:n=new GL(this,s);break;case RB.glyph:n=new JL(this,null==i?void 0:i.glyphType,s);break;case RB.component:n=kR.hasComponent(null==i?void 0:i.componentType)?kR.createComponent(null==i?void 0:i.componentType,this,s,null==i?void 0:i.mode):new dO(this,null==i?void 0:i.componentType,s,null==i?void 0:i.mode);break;case RB.text:n=new nO(this,t,s);break;default:n=kR.hasMark(t)?kR.createMark(t,this,s):new NL(this,t,s)}return this.grammars.record(n),this._dataflow.add(n),n}group(t){return this.mark(RB.group,t)}glyph(t,e){return this.mark(RB.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(RB.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(RB.component,t,{componentType:LB.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(RB.component,t,{componentType:LB.grid,mode:e})}legend(t){return this.mark(RB.component,t,{componentType:LB.legend})}slider(t){return this.mark(RB.component,t,{componentType:LB.slider})}label(t){return this.mark(RB.component,t,{componentType:LB.label})}datazoom(t){return this.mark(RB.component,t,{componentType:LB.datazoom})}player(t){return this.mark(RB.component,t,{componentType:LB.player})}title(t){return this.mark(RB.component,t,{componentType:LB.title})}scrollbar(t){return this.mark(RB.component,t,{componentType:LB.scrollbar})}customized(t,e){const i=kR.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&&AL.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&(wR(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_"+ ++SL;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(cO.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(nL,t.width),this.updateSignal(rL,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=kR.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=VB.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var s,n,r,a,o;return[{id:nL,value:null!==(s=t[nL])&&void 0!==s?s:0},{id:rL,value:null!==(n=t[rL])&&void 0!==n?n:0},{id:lL,value:kL(null!==(a=null!==(r=t[lL])&&void 0!==r?r:e[lL])&&void 0!==a?a:null==i?void 0:i.padding)},{id:aL,update:{callback:(t,e)=>{const i=kL(e[lL]);return e[nL]-i.left-i.right},dependency:[nL,lL]}},{id:oL,update:{callback:(t,e)=>{const i=kL(e[lL]);return e[rL]-i.top-i.bottom},dependency:[rL,lL]}},{id:hL,update:{callback:(t,e)=>{const i=kL(e[lL]);return(t||new Jt).setValue(i.left,i.top,i.left+e[aL],i.top+e[oL])},dependency:[aL,oL,lL]}},{id:cL,value:null!==(o=t[cL])&&void 0!==o?o:e[cL]}]})(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===RB.glyph?{glyphType:t.glyphType}:t.type===RB.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=cO.getTheme(t))&&void 0!==e?e:cO.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(nL);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(rL);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(aL);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(oL);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(lL);if(arguments.length){const i=kL(t);return this.updateSignal(e,i),i}return kL(e.output())}autoFit(t){const e=this.getSignalById(cL);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(hL);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=VB.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===RB.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var e;const i=this._options.doLayout||ZL;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=>{fL(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),fL(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=ZB,morph:o=JB,morphAll:l=QB,animation:h={},enableExitAnimation:c=tR}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:lR,delay:null!==(i=h.delay)&&void 0!==i?i:nR,duration:null!==(s=h.duration)&&void 0!==s?s:sR,oneByOne:null!==(n=h.oneByOne)&&void 0!==n?n:oR,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=VB.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=VB.reevaluate,this._dataflow.evaluate()),this._layoutState=VB.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=>!AL.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 fL(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(nL,t)),e!==this.height()&&(s=!0,this.updateSignal(rL,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]:iL;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):MR(t)?(i.markType=t,i.source=e):i.source=t===eL?eL: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=cR(l,this),v=ML(((t,e)=>{const s=c===iL&&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===eL&&(t=bL(0,t,e,0,eL));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===iL){if(function(t,e,i){const s=null==t?void 0:t[e];return!(!1===s||g(s)&&!s[i])}(this._eventConfig,iL,d))return this.addEventListener(d,v,sL),()=>{this.removeEventListener(d,v)}}else if(c===eL)return P_.addEventListener(d,v),this._eventListeners.push({type:d,source:P_,handler:v}),()=>{P_.removeEventListener(d,v);const t=this._eventListeners.findIndex((t=>t.type===d&&t.source===P_&&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=kR.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 vL(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e;this.grammars=new eO((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new iO((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 mL,this.animate=new sO(this),this._morph=new tO,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,[iL,eL]),e}(this._options.eventConfig),this._theme=this._options.disableTheme?null:cO.getDefaultTheme(),this.parseBuiltIn(),(e=this._options).mode&&P_.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=VB.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!==RB.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=P_.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&P_.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(),kR.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 pO=()=>{fM(),lM(),kR.registerGraphic(RB.path,Ng)},gO=()=>{fM(),uM(),kR.registerGraphic(RB.rect,Tg)},mO=()=>{fM(),aM(),kR.registerGraphic(RB.rule,Ag)},fO=()=>{fM(),_M(),kR.registerGraphic(RB.symbol,bg)},vO=()=>{fM(),bM(),gM(),kR.registerGraphic(RB.text,mp)},_O=()=>{fM(),tM(),kR.registerGraphic(RB.glyph,Cg)},yO=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},bO=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},xO=(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(yb(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},SO=(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&&yb(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},AO=yO(xO),kO=bO(xO);const MO=(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(yb(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},TO=(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&&yb(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},wO=yO(MO),CO=bO(MO);const EO=(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`},PO=(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`},BO=(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)?PO:EO,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)}}:{}},RO=(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}},LO=(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})}},OO=(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 IO extends dO{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 DO=(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 FO extends IO{constructor(t,e,i){super(t,LB.axis,e),this.spec.componentType=LB.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=kR.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=SR(n,e,i,s);const h=pR(this.spec.inside,s,e,i),c=pR(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(DO(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=pR(this.spec.tickCount,s,e,i);switch(this._getAxisComponentType()){case IB.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 IB.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?IB.circleAxis:IB.lineAxis,this._axisComponentType}}FO.componentType=LB.axis;let jO=class extends dO{constructor(t,e){super(t,LB.label,e),this.spec.componentType=LB.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=pR(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=pR(s,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case RB.line:case RB.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case RB.rect:case RB.rect3d:case RB.interval:g=p.rectLabel;break;case RB.symbol:case RB.circle:case RB.cell:g=p.symbolLabel;break;case RB.arc:case RB.arc3d:g=p.arcLabel;break;case RB.polygon:case RB.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=SR(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=SR(i,t,e,d);m.push(z({},f,s))}));else{const t=SR(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}};jO.componentType=LB.label;const zO=()=>{kR.registerGraphicComponent(LB.label,(t=>new $T(t))),kR.registerComponent(LB.label,jO)};class HO extends IO{constructor(t,e,i){super(t,LB.grid,e),this.spec.componentType=LB.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=kR.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=SR(s,t,e,i);const d=pR(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 DB.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 DB.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=pR(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(DO(h,n,s,d,this.spec.layout,!0),c))}this._getGridComponentType()===DB.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=pR(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case DB.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 DB.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=DB.circleAxisGrid:this._gridComponentType=DB.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case IB.circleAxis:this._gridComponentType=DB.circleAxisGrid;break;case IB.lineAxis:default:this._gridComponentType=DB.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()?DB.lineAxisGrid:DB.circleAxisGrid:DB.lineAxisGrid}else this._gridComponentType=DB.lineAxisGrid;return this._gridComponentType}}HO.componentType=LB.grid;const VO=(t,e,i)=>e.filter((e=>t.callback(e,i))),NO=(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 GO(t){return t.reduce(((t,e)=>t+e),0)}const WO={min:$,max:X,average:function(t){return 0===t.length?0:GO(t)/t.length},sum:GO};function UO(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 YO(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 KO(t,e,i,s){return YO(t,e,i,"min",s)}function XO(t,e,i,s){return YO(t,e,i,"max",s)}function $O(t,e,i,s){return YO(t,e,i,"average",s)}function qO(t,e,i,s){return YO(t,e,i,"sum",s)}const ZO=(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=UO;if("min"===n?l=KO:"max"===n?l=XO:"average"===n?l=$O:"sum"===n&&(l=qO),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[]},JO="_mo_hide_";const QO=(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(JO)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(JO,!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(JO,!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},tI=()=>{kR.registerTransform("filter",{transform:VO,markPhase:"beforeJoin"},!0)},eI=()=>{kR.registerTransform("map",{transform:NO,markPhase:"beforeJoin"},!0)},iI=()=>{kR.registerTransform("sampling",{transform:ZO,markPhase:"afterEncode"},!0)},sI=()=>{kR.registerTransform("markoverlap",{transform:QO,markPhase:"afterEncode"},!0)},nI=(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}}},rI=(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}}},aI=(t,e,i)=>{var s,n,r,a;const o=null!==(s=t.getFinalGraphicAttributes())&&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}}},oI=(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}}},lI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("y",!1),i=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1),n=t.getGraphicAttribute("y",!1),r=t.getGraphicAttribute("y1",!1),a=t.getGraphicAttribute("height",!1),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}}}}},hI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("y",!1),i=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("x1",!1),n=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicAttribute("height",!1),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 cI=(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.getGraphicAttribute("x",!1),r=t.getGraphicAttribute("x1",!1),a=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);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 dI=(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.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);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 uI=(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.getGraphicAttribute("y",!1),r=t.getGraphicAttribute("y1",!1),a=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("y",!1),n=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);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 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.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("y",!1),n=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);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)},gI=(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.getFinalGraphicAttributes();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.getFinalGraphicAttributes();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)},mI=(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.getFinalGraphicAttributes();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)},fI=(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.getFinalGraphicAttributes(),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.getFinalGraphicAttributes();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)},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=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.getFinalGraphicAttributes();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)},_I=(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((()=>Object.assign(n)))},yI=(t,e,i)=>({from:{points:_I(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),bI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:_I(t,e)}}),xI=(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),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}})),SI=(t,e,i)=>({from:{points:xI(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),AI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:xI(t,e,i)}}),kI=(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),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,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)=>{var s,n;const{offset:r=0,orient:a,direction:o,point:l}=null!=e?e:{};let h=0,c=0;"negative"===a&&(i.group?(h=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),c=null!==(n=i.groupHeight)&&void 0!==n?n:i.group.getBounds().height(),i.groupWidth=h,i.groupHeight=c):(h=i.width,c=i.height)),h+=r,c+=r;const u=d(l)?l.call(null,t.getDatum(),t,i):l,p=u&&k(u.x)?u.x:h,g=u&&k(u.y)?u.y:c,m=t.getFinalGraphicAttributes();switch(o){case"x":return{from:{x:p},to:{x:null==m?void 0:m.x}};case"y":return{from:{y:g},to:{y:null==m?void 0:m.y}};default:return{from:{x:p,y:g},to:{x:null==m?void 0:m.x,y:null==m?void 0:m.y}}}},CI=(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}}}},EI=(t,e,i)=>{var s,n,r,a;const o=t.getFinalGraphicAttributes();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}}}},PI=(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}}}},BI={symbol:["_mo_hide_","visible"]},RI=(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=BI[t.mark.markType])&&r.forEach((t=>{delete s[t],delete n[t]})),Object.keys(n).forEach((t=>{gb(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}},LI=(t,e,i)=>{var s,n;const r=null!==(n=null===(s=t.getFinalGraphicAttributes())||void 0===s?void 0:s.angle)&&void 0!==n?n:0;let a=0;return a=pt(r/(2*Math.PI),0)?Math.round(r/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(r/(2*Math.PI))*Math.PI*2:Math.floor(r/(2*Math.PI))*Math.PI*2,{from:{angle:a},to:{angle:r}}},OI=(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}}},II=()=>{kR.registerAnimationType("clipIn",nI)},DI=()=>{kR.registerAnimationType("clipOut",rI)},FI=()=>{kR.registerAnimationType("fadeIn",aI)},jI=()=>{kR.registerAnimationType("fadeOut",oI)},zI=()=>{kR.registerAnimationType("growCenterIn",lI)},HI=()=>{kR.registerAnimationType("growCenterOut",hI)},VI=()=>{kR.registerAnimationType("growHeightIn",uI)},NI=()=>{kR.registerAnimationType("growHeightOut",pI)},GI=()=>{kR.registerAnimationType("growWidthIn",cI)},WI=()=>{kR.registerAnimationType("growWidthOut",dI)},UI=()=>{kR.registerAnimationType("growPointsIn",yI)},YI=()=>{kR.registerAnimationType("growPointsOut",bI)},KI=()=>{kR.registerAnimationType("growPointsXIn",SI)},XI=()=>{kR.registerAnimationType("growPointsXOut",AI)},$I=()=>{kR.registerAnimationType("growPointsYIn",MI)},qI=()=>{kR.registerAnimationType("growPointsYOut",TI)},ZI=()=>{kR.registerAnimationType("growAngleIn",gI)},JI=()=>{kR.registerAnimationType("growAngleOut",mI)},QI=()=>{kR.registerAnimationType("growRadiusIn",fI)},tD=()=>{kR.registerAnimationType("growRadiusOut",vI)},eD=()=>{kR.registerAnimationType("moveIn",wI)},iD=()=>{kR.registerAnimationType("moveOut",CI)},sD=()=>{kR.registerAnimationType("scaleIn",EI)},nD=()=>{kR.registerAnimationType("scaleOut",PI)},rD=()=>{kR.registerAnimationType("rotateIn",LI)},aD=()=>{kR.registerAnimationType("rotateOut",OI)},oD=()=>{kR.registerAnimationType("update",RI)};class lD extends NL{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=uR(e)?null:Object.keys(e).reduce(((t,s)=>(vR(e[s])&&(t[s]=gR(e[s].scale,i)),t)),{});this._encoders[t]={callback:(t,i,n)=>{const r=SR(e,t,i,n);if(u(r.size)){const t=s.x?NR(s.x):void 0,e=s.y?NR(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(PR.symbol)}release(){super.release(),this._encoders=null}}lD.markType=RB.cell;const hD=["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 cD,dD,uD;t.ChartEvent=void 0,(cD=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",cD.rendered="rendered",cD.renderFinished="renderFinished",cD.animationFinished="animationFinished",cD.regionSeriesDataFilterOver="regionSeriesDataFilterOver",cD.afterInitData="afterInitData",cD.afterInitEvent="afterInitEvent",cD.afterInitMark="afterInitMark",cD.rawDataUpdate="rawDataUpdate",cD.viewDataFilterOver="viewDataFilterOver",cD.viewDataUpdate="viewDataUpdate",cD.viewDataStatisticsUpdate="viewDataStatisticsUpdate",cD.markDeltaYUpdate="markDeltaYUpdate",cD.viewDataLabelUpdate="viewDataLabelUpdate",cD.scaleDomainUpdate="scaleDomainUpdate",cD.scaleUpdate="scaleUpdate",cD.dataZoomChange="dataZoomChange",cD.drill="drill",cD.layoutStart="layoutStart",cD.layoutEnd="layoutEnd",cD.layoutRectUpdate="layoutRectUpdate",cD.playerPlay="playerPlay",cD.playerPause="playerPause",cD.playerEnd="playerEnd",cD.playerChange="playerChange",cD.playerForward="playerForward",cD.playerBackward="playerBackward",cD.scrollBarChange="scrollBarChange",cD.brushStart="brushStart",cD.brushChange="brushChange",cD.brushEnd="brushEnd",cD.brushClear="brushClear",cD.legendSelectedDataChange="legendSelectedDataChange",cD.legendFilter="legendFilter",cD.legendItemClick="legendItemClick",cD.legendItemHover="legendItemHover",cD.legendItemUnHover="legendItemUnHover",cD.tooltipShow="tooltipShow",cD.tooltipHide="tooltipHide",cD.tooltipRelease="tooltipRelease",cD.afterResize="afterResize",cD.afterRender="afterRender",cD.afterLayout="afterLayout",t.Event_Source_Type=void 0,(dD=t.Event_Source_Type||(t.Event_Source_Type={})).chart="chart",dD.window="window",dD.canvas="canvas",t.Event_Bubble_Level=void 0,(uD=t.Event_Bubble_Level||(t.Event_Bubble_Level={})).vchart="vchart",uD.chart="chart",uD.model="model",uD.mark="mark";const pD=`${hB}_waterfall_default_seriesField`,gD=`${hB}_CORRELATION_X`,mD=`${hB}_CORRELATION_Y`,fD=`${hB}_CORRELATION_SIZE`,vD=`${hB}_MEASURE_CANVAS_ID`,_D=`${hB}_DEFAULT_DATA_INDEX`,yD=`${hB}_DEFAULT_DATA_KEY`,bD=`${hB}_DEFAULT_DATA_SERIES_FIELD`,xD=`${hB}_DEFAULT_SERIES_STYLE_NAME`;var SD;t.AttributeLevel=void 0,(SD=t.AttributeLevel||(t.AttributeLevel={}))[SD.Default=0]="Default",SD[SD.Theme=1]="Theme",SD[SD.Chart=2]="Chart",SD[SD.Base_Series=3]="Base_Series",SD[SD.Series=4]="Series",SD[SD.Mark=5]="Mark",SD[SD.User_Chart=6]="User_Chart",SD[SD.User_Series=7]="User_Series",SD[SD.User_Mark=8]="User_Mark",SD[SD.Built_In=99]="Built_In";const AD=`${hB}_STACK_KEY`,kD=`${hB}_STACK_START`,MD=`${hB}_STACK_END`,TD=`${hB}_STACK_START_PERCENT`,wD=`${hB}_STACK_END_PERCENT`,CD=`${hB}_STACK_START_OffsetSilhouette`,ED=`${hB}_STACK_END_OffsetSilhouette`,PD=`${hB}_STACK_TOTAL`,BD=`${hB}_STACK_TOTAL_PERCENT`,RD=`${hB}_STACK_TOTAL_TOP`,LD=`${hB}_SEGMENT_START`,OD=`${hB}_SEGMENT_END`;var ID,DD;t.LayoutZIndex=void 0,(ID=t.LayoutZIndex||(t.LayoutZIndex={}))[ID.Axis_Grid=50]="Axis_Grid",ID[ID.CrossHair_Grid=100]="CrossHair_Grid",ID[ID.Region=450]="Region",ID[ID.Mark=300]="Mark",ID[ID.Node=400]="Node",ID[ID.Axis=100]="Axis",ID[ID.MarkLine=500]="MarkLine",ID[ID.MarkArea=100]="MarkArea",ID[ID.MarkPoint=500]="MarkPoint",ID[ID.DataZoom=500]="DataZoom",ID[ID.ScrollBar=500]="ScrollBar",ID[ID.Player=500]="Player",ID[ID.Legend=500]="Legend",ID[ID.CrossHair=500]="CrossHair",ID[ID.Indicator=500]="Indicator",ID[ID.Title=500]="Title",ID[ID.Label=500]="Label",ID[ID.Brush=500]="Brush",ID[ID.CustomMark=500]="CustomMark",ID[ID.Interaction=700]="Interaction",t.LayoutLevel=void 0,(DD=t.LayoutLevel||(t.LayoutLevel={}))[DD.Indicator=10]="Indicator",DD[DD.Region=20]="Region",DD[DD.Axis=30]="Axis",DD[DD.DataZoom=40]="DataZoom",DD[DD.Player=40]="Player",DD[DD.ScrollBar=40]="ScrollBar",DD[DD.Legend=50]="Legend",DD[DD.Title=70]="Title",DD[DD.CustomMark=70]="CustomMark";const FD=["linear","radial","conical"],jD={x0:0,y0:0,x1:1,y1:1},zD={x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},HD={x:.5,y:.5,startAngle:0,endAngle:2*Math.PI},VD={linear:jD,radial:zD,conical:HD},ND={label:{name:"label",type:"text"}},GD=`${hB}_rect_x`,WD=`${hB}_rect_x1`,UD=`${hB}_rect_y`,YD=`${hB}_rect_y1`,KD=Object.assign(Object.assign({},ND),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),XD=Object.assign(Object.assign({},ND),{bar3d:{name:"bar3d",type:"rect3d"}}),$D={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},qD=Object.assign(Object.assign({},ND),$D),ZD=Object.assign(Object.assign({},ND),{point:{name:"point",type:"symbol"}}),JD=Object.assign(Object.assign(Object.assign({},ND),$D),{area:{name:"area",type:"area"}}),QD=Object.assign(Object.assign(Object.assign({},ND),$D),{area:{name:"area",type:"area"}}),tF=Object.assign(Object.assign({},ND),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),eF=Object.assign(Object.assign({},ND),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}}),iF=Object.assign(Object.assign({},ND),{rose:{name:"rose",type:"arc"}}),sF=Object.assign(Object.assign({},ND),{area:{name:"area",type:"path"}}),nF=Object.assign(Object.assign({},ND),{group:{name:"group",type:"group"}}),rF=Object.assign(Object.assign({},nF),{track:{name:"track",type:"arc"},progress:{name:"progress",type:"arc"}}),aF=Object.assign(Object.assign({},ND),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),oF=Object.assign(Object.assign({},ND),{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"}}),lF=Object.assign(Object.assign({},ND),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"}}),hF=Object.assign(Object.assign({},ND),{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"}}),cF=Object.assign(Object.assign({},ND),{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"}}),dF=Object.assign(Object.assign({},ND),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),uF=Object.assign(Object.assign({},KD),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),pF=Object.assign(Object.assign({},ND),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),gF=Object.assign(Object.assign({},ND),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),mF=Object.assign(Object.assign({},ND),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}}),fF=Object.assign(Object.assign({},nF),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),vF=Object.assign(Object.assign({},ND),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),_F=Object.assign(Object.assign({},ND),{sunburst:{name:"sunburst",type:"arc"}}),yF=Object.assign(Object.assign({},KD),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),bF=Object.assign(Object.assign({},XD),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),xF=Object.assign(Object.assign({},ND),{circlePacking:{name:"circlePacking",type:"arc"}}),SF=Object.assign(Object.assign({},ND),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}}),AF=Object.assign(Object.assign({},ND),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),kF=Object.assign({},JD),MF=Object.assign(Object.assign({},ND),{liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"symbol"}}),TF=Object.assign(Object.assign({},ND),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});var wF;!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"}(wF||(wF={}));const CF={[oB.bar]:KD,[oB.bar3d]:XD,[oB.line]:qD,[oB.scatter]:ZD,[oB.area]:JD,[oB.radar]:QD,[oB.pie]:tF,[oB.pie3d]:eF,[oB.rose]:iF,[oB.geo]:ND,[oB.map]:sF,[oB.circularProgress]:rF,[oB.link]:aF,[oB.dot]:oF,[oB.wordCloud]:lF,[oB.wordCloud3d]:lF,[oB.funnel]:hF,[oB.funnel3d]:cF,[oB.linearProgress]:dF,[oB.waterfall]:uF,[oB.boxPlot]:pF,[oB.treemap]:gF,[oB.sankey]:mF,[oB.gauge]:fF,[oB.gaugePointer]:vF,[oB.sunburst]:_F,[oB.rangeColumn]:yF,[oB.rangeColumn3d]:bF,[oB.circlePacking]:xF,[oB.heatmap]:SF,[oB.correlation]:AF,[oB.rangeArea]:kF,[oB.liquid]:MF,[oB.venn]:TF};function EF(t){var e,i;const{type:s}=t;return s===oB.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}const PF={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},BF={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function RF(t,e){var i;if(!t)return[];const s=zF(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?FF(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>DF(i)?OF(t,i,e):i)).filter(p)}))):i.map((i=>DF(i)?OF(t,i,e):i)).filter(p):[]}return[]}function LF(t,e){var i,s;return FF(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 OF(t,e,i){var s;const n=zF(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=PF[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=BF[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 IF=(t,e,i)=>{if(e&&DF(t)){const s=OF(e,t,i);if(s)return s}return t};function DF(t){return t&&"palette"===t.type&&!!t.key}function FF(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function jF(t){return y(t)?{dataScheme:t}:t}function zF(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=EF(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 HF extends sC{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(!FF(this._range))return void super.range(this._range);const t=LF(this._range,this._domain);super.range(t)}}const VF={linear:TC,band:rC,point:class extends rC{constructor(t){super(!1),this.type=Pw.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:sC,threshold:BC,colorOrdinal:HF};function NF(t){const e=VF[t];return e?new e:null}function GF(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 WF(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function UF(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function YF(t){return!!_(t)&&(!!t.endsWith("%")&&nb(t.substring(0,t.length-1)))}function KF(t,e,i,s=0){var n,r;return S(t)?t:YF(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 XF(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]=KF(t[s],e.size,i)}))})),o}function $F(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)||YF(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 qF(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const ZF=(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},JF=[{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"]}],QF={default:{dataScheme:JF,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)"}}},tj="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",ej={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:tj,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:tj,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:CB,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"}}}}},ij={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}}},sj=Object.assign(Object.assign({},ij),{label:{space:0}}),nj={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}}}}},rj="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;",aj={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:rj,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:rj,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}}}},oj={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}},lj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}},hj={horizontal:Object.assign(Object.assign({},oj),{rail:{width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:lj}),vertical:Object.assign(Object.assign({},oj),{rail:{width:8,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:lj})},cj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}},dj={horizontal:Object.assign(Object.assign({},oj),{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:cj}),vertical:Object.assign(Object.assign({},oj),{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:cj})},uj={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"}}}}},pj={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"}}}}},gj={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 mj(t,e){return t&&e.key in t?t[e.key]:e.default}function fj(t){return t&&"token"===t.type&&!!t.key}const vj={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%"},_j={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:QF,token:vj,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:ej,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:hj,sizeLegend:dj,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:ij,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:sj,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:pj,markArea:uj,markPoint:gj,polarMarkLine:pj,polarMarkArea:uj,polarMarkPoint:gj,geoMarkPoint:gj,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:aj,crosshair:nj,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},yj={name:"dark",colorScheme:{default:{dataScheme:JF,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}}}}}},bj=(t,e)=>t===e||!d(t)&&!d(e)&&(y(t)&&y(e)?e.every((e=>t.some((t=>bj(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>bj(t[i],e[i])))),xj=(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]={}),xj(t[s],e.slice(1),i))};function Sj(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]=Sj(n,e)}return s}function Aj(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])?kj(t,e,r,i):Mj(t,r,s[r])}}}}function kj(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?Tj({},t[n][e.index],i):i):t[n]=s?Tj({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?Tj({},t[n][r],i):i)}else t.id===e&&(t[n]=s?Tj({},t[n],i):i)}))}function Cj(t,...e){return Tj(Ej(t),...e.map(Ej))}function Ej(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]=jF(s),e}),{}));return t}(t.colorScheme),{series:s}=t,{mark:n,markByName:r}=t;let a;return(n||r)&&(a=Object.keys(CF).reduce(((t,e)=>{var i;const a=null!==(i=null==s?void 0:s[e])&&void 0!==i?i:{};return t[e]=Pj(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 Pj(t,e,i,s){if(!CF[e])return t;const n={};return Object.values(CF[e]).forEach((({type:e,name:r})=>{n[r]=Tj({},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 Bj=["animationThreshold","colorScheme","name","padding"];function Rj(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];Bj.includes(r)?n[r]=a:f(a)?DF(a)?n[r]=IF(a,e,s):fj(a)?n[r]=mj(i,a):n[r]=Rj(a,e,i,s):n[r]=a})),n}const Lj={[_j.name]:_j},Oj=_j.name,Ij=new Map(Object.keys(Lj).map((t=>[t,Lj[t]]))),Dj=new Map(Object.keys(Lj).map((t=>[t,Rj(Lj[t])]))),Fj=new Map(Object.keys(Lj).map((t=>[t,t===Oj]))),jj=(t,e)=>{if(!t)return;const i=Nj(e);Ij.set(t,i),Dj.set(t,Rj(i)),Fj.set(t,!0)},zj=(t=Oj,e=!1)=>(Fj.has(t)&&!Fj.get(t)&&jj(t,Ij.get(t)),e?Dj.get(t):Ij.get(t)),Hj=t=>Ij.delete(t)&&Dj.delete(t)&&Fj.delete(t),Vj=t=>!!_(t)&&Ij.has(t),Nj=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:Oj;return Cj({},zj(i),t)};class Gj{static registerInstance(t){Gj.instances.set(t.id,t)}static unregisterInstance(t){Gj.instances.delete(t.id)}static getInstance(t){return Gj.instances.get(t)}static instanceExist(t){return Gj.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return Gj.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}Gj.instances=new Map;class Wj{static registerTheme(t,e){jj(t,e)}static getTheme(t,e=!1){return zj(t,e)}static removeTheme(t){return Hj(t)}static themeExist(t){return Vj(t)}static getDefaultTheme(){return Wj.themes.get(Oj)}static setCurrentTheme(t){Wj.themeExist(t)&&(Wj._currentThemeName=t,Gj.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return Wj.getTheme(Wj._currentThemeName,t)}static getCurrentThemeName(){return Wj._currentThemeName}}function Uj(t,e){return _(t)?Wj.themeExist(t)?Wj.getTheme(t,e):{}:g(t)?t:{}}function Yj(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]=Yj(t[s],e)}return i}return y(t)?t.map((t=>Yj(t,e))):t}function Kj(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]=Kj(t[s],e)}return i}return y(t)?t.map((t=>Kj(t,e))):t}Wj.themes=Ij,Wj._currentThemeName=Oj;function Xj(t,e){for(let i=0;it.key===e))}function qj(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 Zj(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:{}},iz(t,a,n[o],l,e,r))})),s?Jj(n):n}function Jj(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))):Jj(t[e].nodes);return t}function Qj(t,e){if("values"in t&&t.values.length){const i=JP(t.values,e),s=ZP(t.values,wD);t.values.forEach((t=>{t[PD]=i,t[BD]=s,delete t[RD]}));const n=t.values.reduce(((t,e)=>e[MD]>t[MD]?e:t));n[RD]=!0}else for(const i in t.nodes)Qj(t.nodes[i],e)}function tz(t){if(!t.values.length)return;const e=t.values[t.values.length-1][MD]/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[kD]=s,s+=r[MD],r[MD]=s):(r[kD]=n,n+=r[MD],r[MD]=n),r[AD]=t.key}if(i)for(let i=0;i=0?s:n;r=a>=0?1:-1,l[TD]=0===h?0:Math.min(1,l[kD]/h)*r,l[wD]=0===h?0:Math.min(1,l[MD]/h)*r}}for(const s in t.nodes)ez(t.nodes[s],e,i)}function iz(t,e,i,s,n,r,a){if("values"in e)if(n&&e.values.forEach((t=>t[MD]=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}),iz(t,e.nodes[o],i.nodes[o],s,n,r,l)}}const sz=(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]=rz(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function az(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>lz(t.style(e,i,s,n)):B(t.style)||(e.style=lz(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>lz(t.state[e](i,s,n,r)):B(t.state[e])||(i[e]=lz(t.state[e]))})),e.state=i}return e}function oz(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>lz(t[i](e,s,n,r)):B(t[i])||(e[i]=lz(t[i]))})),e}function lz(t){return(null==t?void 0:t.angle)&&(t.angle=te(t.angle)),t}class hz{static registerChart(t,e){hz._charts[t]=e}static registerSeries(t,e){hz._series[t]=e}static registerComponent(t,e,i){hz._components[t]={cmp:e,alwaysCheck:i}}static registerMark(t,e){hz._marks[t]=e}static registerRegion(t,e){hz._regions[t]=e}static registerTransform(t,e){hz.transforms[t]=e}static registerLayout(t,e){hz._layout[t]=e}static registerAnimation(t,e){hz._animations[t]=e}static registerImplement(t,e){hz._implements[t]=e}static registerChartPlugin(t,e){hz._chartPlugin[t]=e}static registerComponentPlugin(t,e){hz._componentPlugin[t]=e}static createChart(t,e,i){if(!hz._charts[t])return null;return new(0,hz._charts[t])(e,i)}static createChartSpecTransformer(t,e){if(!hz._charts[t])return null;const i=hz._charts[t];return new(0,i.transformerConstructor)(Object.assign({seriesType:i.seriesType},e))}static createRegion(t,e,i){if(!hz._regions[t])return null;return new(0,hz._regions[t])(e,i)}static createRegionSpecTransformer(t,e){if(!hz._regions[t])return null;return new(0,hz._regions[t].transformerConstructor)(e)}static createSeries(t,e,i){if(!hz._series[t])return null;return new(0,hz._series[t])(e,i)}static createSeriesSpecTransformer(t,e){if(!hz._series[t])return null;return new(0,hz._series[t].transformerConstructor)(e)}static createMark(t,e,i){if(!hz._marks[t])return null;const s=new(0,hz._marks[t])(e,i);return"group"===s.type&&s.setInteractive(!1),s}static getComponents(){return Object.values(hz._components)}static getComponentInKey(t){return hz._components[t].cmp}static getLayout(){return Object.values(hz._layout)}static getLayoutInKey(t){return hz._layout[t]}static getSeries(){return Object.values(hz._series)}static getSeriesInType(t){return hz._series[t]}static getRegionInType(t){return hz._regions[t]}static getAnimationInKey(t){return hz._animations[t]}static getImplementInKey(t){return hz._implements[t]}static getSeriesMarkMap(t){return hz._series[t]?hz._series[t].mark:{}}static getChartPlugins(){return Object.values(hz._chartPlugin)}static getComponentPlugins(){return Object.values(hz._componentPlugin)}static getComponentPluginInType(t){return hz._componentPlugin[t]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}}hz._charts={},hz._series={},hz._components={},hz._marks={},hz._regions={},hz._animations={},hz._implements={},hz._chartPlugin={},hz._componentPlugin={},hz.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}},hz.dataParser={csv:Yr,dsv:Ur,tsv:Kr},hz._layout={};const cz=(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))},dz=(t,e,i,s)=>{var n;const r=jw(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:uz(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("_")}`,pz=(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},gz=(t,e)=>{if(!t)return null;if(!rB(t.getRegionsInIndex(),"polar"))return null;const{x:i,y:s}=e,n=pz(t,(t=>"angle"===t.getOrient()),e),r=pz(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&&jw(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=eB({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=iB(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=dz(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&&jw(r.type)){const h=t.getCenter(),c={x:i-t.getLayoutStartPoint().x-h.x,y:s-t.getLayoutStartPoint().y-h.y};let d=eB({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=iB(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 _=dz(f,t,"polar",o);a.push({index:v,value:f,position:r.scale(f),axis:t,data:_})}})),a.length?a:null};function mz(t){return"bottom"===t||"top"===t}function fz(t){return"left"===t||"right"===t}function vz(t){return"z"===t}function _z(t,e){return UF(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function yz(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function bz(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?mz(t)?"linear":"band":mz(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const xz=t=>t.fieldX[0],Sz=t=>t.fieldY[0],Az=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},kz=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},Mz=(t,e)=>t?e?xz:Az:e?Sz:kz,Tz=(t,e,i)=>{var s,n;if(!t)return null;if(!rB(t.getRegionsInIndex(),"cartesian"))return null;const{x:r,y:a}=e,o=null!==(s=pz(t,(t=>mz(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=pz(t,(t=>fz(t.getOrient())),e))&&void 0!==n?n:[],h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{jw(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=wz(s,i,t,Mz(e,jw(s.getScale().type)));n&&u.push(n)}}else{const n=h.size>0;if((n?h:c).has(s)){const r=wz(s,i,t,Mz(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},wz=(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 Cz(t,a,s)},Cz=(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=dz(e,t,"cartesian",null!=i?i:mz(t.getOrient())?xz:Sz);return{index:n,value:e,position:s.scale(e),axis:t,data:r}};class Ez{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:$y)("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:$y)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s;const n=null!==(i=Tz(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(s=gz(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=>jw(t.getScale().type))),r=n.length?n:s.filter((t=>{const e=t.getOrient();return mz(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=Cz(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var Pz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Pz||(Pz={}));const Bz={[Pz.dimensionHover]:class extends Ez{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)=>!cz(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}),tb(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}),tb(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[Pz.dimensionClick]:class extends Ez{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 Rz=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(Bz[t]){const e=new Bz[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(Bz[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}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class Lz{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}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const Oz={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 Iz{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 Lz);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}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 Oz[a]&&(a=Oz[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.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 hD.includes(e)||Object.values(t.VGRAMMAR_HOOK_EVENT).includes(e)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&kR.hasInteraction(e)}}function Dz(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function Fz(t,e,i){t.getParser(e)||t.registerParser(e,i)}const jz=new Map;let zz;function Hz(){zz||(zz=new va,Fz(zz,"geojson",da),Fz(zz,"topojson",pa),Dz(zz,"simplify",Rr))}function Vz(t,e,i={type:"geojson",centroid:!0}){jz.has(t)&&Xy(`map type of '${t}' already exists, will be overwritten.`),Hz();const s=new ya(zz),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}),jz.set(t,s)}function Nz(t){jz.has(t)?jz.delete(t):Xy(`map type of '${t}' does not exists.`)}function Gz(t,e=!1){let i=e;return t.latestData instanceof ya&&(i=!1),i?I(t.latestData):t.latestData.slice()}const Wz=(t,e)=>0===t.length?[]:1===t.length?Gz(t[0],null==e?void 0:e.deep):t.map((t=>Gz(t,null==e?void 0:e.deep)));function Uz(t,e,i){Dz(e=e instanceof va?e:t.dataSet,"copyDataView",Wz);const s=new ya(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:Xz.copyDataView}),s}function Yz(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:$y)(`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:$y)(`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([]),Xy("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 Kz(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var Xz;!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"}(Xz||(Xz={}));const $z=(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 uO(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:tH(this._option.mode),autoFit:!1,eventConfig:{gesture:tb(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())}clear(t,e=!1){const{chart:i}=t;i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=P_.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this._nextRafId&&(P_.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null),this._isRunning||(this.initView(),this._view&&(this._isRunning=!0,null===(e=this._view)||void 0===e||e.run(t),this._isRunning=!1,this._nextRafId&&(P_.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,this._isRunning=!0,null===(i=this._view)||void 0===i||i.run(t),this._isRunning=!1))))}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.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 Qy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function iH(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:$y)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function sH(t){t.crosshair=Y(t.crosshair||{}).map((e=>Tj({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function nH(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&&Qy(e.mode)){let t;t=_(h)?null===document||void 0===document?void 0:document.getElementById(h):h;const{width:e,height:s}=ii(t,i.width,i.height);a=e,o=s}else if(eb(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 rH(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")}),t}function aH(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"}(Jz||(Jz={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(Qz||(Qz={}));class oH{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({},oH.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]))))}}oH.defaultMarkInfo={};class lH{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new oH,this._markReverse=new oH,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement(Jz.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement(Jz.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement(Jz.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement(Jz.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement(Jz.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(Jz.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[Jz.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[Jz.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(Pz.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 hH={};Object.values(Jz).forEach((t=>{hH[t]=!0}));const cH={[Jz.STATE_HOVER]:Jz.STATE_HOVER_REVERSE,[Jz.STATE_SELECTED]:Jz.STATE_SELECTED_REVERSE,[Jz.STATE_DIMENSION_HOVER]:Jz.STATE_DIMENSION_HOVER_REVERSE};function dH(t){return cH[t]}class uH{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=dH(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=dH(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=dH(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=dH(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 pH{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 gH extends pH{constructor(){super(...arguments),this.id=sb(),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 mH extends gH{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,s){super(t),this.grammarType=Zz.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 fH extends pH{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 mH(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 vH extends fH{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 _H extends vH{constructor(){super(...arguments),this.id=sb(),this.stateKeyToSignalName=t=>`${hB}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===qz.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===qz.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?qz.none:qz.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?qz.exit:qz.appear}}}}class yH{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=>Tj({},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 bH extends pH{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=yH,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new oH,this._lastLayoutRect=null,this.id=sb(),this.userId=t.id,this._spec=t,this.effect={},this.event=new Rz(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=`${hB}_${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=hz.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 xH{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=XF($F(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:KF(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:KF(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:KF(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:KF(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:KF(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:KF(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=KF(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=KF(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]=KF(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 SH extends bH{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 xH(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 AH extends yH{_initTheme(t,e){return{spec:t,theme:this._theme}}}class kH extends SH{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=AH,this.modelType="region",this.specKey="region",this.type=kH.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.interaction=new uH,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 _H({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 lH(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 Qz)B(t.stateStyle[Qz[e]])||this.interaction.registerMark(Qz[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 MH(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 TH(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 wH(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 CH(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),wH(c,!0,u,o),s&&TH(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function EH(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),wH(c,!1,u,a),s&&TH(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function BH(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}=MH(t);s.length&&CH(s,e,i,!1,"left"),n.length&&CH(n,e,i,!0,"left"),r.length&&EH(r,e,0,"left")}(e,this,a),s.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=MH(t);s.length&&PH(s,e,i,!1,"top"),n.length&&PH(n,e,i,!0,"top"),r.length&&BH(r,e,0,"top")}(s,this,r),i.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=MH(t);s.length&&CH(s,e,i,!1,"right"),n.length&&CH(n,e,i,!0,"right"),r.length&&EH(r,e,0,"right")}(i,this,a),n.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=MH(t);s.length&&PH(s,e,i,!1,"bottom"),n.length&&PH(n,e,i,!0,"bottom"),r.length&&BH(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:$y)("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}}}RH.type="base";const LH=["line","area","trail"];function OH(t){return LH.includes(t)}class IH extends vH{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(OH)?s:!t.mark||OH(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=>!!hH[t])).map((t=>[t,10])),s=!t.mark||OH(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(hB)));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(hB)));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(Dw(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 DH extends gH{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=Zz.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 FH extends DH{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${hB}_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 jH extends gH{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=Zz.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 IH(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 Rz(s.getOption().eventDispatcher,s.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new FH(t)}stateKeyToSignalName(t){return`${hB}_${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=Jz.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=Jz.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===qz.appear&&this.runAnimationByState(qz.normal)})):this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,(()=>{this.runAnimationByState(qz.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),this._morph&&this._morphKey&&(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 zH extends jH{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].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))}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&&Tj(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(Fw(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=NF(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()):FD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Fw(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=LF(RF(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({},VD[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)FD.includes(null===(o=n.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(n.stroke)(t,e));else{const e=LF(RF(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 HH extends zH{constructor(){super(...arguments),this.type=HH.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)?(Xy("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?(Xy("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})}))}}HH.type="group";const VH=()=>{fM(),iM(),kR.registerGraphic(RB.group,ku),hz.registerMark(HH.type,HH)},NH={type:"clipIn"},GH={type:"fadeIn"};function WH(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 GH;default:return NH}}const UH={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"}},YH={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},KH={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},XH=()=>{hz.registerAnimation("scaleInOut",(()=>YH))},$H=()=>{hz.registerAnimation("fadeInOut",(()=>KH))},qH=(t,e)=>({appear:WH(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:Hc,duration:UH.update.duration,easing:UH.update.easing}],disappear:{type:"clipOut"}}),ZH=()=>{hz.registerAnimation("line",qH)},JH=()=>{uO.useRegisters([UI,YI,KI,XI,$I,qI,II,DI])},QH={measureText:(t,e,i,s)=>((t,e,i)=>GM(t,e,i,{fontFamily:vj.fontFamily,fontSize:vj.fontSize}))(e,i,s).measure(t)};class tV{static instance(){return tV.instance_||(tV.instance_=new tV),tV.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 eV{constructor(){this.id=sb(),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))?Xy("不要重复添加相同的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 iV extends eV{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 sV{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>hz.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>hz.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>hz.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return hz.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>hz.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){hz.registerTransform(t,e)}static registerFunction(t,e){t&&e&&tV.instance().registerFunction(t,e)}static unregisterFunction(t){t&&tV.instance().unregisterFunction(t)}static getFunction(t){return t?tV.instance().getFunction(t):null}static getFunctionList(){return tV.instance().getFunctionNameList()}static registerMap(t,e,i){const s=hz.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=hz.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,jz.get(e);var e}static hideTooltip(t=[]){Gj.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,c;this.id=sb(),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 d=this._option,{dom:u,renderCanvas:p,mode:g,stage:m,poptip:f}=d,v=e(d,["dom","renderCanvas","mode","stage","poptip"]),y=Qy(g);y&&u&&(this._container=_(u)?null===document||void 0===document?void 0:document.getElementById(u):u),p&&(this._canvas=p),m&&(this._stage=m),"node"===g||this._container||this._canvas||this._stage?(y?Cx(ql):"node"===g&&TA(ql),this._viewBox=this._option.viewBox,this._currentThemeName=Wj.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new eH({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:p},Object.assign(Object.assign({mode:this._option.mode,stage:m,pluginList:!1!==f?["poptipForText"]:[]},v),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new Iz(this,this._compiler),this._event=new Rz(this._eventDispatcher,g),this._compiler.initView(),null===(o=this.getStage())||void 0===o||o.setTheme({text:{fontFamily:null===(l=this._currentTheme)||void 0===l?void 0:l.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!y&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),Gj.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=Tj({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=Yj(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;sV.getFunctionList()&&sV.getFunctionList().length&&(t=Kj(t,sV)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=hz.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=hz.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=hz.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 nH(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:cB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:dB})}_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,Fz(this._dataSet,"dataview",ga),Fz(this._dataSet,"array",s),Dz(this._dataSet,"stackSplit",$z),Dz(this._dataSet,"copyDataView",Wz);for(const t in hz.transforms)Dz(this._dataSet,t,hz.transforms[t]);for(const t in hz.dataParser)Fz(this._dataSet,t,hz.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),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;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,null===(s=this._compiler)||void 0===s||s.releaseGrammar(!1===(null===(n=this._option)||void 0===n?void 0:n.animation)||!1===(null===(r=this._spec)||void 0===r?void 0:r.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.reCompile&&(null===(a=this._compiler)||void 0===a||a.clear({chart:this._chart,vChart:this},!this._option.animation||!this._spec.animation),null===(o=this._compiler)||void 0===o||o.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(){var t,e;this._option.animation&&(null===(t=this._chart)||void 0===t||t.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(qz.update,!0)})),null===(e=this._chart)||void 0===e||e.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(qz.update,!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,Gj.unregisterInstance(this)}updateData(t,e,s){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s)}))}_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){return u(this._dataSet)?this:this._chart?(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){if(this._chart)return this._chart.updateFullData(t),e&&this._compiler.render(),this;const i=Y(this._spec.data);return Y(t).forEach((t=>{var e;const{id:s,values:n,parser:r,fields:a}=t,o=i.find((t=>t.name===s));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 s=Yz(t,this._dataSet,i,{onError:null===(e=this._option)||void 0===e?void 0:e.onError});y(this._spec.data)&&this._spec.data.push(s)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i){const s=this._updateSpec(t,e);return s?(this.updateCustomConfigAndRerender(s,!0,{morphConfig:i,transformSpec:s.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){var i,s;const n=this._spec;if(!this._setNewSpec(t,e))return;G(n.theme,this._spec.theme)||this._setCurrentTheme();const r=this._shouldChartResize(n);return null===(s=null===(i=this._compiler)||void 0===i?void 0:i.getVGrammarView())||void 0===s||s.updateLayoutTag(),this._spec.type!==n.type?{reTransformSpec:!0,change:!0,reMake:!0,reCompile:!1,reSize:r}:(this._initChartSpec(this._spec,"render"),rH(this._chart.updateSpec(this._spec),{reTransformSpec:!1,change:r,reMake:!1,reCompile:!1,reSize:r}))}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)||wj(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)||wj(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=Tj({},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=Uj(this._currentThemeName,!0);else if(_(s)&&(!n||_(n))||_(n)&&(!s||_(s))){const t=Cj({},Uj(this._currentThemeName,!0),Uj(s,!0),Uj(n,!0));this._currentTheme=t}else{const t=Cj({},Uj(this._currentThemeName),Uj(s),Uj(n));this._currentTheme=Rj(t)}var r;r=R(this._currentTheme,"component.poptip"),z(eT.poptip,tT,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=!!Qy(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?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return Uj(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){if(!Wj.themeExist(t))return this;const e=this._setCurrentTheme(t);return yield this.updateCustomConfigAndRerender(e,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){if(!Wj.themeExist(t))return this;const e=this._setCurrentTheme(t);return this.updateCustomConfigAndRerender(e,!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}}_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 iH(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(!Qy(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)?null===document||void 0===document?void 0:document.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?qF(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 Xy("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?qF(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Xy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return tV.instance().getFunction(t)}registerFunction(t,e){t&&e&&tV.instance().registerFunction(t,e)}unregisterFunction(t){t&&tV.instance().unregisterFunction(t)}getFunctionList(){return tV.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}_initChartPlugin(){const t=hz.getChartPlugins();t.length>0&&(this._chartPlugin=new iV(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}}}sV.InstanceManager=Gj,sV.ThemeManager=Wj,sV.globalConfig={uniqueTooltip:!0},sV.Utils=QH,sV.vglobal=P_;hz.registerRegion("region",kH),hz.registerLayout("base",RH),VH(),uO.useRegisters([tI,eI]),uO.useRegisters([sD,nD,FI,jI,eD,iD,rD,aD,oD]),UR(),WR(),jj(yj.name,yj),at.getInstance(rt.Error);const nV=(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(oB).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=hz.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=hz.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},rV=(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=nV(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):bj(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const m=Tj({},i),f=d(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:Tj(m,f),hasChanged:!0};const i=Tj({},t,f);xj(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 aV{constructor(t){this.id=sb(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}const oV=t=>{hz.registerChartPlugin(t.type,t)};class lV extends aV{constructor(){super(lV.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[lV.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[lV.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=Sj(this._option.globalInstance.getSpec(),["data",lV.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=Sj(this._baseChartSpec,["data",lV.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=rV(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=Sj(i,["data",lV.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()}}lV.pluginType="chart",lV.specKey="media",lV.type="MediaQueryPlugin";const hV=/\{([^}]+)\}/,cV=/\{([^}]+)\}/g,dV=/:/;class uV extends aV{constructor(){super(uV.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[uV.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)),hz.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=hV.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(cV,((t,i)=>{if(!dV.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}}uV.pluginType="chart",uV.specKey="formatter",uV.type="formatterPlugin";const pV=()=>{oV(uV)};function gV(t){return 2===t.length&&k(t[0])&&k(t[1])&&t[1]>=t[0]}function mV(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 fV(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 vV(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 _V(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 yV(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 bV=(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 RC(v)};class xV extends aV{constructor(){super(xV.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!Dw(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&&gV(c)&&gV(d)))return;const u=mV(t,c),p=mV(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(!vV(u,p))return}else if(0===y&&0===b){if(!vV(p,u))return}else if(_||A)if(_&&!A){if(!fV(u,p))return}else if(A&&!_){if(!fV(p,u))return}else{if(m===b)return;if(m>b){if(!_V(u,p))return}else if(!_V(p,u))return}else{if(0===m&&0===y){if(!yV(u,p))return}else if(0===b&&0===g&&!yV(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){Dz(e.getOption().dataSet,"tickAlign",bV);const t={targetAxis:()=>s,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}xV.pluginType="component",xV.type="AxisSyncPlugin";const SV=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,AV=(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},mm||(mm=pm.CreateGraphic("richtext",{})),mm.setAttributes(a),mm.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}},kV="vchart-tooltip-container",MV={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}};function TV(t,e){return R(e,`component.${t}`)}function wV(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=hz.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const CV={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function EV(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 PV(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 BV(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function RV(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}const LV=(t,e,i)=>{var s;const n=null!==(s="band"===e?TV("axisBand",i):["linear","log","symlog"].includes(e)?TV("axisLinear",i):{})&&void 0!==s?s:{},r=mz(t)?TV("axisX",i):fz(t)?TV("axisY",i):TV("axisZ",i);return Tj({},TV("axis",i),n,r)},OV=(t,e,i)=>{var s;const n=null!==(s="band"===e?TV("axisBand",i):"linear"===e?TV("axisLinear",i):{})&&void 0!==s?s:{},r=TV("angle"===t?"axisAngle":"axisRadius",i);return Tj({},TV("axis",i),n,r)},IV=t=>"band"===t||"ordinal"===t||"point"===t;function DV(t,e){return{id:t,label:t,value:e,rawValue:t}}function FV(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 jV(t,e,i,s){let n=0,r=t.length-1;for(;n<=r;){const a=Math.floor((n+r)/2),o=t[a];if(o[i]<=e&&o[s||i]>=e)return o;o[i]>e?r=a-1:n=a+1}return null}const zV=(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(jw(a.type))A=a.bandwidth(),0===A&&a.step&&(M=a.step());else if(Dw(a.type)){const s=e.fieldX[0],r=e.fieldX2,a=jV(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=EV(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(jw(r.type))k=r.bandwidth(),0===k&&r.step&&(T=r.step());else if(Dw(r.type)){const s=e.fieldY[0],r=e.fieldY2,a=jV(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=EV(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(VV(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&&HV(t,"top",r.label),e.visible&&HV(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(VV(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&&HV(t,"left",a.label),e.visible&&HV(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}},HV=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=wV(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},VV=(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)}))}))},NV=(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=WV(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},GV=(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=WV(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},WV=(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},UV=(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},YV={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"]},KV=(t,e)=>{var i,s;return null!==(s=null===(i=YV[t])||void 0===i?void 0:i[0])&&void 0!==s?s:e},XV=(t,e)=>{var i,s;return null!==(s=null===(i=YV[t])||void 0===i?void 0:i[1])&&void 0!==s?s:e},$V=(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}=zV(3,e,i,s,n,r,a);return o?NV(r,o,d,h):l?GV(a,l,u,c):void 0},qV={fontFamily:vj.fontFamily,spacing:10,wordBreak:"break-word"};function ZV(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:qV),{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 JV=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},QV=(t,e)=>p(e)?t.map((t=>e[t])):void 0,tN=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),eN=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function iN(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=sN(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=>tN(i,s)(t)&&tN(n,r)(t)&&(u(a)||tN([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 sV.globalConfig.uniqueTooltip&&sV.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 sV.globalConfig.uniqueTooltip&&sV.hideTooltip(u.id),d}return"none"}const sN=(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=QV(c,t);let _=QV(d,t);const y=eN(_),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(tN(c,v));if(!y&&(_=QV(d,i),!eN(_)))return;const n=e.type===oB.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=jw(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(tN(c,n));f.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=QV(d,o),!eN(_))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(tN(c,n));if(!y&&(_=QV(d,r),!eN(_)))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===oB.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(tN(c,v))).find((t=>t[g]===m));f.forEach((n=>{if(_=QV(d,i),!eN(_))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},nN=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 rN=(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 aN{constructor(){this.activeTriggerSet={mark:new Set,dimension:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set,dimension:new Set,group:new Set}}}class oN extends aN{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:hN(e.title,{seriesId:this.series.id},!0),content:cN(e.content,{seriesId:this.series.id},!0)}))})),this.spec=a,this.activeType=nN(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 lN=(t,e,i)=>{const s=d(e)?e(t):e;return i?Object.assign(Object.assign({},t),s):Object.assign(Object.assign({},s),t)},hN=(t,e,i)=>p(t)?d(t)?(...s)=>lN(t(...s),e,i):lN(t,e,i):void 0,cN=(t,e,i)=>{const s=p(t)?Y(t).map((t=>d(t)?(...s)=>Y(t(...s)).map((t=>lN(t,e,i))):lN(t,e,i))):void 0;return s},dN=(t,e,i)=>{var s;let n={};switch(t){case"mark":case"group":e&&(n=null!==(s=rN(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=rN(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},uN=(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=pN(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)&&nN(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},pN=ft((t=>t.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(p))),[]))),gN=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},mN=(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}=wV(void 0,s,t,e);i&&r&&(n=i(...r))}return n},vN=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;class _N{}_N.dom=`${hB}_TOOLTIP_HANDLER_DOM`,_N.canvas=`${hB}_TOOLTIP_HANDLER_CANVAS`;const yN=20,bN={key:"其他",value:"..."},xN=(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)},SN=(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=vN(t.title,e,i),{visible:h,value:c,valueTimeFormat:p,valueTimeFormatMode:g,valueStyle:m,hasShape:f,valueFormatter:v}=null!=l?l:{},_=!1!==fN(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:xN(fN(c,t,i,v),p,g),valueStyle:fN(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=yN}=t,x=t.othersLine?Object.assign(Object.assign({},bN),t.othersLine):bN,S=t=>{if(null==t?void 0:t.length)for(const e of t)for(const t of null!=y?y:[]){const s=AN(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=AN(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},AN=(t,e,i)=>{const s=xN(fN(e.key,t,i,e.keyFormatter),e.keyTimeFormat,e.keyTimeFormatMode),n=xN(fN(e.value,t,i,e.valueFormatter),e.valueTimeFormat,e.valueTimeFormatMode),r=!1!==fN(e.visible,t,i)&&(p(s)||p(n)),a=fN(e.isKeyAdaptive,t,i),o=fN(e.spaceRow,t,i),l=fN(e.shapeType,t,i),h=fN(e.shapeColor,t,i),c=fN(e.shapeFill,t,i),d=fN(e.shapeStroke,t,i),u=fN(e.shapeLineWidth,t,i),g=fN(e.shapeHollow,t,i),m=fN(e.keyStyle,t,i),f=fN(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 kN extends aV{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=vN(x.position,b,e),M=null!==(n=vN(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:cB,R=null!==(o=null==P?void 0:P.height)&&void 0!==o?o:dB;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(Qy(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=SV(t,e),j=SV(T,D)}}else O.width=B,O.height=R;const z=j/F;let H,V,N,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=$V(e.dimensionInfo,rB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.x,a=t.end.x)}else W=t;if(L)switch(KV(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=$V(e.dimensionInfo,rB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.y,a=t.end.y)}else U=t;if(L)switch(XV(t)){case"top":V=r-C*z-_;break;case"bottom":V=a+_;break;case"center":V=(r+a)/2-C*z/2;break;case"centerTop":V=(r+a)/2-C*z-_;break;case"centerBottom":V=(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=UV(t,c),V=UV(i,c),N=UV(e,c),G=UV(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=UV(t,c):Y(t),S(e)||d(e)?V=UV(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(N))$=B-w*z-N;else{const t=Z;switch(KV(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(V))q=V;else if(k(G))q=R-C*z-G;else{const t=J;switch(XV(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,Qy(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"===KV(A,"right")?$+=v+w/2:$+=2*v+w)},at=()=>{et()&&($=-D.x/j)},ot=()=>{it()&&(L?$=(Q-D.x)/j-w:"center"===KV(A,"right")?$-=v+w/2:$-=2*v+w)},lt=()=>{it()&&($=(Q-D.x)/j-w)},ht=()=>{st()&&(L?q=-D.y/j:"center"===XV(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"===XV(A,"bottom")?q-=_+C/2:q-=2*_+C)},ut=()=>{nt()&&(q=(tt-D.y)/j-C)};switch(KV(A,"right")){case"center":case"centerLeft":case"centerRight":et()?(rt(),lt()):(ot(),at());break;case"left":rt(),lt();break;case"right":ot(),at()}switch(XV(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({},MV),{offsetX:null!==(t=null==i?void 0:i.x)&&void 0!==t?t:MV.offsetX,offsetY:null!==(e=null==i?void 0:i.y)&&void 0!==e?e:MV.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=$F(d.padding),S=ZV(Object.assign({textAlign:"right"===y?"right":"left"},u),i),A=ZV(Object.assign({textAlign:"right"===y?"right":"left"},m),i),k=ZV(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:JV(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=Tj({},A,ZV(b,void 0,{})),{width:s,height:n,text:r}=AV(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=Tj({},k,ZV(x,void 0,{})),{width:e,height:s,text:n}=AV(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(N){Y=Tj({},S,ZV(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}=AV(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,V=H+(O?T.title.spaceRow:0)}return P+=V,B+=V,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(Qy(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=SV(t,s),u=SV(l,c)}return s*=d,n*=d,Qy(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()}}kN.specKey="tooltip";const MN=(t,e)=>p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",TN=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 wN;const CN=(t=document.body)=>{if(u(wN)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),wN=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return wN};function EN(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}=Tj({},e,t),s={};return s.width=MN(i),s}(C),R=PN(E),L=PN(P),{bottom:O,left:I,right:D,top:F}=$F(h),j="right"===m?"marginLeft":"marginRight";return{align:m,panel:{width:MN(T+2*M),minHeight:MN(g+2*M),paddingBottom:MN(O),paddingLeft:MN(I),paddingRight:MN(D),paddingTop:MN(F),borderColor:k,borderWidth:MN(M),borderRadius:MN(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)?MN(null==r?void 0:r.spaceRow):"0px"},PN(Tj({},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 BN.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=BN.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==Jy?void 0:Jy.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(BN.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}}BN.type="tooltipModel";const RN={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},LN={boxSizing:"border-box"},ON={display:"inline-block",verticalAlign:"top"},IN={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},DN={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},FN={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},jN={lineHeight:"normal",boxSizing:"border-box"};class zN extends BN{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=TN(u),y=t=>new yg({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 HN extends BN{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 VN={overflowWrap:"normal",wordWrap:"normal"};class NN extends BN{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(Tj({},ON,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=Tj({},o?DN:IN,Object.assign(Object.assign(Object.assign({height:MN(l)},VN),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 Tj({},FN,Object.assign(Object.assign(Object.assign({height:MN(s)},VN),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 Tj({},jN,Object.assign(Object.assign({height:MN(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 GN extends BN{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 NN(this.product,this._option,t,e);return i.init(),this.children[i.childIndex]=i,i}setStyle(t){super.setStyle(Tj(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+TN(e)),0);return Object.assign(Object.assign({},t),{width:`${a+CN(this._option.getContainer())}px`,maxHeight:MN(s),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class WN extends BN{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 zN(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 HN(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(Tj({},RN,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 UN="99999999999999";class YN extends BN{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:UN,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 WN(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 GN(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(Tj({},LN,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 KN=t=>{hz.registerComponentPlugin(t.type,t)};class XN extends kN{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(XN.type),this.type=_N.dom,this._tooltipContainer=null==Jy?void 0:Jy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(Jy&&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=EN(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()}))}}XN.type=_N.dom;class $N extends kN{constructor(){super($N.type),this.type=_N.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 XP({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()}}$N.type=_N.canvas;const qN=()=>{KN($N)},ZN=(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},JN={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}},QN=(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=Xj([],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 tG(a,n,o)},tG=(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)=>{nb(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=>{nb(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]=JN[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},eG=(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=>{nb(t[e])||(t[e]=0)}))})),t};class iG extends DH{_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 sG=`${hB}_HIERARCHY_DEPTH`,nG=`${hB}_HIERARCHY_ROOT`,rG=`${hB}_HIERARCHY_ROOT_INDEX`;function aG(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function oG(t,e,i){t&&(i.needDefaultSeriesField&&(t[bD]=i.defaultSeriesField),t[_D]=e,t[yD]=i.getKey(t,e,i))}function lG(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function hG(t,e,i,s=0,n,r){void 0===r&&(r=e),oG(t,e,i),t[sG]=s,t[nG]=n||t[i.categoryField],t[rG]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>hG(e,s,i,t[sG]+1,t[nG],r)))}const cG=["appear","enter","update","exit","disappear","normal"];function dG(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 fG(n)&&delete n.type,n.oneByOne&&(n=pG(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:gG,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=Tj({},o[e],a);return fG(n)&&delete n.type,n.oneByOne&&(n=pG(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:gG,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s.state=s.update,s}function uG(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),vG(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 pG(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 gG(t,e){var i,s;return null!==(i=null==t?void 0:t[_D])&&void 0!==i?i:null===(s=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===s?void 0:s.elementIndex}function mG(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 fG(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function vG(t,e){if(y(t))t.forEach(((i,s)=>{t[s]=e(t[s],s),vG(t[s],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),vG(t[i],e)}class _G extends yH{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=EF(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=Pj(R(a,`series.${h}`),h,l,o),d=R(a,`series.${h}_${r}`);return Tj({},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),c(t.stackOffsetSilhouette)&&(this.stack=t.stackOffsetSilhouette||this.stack),p(t.stackValue)&&(this.stack=!0),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=Tj({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>Tj({},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 yG extends bH{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:`${hB}_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=_G,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=function(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)}(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)&&(Dz(this._rawData.dataSet,"invalidTravel",eG),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=Yz(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=Uz(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=Uz(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new iG(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;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){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];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):this._rawStatisticsCache[t]=tG(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t]}}return e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))&&(this._rawStatisticsCache[t].min=$(this._rawStatisticsCache[t].values),this._rawStatisticsCache[t].max=X(this._rawStatisticsCache[t].values)),this._rawStatisticsCache[t]}_statisticViewData(){Dz(this._dataSet,"dimensionStatistics",QN);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&&Xj(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){Dz(this._dataSet,"dimensionStatistics",QN);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=Xj(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&Xj(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)&&(Dz(this._rawData.dataSet,"addVChartProperty",ZN),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:aG.bind(this),call:oG}},!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=dG({},uG(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"}}:tb(s)||eb(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=Tj(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=Tj(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:Jz.STATE_HOVER_REVERSE,highlightState:Jz.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:Jz.STATE_SELECTED_REVERSE,state:Jz.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 t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:bD;this.getMarksWithoutRoot().forEach((t=>{const s={},n={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(s[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{n[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:xD,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][i]]:!0===s[t[i]]});const a={};Object.keys(n).forEach((e=>{a[e]=s=>{var n,a;let o;if(Array.isArray(s)){if(0===s.length)return;o=null===(n=r[s[0][i]])||void 0===n?void 0:n[e]}return o=null===(a=r[s[i]])||void 0===a?void 0:a[e],o||t.getAttribute(e,s)}})),this.setMarkStyle(t,a,xD)}))}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 oN(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=null!=i?i:{data:!0}).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((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||Kz(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()}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:bD,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new HF).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return RF(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:bD}}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()}`),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,Tj({},h,d||a[T.name]))}return T}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:yD}_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!==MD&&t!==wD&&t!==kD&&t!==TD||(t=this.getStackValueField()),null!==(e=qj(this.getRawData(),t))&&void 0!==e?e:t}getMarkInfoList(){var t;const e=super.getMarkInfoList();return e.length?e:Object.values(null!==(t=CF[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=>nb(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:bD]}}function bG(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();Dw(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 xG(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}}}yG.mark=ND,yG.transformerConstructor=_G;class SG extends yG{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);Dw(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:`${hB}_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(MD),this.setFieldX2(kD)):(this.setFieldY(MD),this.setFieldY2(kD))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(wD),this.setFieldX2(TD)):(this.setFieldY(wD),this.setFieldY2(TD))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(ED),this.setFieldX2(CD)):(this.setFieldY(ED),this.setFieldY2(CD))}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)&&(bG("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 AG="monotone",kG="linear";class MG{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($D.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:kG,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===AG?"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($D.point,{morph:mG(this._spec,$D.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:`${hB}_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(Pz.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:Jz.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[$D.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(Pz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,Tj({},this._spec[$D.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:Jz.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 TG extends zH{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)&&(Fw(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);let c=this._styleConvert(h);a&&"angle"===l&&(c=this.convertAngleToRadian(c)),this.setAttribute(l,c,e,i,s)})),o&&this.setEnableSegments(o)}}class wG extends TG{constructor(){super(...arguments),this.type=wG.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)===oB.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}wG.type="line";const CG=()=>{hz.registerMark(wG.type,wG),fM(),aM(),kR.registerGraphic(RB.line,Ag),JH()};class EG extends zH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class PG extends EG{constructor(){super(...arguments),this.type=PG.type}}PG.type="symbol";const BG=()=>{hz.registerMark(PG.type,PG),fO()};class RG extends _G{_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 LG extends eV{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function OG(t,e,i,s){switch(t){case r.cartesianBandAxis:return LV(_z(i,["z"]),"band",e);case r.cartesianLinearAxis:return LV(_z(i,["z"]),"linear",e);case r.cartesianLogAxis:return LV(_z(i,["z"]),"log",e);case r.cartesianSymlogAxis:return LV(_z(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return LV(_z(i),void 0,e);case r.polarBandAxis:return OV(i.orient,"band",e);case r.polarLinearAxis:return OV(i.orient,"linear",e);case r.polarAxis:return OV(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=TV(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>mz(t.orient)));let d;d=p(c)?Tj({},IV(c.type)?a:o,l):l;const u=n.find((t=>fz(t.orient)));let g;return g=p(u)?Tj({},jw(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=TV(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>"angle"===t.orient));let d;d=p(c)?Tj({},IV(c.type)?a:o,l):l;const u=n.find((t=>"radius"===t.orient));let g;return g=p(u)?Tj({},jw(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 IG(i,TV(t,e));default:return TV(t,e)}}const IG=(t,e)=>{var i;const s=Tj({},e,e[yz(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class DG extends yH{getTheme(t,e){return OG(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({},$F(e)),{[s]:0}))}}class FG extends SH{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 LG(this)}constructor(e,i){super(e,i),this.name="component",this.modelType="component",this.transformerConstructor=DG,this._delegateEvent=(e,i,s,n=null,r=null)=>{var a,o;i instanceof ec||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 _H({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}}}FG.transformerConstructor=DG;class jG extends zH{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(RB.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}jG.type="component";const zG=()=>{hz.registerMark(jG.type,jG)},HG=t=>t;class VG extends FG{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()?DB.circleAxisGrid:DB.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=dG(null===(o=hz.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 DH(this._option,t)]}collectData(t,e){const i=[];return sB(this._regions,(s=>{var n;let r=this.collectSeriesField(t,s);if(r=y(r)?Dw(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 sB(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=nB(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()})),sB(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(sB(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;tthis._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=az(s=t.domainLine)).startSymbol=az(s.startSymbol),s.endSymbol=az(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 lz(Tj({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:lz(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)=>lz(t[i](e.rawValue,s,e,n,r)):B(t[i])||(e[i]=lz(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 lz(Tj({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:lz(t.tick.style)),t.tick.state&&(i.tick.state=oz(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 lz(Tj({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:lz(t.subTick.style)),t.subTick.state&&(i.subTick.state=oz(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=CV[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?te(p):null,textStyle:Tj({},d,lz(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:lz(h.style)}),h.state&&(i.title.state.shape=oz(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:lz(o.style)}),o.state&&(i.title.state.background=oz(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=oz(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=lz(t.background.style)),t.background.state&&(i.panel.state=oz(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 lz(Tj({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:lz(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:lz(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=wV(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){Fz(this._option.dataSet,"scale",HG),Dz(this._option.dataSet,"ticks",UC);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)}}VG.specKey="axes";const NG=()=>{kR.registerGraphicComponent(IB.lineAxis,((t,e)=>new Cw(t,e))),kR.registerGraphicComponent(IB.circleAxis,(t=>new Rw(t))),kR.registerComponent(LB.axis,FO),kR.registerGraphicComponent(DB.lineAxisGrid,((t,e)=>new qC(t,e))),kR.registerGraphicComponent(DB.circleAxisGrid,((t,e)=>new JC(t,e))),kR.registerComponent(LB.grid,HO),zG(),hz.registerAnimation("axis",(()=>({appear:{custom:Ow},update:{custom:Lw},exit:{custom:Wc}})))},GG=[xV];class WG extends VG{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),sB(this._regions,(t=>{const e=this.getOrient();mz(e)?t.setXAxisHelper(this.axisHelper()):fz(e)?t.setYAxisHelper(this.axisHelper()):vz(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=Tj({x:t.x,y:t.y},this._axisStyle,n);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(Tj({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=mz(this.getOrient()),n=t=>{var e;return(s?!mz(t.getOrient()):mz(t.getOrient()))&&Dw(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=_z(i,["z"]),vz(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(!BV(e))return null;const{axisType:t,componentName:s}=bz(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=>fz(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(!BV(t))return;const{axisType:s,componentName:n}=bz(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=hz.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=[];mz(this.getOrient())?k(e)&&(o=this._inverse?[e-n,s]:[s,e-n]):vz(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(GG.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){mz(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&&!mz(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),!vz(this.getOrient())&&this._spec.innerOffset){const t=this._spec;fz(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=KF(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=KF(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=mz(this.getOrient())?t.fieldX:vz(this.getOrient())?t.fieldZ:t.fieldY,Dw(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:Dw(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&&(mz(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=mz(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 sB(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]:mz(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:vz(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();sB(this._regions,(e=>{mz(t)?(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):fz(t)?(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):vz(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=mz(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=mz(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=Tj(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 DV(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}=PV(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>=UG?10:n>=YG?5:n>=KG?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 $G extends WG{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new TC}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}}$G.type=r.cartesianLinearAxis,$G.specKey="axes",U($G,XG);const qG=()=>{NG(),hz.registerComponent($G.type,$G)};class ZG{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=DV(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=>DV(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 JG extends WG{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new rC}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{NG(),hz.registerComponent(JG.type,JG)};class tW extends $G{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),sB(this._regions,(t=>{mz(this.getOrient())?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=Tj({},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 DH(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=>DV(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=>DV(e.value,this._getNormalizedValue([e.value],t))))),s}transformScaleDomain(){}}tW.type=r.cartesianTimeAxis,tW.specKey="axes";class eW extends $G{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new EC}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(){}}eW.type=r.cartesianLogAxis,eW.specKey="axes",U(eW,XG);class iW extends $G{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new PC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}transformScaleDomain(){}}iW.type=r.cartesianSymlogAxis,iW.specKey="axes",U(iW,XG);class sW extends SG{constructor(){super(...arguments),this.type=oB.line,this.transformerConstructor=RG,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(dG(null===(i=hz.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),uG("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=xG(this);this._symbolMark.setAnimationConfig(dG(null===(s=hz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),uG("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]}}sW.type=oB.line,sW.mark=qD,sW.transformerConstructor=RG,U(sW,MG);class nW{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)=>{Kz(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 rW{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)=>{rb(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{Xj(e,[{key:t,operations:Dw(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&&Xj(e,[{key:i.field,operations:Dw(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?NF("colorOrdinal"):NF(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(rb(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),rb(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(!rb(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=Dw(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=Dw(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;Dw(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(Dw(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=Dw(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)));Dw(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 aW{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=Zj(t,!0);for(const e in a)for(const i in a[e].nodes)ez(a[e].nodes[i],t.getStackInverse(),n);if(r)for(const t in a)for(const e in a[t].nodes)tz(a[t].nodes[e]);s&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&Qj(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 oW extends pH{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=sb(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:cB,height:dB},this._viewRect={width:cB,height:dB},this._viewBox={x1:0,y1:0,x2:cB,y2:dB},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=$F(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new Rz(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new nW(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._spec.background&&"object"==typeof this._spec.background&&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 aW(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=function(t){if(!t)return null;if("string"==typeof t)return{fill:t,fillOpacity:1};if("object"!=typeof t)return null;const e=H(t,["x","y","width","height","x1","y1","image"]);return e.background=t.image,e}(this._spec.background);t&&(this._backgroundMark=hz.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({},t),{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=hz.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 bH)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 zH))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof zH)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&&Kz(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=nH(this._spec,this._option,{width:cB,height:dB})),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=RF(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new rW(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){rH(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=RF(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{rH(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{var s,n;const r=i.specKey||i.type,a=null!==(s=this._spec[r])&&void 0!==s?s:{};y(a)?(e[r]=e[r]||{specCount:a.length,componentCount:0},e[r].componentCount++,rH(t,i.updateSpec(null!==(n=a[i.getSpecIndex()])&&void 0!==n?n:{},a))):rH(t,i.updateSpec(a))}));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()];rH(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=XF(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(Jz.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(Jz.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(Jz.STATE_SELECTED)}clearHovered(){this.clearState(Jz.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===Pz.dimensionHover||s===Pz.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>jw(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=>{r?i[t.series.fieldY[0]]=s:i[t.series.fieldX[0]]=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 lW=(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 hW{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);xj(t,r,l.spec),xj(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}));xj(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=lW(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=lW(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(hz.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(hz.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=hz.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=hz.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=hz.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 cW extends hW{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")&&Tj(i,aH(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 dW extends cW{_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),sH(t)}}class uW extends oW{constructor(){super(...arguments),this.transformerConstructor=dW,this.type="line",this.seriesType=oB.line,this._canStack=!0}}uW.type="line",uW.seriesType=oB.line,uW.transformerConstructor=dW;class pW extends TG{constructor(){super(...arguments),this.type=pW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}pW.type="area";const gW=()=>{hz.registerMark(pW.type,pW),fM(),qk(),kR.registerGraphic(RB.area,Ug),JH()};class mW extends oN{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 fW=()=>{hz.registerAnimation("area",qH),ZH(),XH()};class vW extends RG{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=Tj({},m.style,g.style),l.state=Tj({},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 _W extends SG{constructor(){super(...arguments),this.type=oB.area,this.transformerConstructor=vW,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(_W.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===AG?"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 GF(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 GF(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(dG(null===(e=hz.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),uG("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(dG(null===(i=hz.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),uG("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=xG(this);this._symbolMark.setAnimationConfig(dG(null===(s=hz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),uG("point",this._spec,this._markAttributeContext),t))}}initTooltip(){this._tooltipHelper=new mW(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}}}_W.type=oB.area,_W.mark=JD,_W.transformerConstructor=vW,U(_W,MG);class yW extends cW{_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),sH(t)}}class bW extends oW{constructor(){super(...arguments),this.transformerConstructor=yW,this.type="area",this.seriesType=oB.area,this._canStack=!0}}bW.type="area",bW.seriesType=oB.area,bW.transformerConstructor=yW;function xW(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 SW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:xW(t,e)}),AW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:xW(t,e)}),kW={type:"fadeIn"},MW={type:"growCenterIn"};function TW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return kW;case"scaleIn":return MW;default:return SW(t)}}class wW extends zH{constructor(){super(...arguments),this.type=wW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}wW.type="rect";const CW=()=>{hz.registerMark(wW.type,wW),gO(),uO.useRegisters([VI,NI,GI,WI,zI,HI])};function EW(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[GD]):this._spec.barMinHeight?this._calculateRectPosition(t,!1):GF(this._dataToPosX(t),e),this._getBarXEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[WD]):GF(this._dataToPosX1(t),e),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[UD]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):GF(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[YD]):GF(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({},RW.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{morph:mG(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(RW.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(Dz(this._option.dataSet,"addVChartProperty",ZN),s){const t=([t],{scaleDepth:e})=>{var i;let s=[{}];const n=this.getDimensionField(),r=u(e)?n.length:Math.min(n.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};Dz(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:aG.bind(this),call:oG}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new iG(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=YD,s=UD,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=WD,s=GD,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=Zj(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)EW(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=GF(this[n](t),o),d=GF(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[kD],n=t[MD],r=t[TD],h=t[wD];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]),{[kD]:i,[MD]:s}),a?{[TD]:o,[wD]:l}:void 0);t.push(Tg(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=>GF(this._dataToPosY(t),a),y1:t=>GF(this._dataToPosY1(t),a)}:{y:t=>GF(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=>GF(this._dataToPosX(t),r),x1:t=>GF(this._dataToPosX1(t),r)}:{x:t=>GF(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=xG(this);this._barMark.setAnimationConfig(dG(null===(e=hz.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),uG(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;if(void 0!==this._spec.barWidth&&r===n)return ZF(this._spec.barWidth,a);const o=void 0!==this._spec.barMinWidth,l=void 0!==this._spec.barMaxWidth;let h=a;return o&&(h=Math.max(h,ZF(this._spec.barMinWidth,a))),l&&(h=Math.min(h,ZF(this._spec.barMaxWidth,a))),h}_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=ZF(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=Dw(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}}RW.type=oB.bar,RW.mark=KD,RW.transformerConstructor=BW;const LW=()=>{iI(),CW(),hz.registerAnimation("bar",((t,e)=>({appear:TW(t,e),enter:SW(t,!1),exit:AW(t,!1),disappear:AW(t)}))),QG(),qG(),hz.registerSeries(RW.type,RW)};class OW extends cW{_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),sH(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 IW extends oW{constructor(){super(...arguments),this.transformerConstructor=OW,this.type="bar",this.seriesType=oB.bar,this._canStack=!0}}IW.type="bar",IW.seriesType=oB.bar,IW.transformerConstructor=OW;class DW extends zH{constructor(){super(...arguments),this.type=DW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}DW.type="rect3d";class FW extends RW{constructor(){super(...arguments),this.type=oB.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d"}}FW.type=oB.bar3d,FW.mark=XD;class jW extends OW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}class zW extends IW{constructor(){super(...arguments),this.transformerConstructor=jW,this.type="bar3d",this.seriesType=oB.bar3d}}zW.type="bar3d",zW.seriesType=oB.bar3d,zW.transformerConstructor=jW;const HW=[10,20],VW=Pw.Linear,NW="circle",GW=Pw.Ordinal,WW=["circle","square","triangle","diamond","star"],UW=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class YW extends _G{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class KW extends SG{constructor(){super(...arguments),this.type=oB.scatter,this.transformerConstructor=YW,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=`${hB}_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=`${hB}_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:VW,defaultRange:HW},"size")}getShapeAttribute(t,e){return u(e)?NW:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:GW,defaultRange:WW},"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(KW.mark.point,{morph:mG(this._spec,KW.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=xG(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(dG(null===(i=hz.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),uG("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:NW},Jz.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},Jz.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},Jz.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},Jz.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},Jz.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]}}KW.type=oB.scatter,KW.mark=ZD,KW.transformerConstructor=YW;const XW=()=>{BG(),hz.registerAnimation("scatter",((t,e)=>Object.assign({appear:UW(0,e)},YH))),QG(),qG(),hz.registerSeries(KW.type,KW)};class $W extends cW{_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 qW extends oW{constructor(){super(...arguments),this.transformerConstructor=$W,this.type="scatter",this.seriesType=oB.scatter,this._canStack=!0}}qW.type="scatter",qW.seriesType=oB.scatter,qW.transformerConstructor=$W;Ln();const ZW={},JW=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function QW(t,e){t&&_(t)||lb("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(ZW[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 JW.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}(i,e)),ZW[i]||null}const tU={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(tU).forEach((t=>{QW(t,tU[t])}));const eU="Feature",iU="FeatureCollection";function sU(t){const e=Y(t);return 1===e.length?e[0]:{type:iU,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===iU?t.features:Y(t).filter((t=>!u(t))).map((t=>t.type===eU?t:{type:eU,geometry:t}))}(e))),[])}}const nU=JW.concat(["pointRadius","fit","extent","size"]);function rU(t,e){let i=[];return t?(Object.keys(t).forEach((s=>{nU.includes(s)&&(i=i.concat(dR(t[s],e)))})),i):i}let aU=class extends $R{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(dR(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(dR(t,this.view)),this.commit(),this}size(t){return u(this.spec.size)||this.detach(dR(this.spec.size,this.view)),this.spec.size=t,this.attach(dR(t,this.view)),this.commit(),this}extent(t){return u(this.spec.extent)||this.detach(dR(this.spec.extent,this.view)),this.spec.extent=t,this.attach(dR(t,this.view)),this.commit(),this}fit(t){return u(this.spec.fit)||this.detach(dR(this.spec.fit,this.view)),this.spec.fit=t,this.attach(dR(t,this.view)),this.commit(),this}configure(t){return this.detach(rU(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(rU(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=QW((t||"mercator").toLowerCase());return e||lb("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),JW.forEach((t=>{u(this.spec[t])||function(t,e,i){d(t[e])&&t[e](i)}(this.projection,t,pR(this.spec[t],e,QW))})),u(this.spec.pointRadius)||this.projection.path.pointRadius(pR(this.spec.pointRadius,e,QW)),!(u(this.spec.fit)||u(this.spec.extent)&&u(this.spec.size))){const t=sU(pR(this.spec.fit,e,QW));this.spec.extent?this.projection.fitExtent(pR(this.spec.extent,e,QW),t):this.spec.size&&this.projection.fitSize(pR(this.spec.size,e,QW),t)}return this.projection}output(){return this.projection}};const oU=(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 lU extends yG{constructor(){super(...arguments),this.type=oB.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=`${hB}_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 hU=`${hB}_MAP_LOOK_UP_KEY`,cU=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[_D]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[hU]=e.nameMap[n]:t[hU]=n})),t.features);class dU extends oN{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 uU extends zH{constructor(){super(...arguments),this.type=uU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}uU.type="path";const pU=()=>{hz.registerMark(uU.type,uU),pO()};class gU{constructor(t){this.projection=QW(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 mU{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 fU{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 vU(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:mU}:tb(e)||eb(e)?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:fU}:null}const _U={debounce:xt,throttle:St};class yU{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=tb(this._renderMode)||eb(this._renderMode),vU(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return vU(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;u(n)||De({x:r,y:a},this._getRegionOrSeriesLayout(e),!1)&&(i&&i({zoomDelta:n,zoomX:r,zoomY:a},s),this._eventObj.emit("zoom",{scale:s.zoomDelta,scaleCenter:{x:s.zoomX,y:s.zoomY},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,_U[o]((t=>{this._zoomableTrigger.clearZoom()}),l)),h.on(...c,_U[o]((t=>{this._zoomEventDispatch(t,i,s)}),l))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||vU(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||vU(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,_U[o]((t=>{this._zoomableTrigger.clearScroll()}),l)),h.on(...c,_U[o]((t=>this._scrollEventDispatch(t,i,s)),l))}initScrollEventOfSeries(t,e,i){vU(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||vU(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||vU(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||vU(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=_U[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)}),l),_=_U[o]((t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1;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 bU(t,e){return`${hB}_${e}_${t}`}class xU extends FG{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:bU(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),e&&(e.zoomDelta=l),this.zoom(l,[t.zoomX,t.zoomY]),l},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=Tj(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},s=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,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 gU(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===oB.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),sB(this._regions,(t=>{var e;if(t.type===oB.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===oB.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[hU],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}}xU.type=r.geoCoordinate,U(xU,yU);const SU=()=>{hz.registerComponent(xU.type,xU)};class AU extends _G{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class kU extends lU{constructor(){super(...arguments),this.type=oB.map,this.transformerConstructor=AU,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 !`),jz.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),Dz(this._dataSet,"copyDataView",Wz),Dz(this._dataSet,"map",cU),Dz(this._dataSet,"lookup",oU);const i=jz.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:Xz.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:hU,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 iG(this._option,s)}initMark(){this._pathMark=this._createMark(kU.mark.area,{morph:mG(this._spec,kU.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:bD])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:bD]):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(dG(null===(t=hz.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),uG("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new dU(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[_D]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[_D],{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 _D}getActiveMarks(){return[this._pathMark]}}kU.type=oB.map,kU.mark=sF,kU.transformerConstructor=AU;const MU=()=>{kR.registerGrammar("projection",aU,"projections"),SU(),pU(),hz.registerSeries(kU.type,kU),hz.registerImplement("registerMap",Vz),hz.registerImplement("unregisterMap",Nz),$H()},TU=(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[RD]=!0:delete t[RD]})),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=wU([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}=CU(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=wU(a,t,n,r,h,l,i,e),r.push(n)})),r};function wU(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}=CU(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===pD)&&(t[pD]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function CU(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?Xy("total.collectCountField error"):n=e[a].start;o<0?Xy("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 EU=(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},PU={type:"fadeIn"},BU={type:"growCenterIn"};function RU(t,e){switch(e){case"fadeIn":return PU;case"scaleIn":return BU;default:return SW(t,!1)}}class LU extends zH{constructor(){super(...arguments),this.type=LU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}LU.type="rule";const OU=()=>{hz.registerMark(LU.type,LU),mO()},IU=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:DU(t.map((t=>t.latestData)).flat(),e.fields,i)}};function DU(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)=>DU(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class FU{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"}),Dz(e,"dimensionTree",IU),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 jU extends BW{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel")}}const zU={rect:WU,symbol:NU,arc:YU,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=NU(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1);return e},stackLabel:KU,line:XU,area:XU,rect3d:WU,arc3d:YU,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function HU(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}=wV(i,s,o.text,e);return h&&(o.text=h(...c,{series:a})),o}function VU(t){return d(t)?e=>t(e.data):t}function NU(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=VU(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:GU(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function GU(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function WU(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=VU(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:UU(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function UU(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 YU(t){var e;const{labelSpec:i}=t,s=null!==(e=VU(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 KU(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=HU(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),mp(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 XU(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 $U extends RW{constructor(){super(...arguments),this.type=oB.waterfall,this.transformerConstructor=jU,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 FU(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=pD)}getSeriesKeys(){return this._seriesField===pD?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),Dz(this._dataSet,"waterfallFillTotal",EU),Dz(this._dataSet,"waterfall",TU),(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=Uz(this.getViewData(),this._dataSet,{name:`${hB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new iG(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:kD,endAs:MD,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=xG(this);this._barMark.setAnimationConfig(dG(null===(i=hz.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),uG("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(dG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),uG("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($U.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){if(!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible))return super.initLabelMarkStyle(t),void(this._labelMark=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 KU(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?GF(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):GF(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))}}$U.type=oB.waterfall,$U.mark=uF,$U.transformerConstructor=jU;const qU=()=>{OU(),CW(),hz.registerAnimation("waterfall",((t,e)=>({appear:RU(t,e),enter:SW(t,!1),exit:AW(t,!1),disappear:AW(t,!1)}))),$H(),QG(),qG(),hz.registerSeries($U.type,$U)},ZU=`${hB}_BOX_PLOT_OUTLIER_VALUE`;var JU;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(JU||(JU={}));const QU=(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={[ZU]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class tY extends oN{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===JU.OUTLIER)return this.series.getOutliersField();if(t===JU.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case JU.MIN:return this.series.getMinField();case JU.MAX:return this.series.getMaxField();case JU.MEDIAN:return this.series.getMedianField();case JU.Q1:return this.series.getQ1Field();case JU.Q3:return this.series.getQ3Field();case JU.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===JU.OUTLIER)return e[ZU];if(t===JU.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case JU.MIN:return e[this.series.getMinField()];case JU.MAX:return e[this.series.getMaxField()];case JU.MEDIAN:return e[this.series.getMedianField()];case JU.Q1:return e[this.series.getQ1Field()];case JU.Q3:return e[this.series.getQ3Field()];case JU.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[ZU])}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.getContentKey(JU.OUTLIER),value:this.getContentValue(JU.OUTLIER),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(JU.MAX),value:this.getContentValue(JU.MAX),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(JU.Q3),value:this.getContentValue(JU.Q3),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(JU.MEDIAN),value:this.getContentValue(JU.MEDIAN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(JU.Q1),value:this.getContentValue(JU.Q1),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(JU.MIN),value:this.getContentValue(JU.MIN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(JU.SERIES_FIELD),value:this.getContentValue(JU.SERIES_FIELD),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]}}}class eY extends zH{constructor(){super(...arguments),this.type=eY.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}}eY.type="boxPlot";const iY=()=>{hz.registerMark(eY.type,eY),kR.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(SO).registerChannelEncoder("x",((t,e,i,s,n,r)=>r&&yb(r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,s,n,r)=>r&&yb(r.direction)?{shaft:{y:e,y1:e}}:null)).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&yb(r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&yb(r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&yb(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&&yb(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&&yb(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&&yb(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}}))),kR.registerAnimationType("boxplotScaleIn",AO),kR.registerAnimationType("boxplotScaleOut",kO),_O(),gO(),mO(),kR.registerGlyph("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(TO).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&yb(r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&yb(r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&yb(r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&yb(r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&yb(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}}))),kR.registerAnimationType("barBoxplotScaleIn",wO),kR.registerAnimationType("barBoxplotScaleOut",CO),_O(),gO(),mO()};class sY extends SG{constructor(){super(...arguments),this.type=oB.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(sY.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(sY.mark.outlier,{progressive:t,key:_D,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,Jz.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"},Jz.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=>GF(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>GF(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>GF(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>GF(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>GF(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},Jz.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=>GF(e(this.getDatumPositionValues(t,ZU),{bandPosition:this._bandPosition}),s)}:{x:this.dataToPositionX.bind(this),y:t=>GF(e(this.getDatumPositionValues(t,ZU),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,Jz.STATE_NORMAL,t.AttributeLevel.Series)}}initData(){if(super.initData(),!this._data)return;Dz(this._dataSet,"foldOutlierData",QU),Dz(this._dataSet,"addVChartProperty",ZN);const t=new ya(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${hB}_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:aG.bind(this),call:oG}},!1),this._outlierDataView=new iG(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=xG(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=hz.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(uG("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(dG(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(dG(null===(a=hz.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new tY(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]}}sY.type=oB.boxPlot,sY.mark=pF;class nY extends zH{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=nY.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})}}nY.type="text";const rY=()=>{hz.registerMark(nY.type,nY),vO(),fM(),gM(),kR.registerGraphic(RB.richtext,zg)};function aY(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 oY extends oN{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 lY=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),hY={type:"fadeIn"},cY=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function dY(t,e){return"fadeIn"===e?hY:lY(t)}class uY extends BW{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 pY extends RW{constructor(){super(...arguments),this.type=oB.rangeColumn,this._barMarkType="rect",this._barName=oB.bar,this.transformerConstructor=uY}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(pY.mark.bar,{morph:mG(this._spec,pY.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(pY.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(pY.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}});aY(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}});aY(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=xG(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(dG(null===(i=hz.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),uG("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(dG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),uG("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(dG(null===(n=hz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),uG("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new oY(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)}}pY.type=oB.rangeColumn,pY.mark=yF,pY.transformerConstructor=uY;const gY=()=>{CW(),rY(),hz.registerAnimation("rangeColumn",((t,e)=>({appear:dY(t,e),enter:lY(t),exit:cY(t),disappear:cY(t)}))),$H(),QG(),qG(),hz.registerSeries(pY.type,pY)};class mY extends pY{constructor(){super(...arguments),this.type=oB.rangeColumn3d,this._barMarkType="rect3d",this._barName=oB.bar3d}}mY.type=oB.rangeColumn3d,mY.mark=bF;class fY extends oN{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 vY extends _W{constructor(){super(...arguments),this.type=oB.rangeArea}initMark(){var t;const{customShape:e,stateSort:i}=null!==(t=this._spec.area)&&void 0!==t?t:{};this._areaMark=this._createMark(vY.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 fY(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))}}vY.type=oB.rangeArea,vY.mark=kF;class _Y extends yG{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=EB,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:[]};Dw(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:[]};Dw(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)&&bG(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 yY=(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[_B],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[_B]*t;g(e,b,i),b+=i}))}return 0!==m&&(i[i.length-1][l]=r),i};function bY(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const xY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:bY(t,!0,qz.appear)}),SY={type:"fadeIn"},AY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:bY(t,!0,qz.enter)}),kY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:bY(t,!0,qz.exit)}),MY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:bY(t,!0,qz.exit)});function TY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return SY;case"growRadius":return xY(Object.assign(Object.assign({},t),{growField:"radius"}));default:return xY(Object.assign(Object.assign({},t),{growField:"angle"}))}}class wY extends zH{constructor(t,e){super(t,e),this.type=CY.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[AB])[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 CY extends wY{constructor(){super(...arguments),this.type=CY.type}}CY.type="arc";const EY=()=>{fM(),Xk(),kR.registerGraphic(RB.arc,Xg),uO.useRegisters([QI,tD,ZI,JI]),hz.registerMark(CY.type,CY)};class PY extends _G{_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=Tj({},this._theme,i,t);const n=(t,e)=>Tj({},"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 BY extends _Y{constructor(){super(...arguments),this.transformerConstructor=PY,this._pieMarkName="pie",this._pieMarkType="arc",this._startAngle=TB,this._endAngle=wB,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this.dataToCentralPosition=t=>{const e=t[AB];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;Dz(this._dataSet,"pie",yY),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:bB,asEndAngle:xB,asRatio:yB,asMiddleAngle:AB,asRadian:MB,asQuadrant:kB,asK:SB}},!1);const e=new ya(this._dataSet,{name:`${hB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new iG(this._option,e)}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},BY.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{morph:mG(this._spec,this._pieMarkName),defaultMorphElementKey:this._seriesField,key:yD,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 aB(bB)(t)}endAngleScale(t){return aB(xB)(t)}initMarkStyle(){const e=this._pieMark;e&&this.setMarkStyle(e,{x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:WF(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:WF(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:aB(mB).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[AB];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===qz.appear)return this._startAngle;if(i===qz.disappear)return this._endAngle;const n=[qz.disappear,qz.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[_D];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[_D]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[_D])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[_D])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+se({x:0,y:0},a,e[AB]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+se({x:0,y:0},a,e[AB]).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[AB]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+se({x:0,y:0},a,e[AB]).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]}}BY.transformerConstructor=PY,BY.mark=tF;class RY extends BY{constructor(){super(...arguments),this.type=oB.pie}}RY.type=oB.pie;const LY=()=>{EY(),hz.registerAnimation("pie",((t,e)=>({appear:TY(t,e),enter:AY(t),exit:kY(t),disappear:MY(t)}))),hz.registerSeries(RY.type,RY)};class OY extends wY{constructor(){super(...arguments),this.type=OY.type,this._support3d=!0}}OY.type="arc3d";class IY extends PY{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class DY extends BY{constructor(){super(...arguments),this.type=oB.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=IY}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[AB];return"inside"===i.position?ee(e):0},this.setMarkStyle(e,Object.assign(Object.assign({},s),{z:100}),void 0,t.AttributeLevel.Mark)}}DY.type=oB.pie3d,DY.mark=eF,DY.transformerConstructor=IY;const FY=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)=>e.getGraphicAttribute("innerRadius")},outerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("outerRadius")}}}},jY={type:"fadeIn"},zY=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),HY=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),VY=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function NY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return jY;case"growAngle":return FY(Object.assign(Object.assign({},t),{growField:"angle"}));default:return FY(Object.assign(Object.assign({},t),{growField:"radius"}))}}class GY extends _Y{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(MD),this.setInnerRadiusField(kD)}setValueFieldToPercent(){this.setRadiusField(wD),this.setInnerRadiusField(TD)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}class WY extends _G{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}const UY=(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:CB,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:EB,layoutRadius:e.layoutRadius}};class YY extends VG{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(!RV(e))return null;const{axisType:i,componentName:s,startAngle:n,endAngle:r,center:a,outerRadius:o,layoutRadius:l}=UY(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(!RV(e))return;const{axisType:a,componentName:o,startAngle:l,endAngle:h,center:c,outerRadius:d,layoutRadius:u}=UY(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=hz.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=TB,this._endAngle=wB,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),sB(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:EV(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(){sB(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 Dw(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:Dw(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:KF(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:KF(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=>DV(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=EB,e=0;const i=this.getChart().getSpec();return sB(this.getRegions(),(s=>{const n=s;if(r=n.type,[oB.rose,oB.radar,oB.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(Tj({},this._axisStyle,s)),this._gridMark){this._gridMark.getProduct().encode(Tj({},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)}}YY.type=r.polarAxis,YY.specKey="axes";class KY extends YY{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new TC}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}}KY.type=r.polarLinearAxis,KY.specKey="axes",U(KY,XG);const XY=()=>{NG(),hz.registerComponent(KY.type,KY)};class $Y extends YY{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new rC}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(){}}$Y.type=r.polarBandAxis,$Y.specKey="axes",U($Y,ZG);const qY=()=>{NG(),hz.registerComponent($Y.type,$Y)};class ZY extends GY{constructor(){super(...arguments),this.type=oB.rose,this.transformerConstructor=WY,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(ZY.mark.rose,{morph:mG(this._spec,ZY.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=>GF(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=GF(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(dG(null===(i=hz.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),uG("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}ZY.type=oB.rose,ZY.mark=iF,ZY.transformerConstructor=WY;const JY=()=>{hz.registerSeries(ZY.type,ZY),EY(),hz.registerAnimation("rose",((t,e)=>({appear:NY(t,e),enter:zY(t),exit:HY(t),disappear:VY(t)}))),qY(),XY()};class QY extends mc{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);k(t*e)||(this.valid=!1),this._fromAngle=t,this._fromRadius=e;const{angle:i,radius:s}=this._pointToCoord(this.to);k(i*s)||(this.valid=!1),this._toAngle=i,this._toRadius=s}onUpdate(t,e,i){if(!1!==this.valid)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 tK extends Hc{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}),r=re(s.angle),a=re(n.angle),o=this._pointToCoord(e),l=this._pointToCoord({x:e.x1,y:e.y1}),h=re(o.angle),c=re(l.angle),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 eK=t=>({type:"in"===t?"fadeIn":"fadeOut"});function iK(t,e,i){return"fadeIn"===e?eK(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function sK(t,e,i){return"fadeIn"===e?eK(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 nK=(t,e)=>({custom:Nc,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 rK extends GY{constructor(){super(...arguments),this.type=oB.radar,this.transformerConstructor=RG,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(rK.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:kG,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):TB,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(dG(null===(s=hz.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),uG("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=hz.getAnimationInKey(e);t.setAnimationConfig(dG(null==i?void 0:i(n,r),uG(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}}}rK.type=oB.radar,rK.mark=QD,rK.transformerConstructor=RG,U(rK,MG);const aK=()=>{hz.registerSeries(rK.type,rK),sI(),gW(),CG(),BG(),hz.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:iK(t,e,"in"),enter:iK(t,e,"in"),exit:iK(t,e,"out"),disappear:"clipIn"===e?void 0:iK(t,e,"out"),update:[{options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:tK,customParameters:t,duration:UH.update.duration,easing:UH.update.easing}]}))),hz.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:sK(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:sK(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:QY,customParameters:t,duration:UH.update.duration,easing:UH.update.easing}]}))),hz.registerAnimation("radarGroup",((t,e)=>({appear:nK(t,"in"),disappear:nK(t,"out")}))),Xk(),qY(),XY()};class oK extends oN{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 lK=(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},hK={fill:"#bbb",fillOpacity:.2};class cK extends SG{constructor(){super(...arguments),this.type=oB.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]])),Dz(this._option.dataSet,"objFlat",lK),Dz(this._option.dataSet,"copyDataView",Wz),Fz(this._option.dataSet,"dataview",ga),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:Xz.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(Tj(hK,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(cK.mark.group),this._containerMark=this._createMark(cK.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(cK.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(cK.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(cK.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(cK.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(cK.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(cK.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:bD}}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 HF).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:bD}}initTooltip(){this._tooltipHelper=new oK(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]}}cK.type=oB.dot,cK.mark=oF;class dK extends oN{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 uK=(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 pK extends SG{constructor(){super(...arguments),this.type=oB.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(),Dz(this._option.dataSet,"linkDotInfo",uK),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:Xz.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(pK.mark.group),this._containerMark=this._createMark(pK.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(pK.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(pK.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:bD}}initInteraction(){const t=[];this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new dK(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]}}pK.type=oB.link,pK.mark=aF;class gK extends _Y{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()?kD:LD],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()?MD: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):TB;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?te(r):wB,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=GF(this.angleAxisHelper.dataToPosition([t[kD]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=GF(this.angleAxisHelper.dataToPosition([t[MD]]),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(gK.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 Xg(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[Tg({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 vK=()=>{hz.registerAnimation("circularProgress",((t,e)=>({appear:fK(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class _K extends _G{constructor(){super(...arguments),this._supportStack=!0}}class yK extends gK{constructor(){super(...arguments),this.type=oB.circularProgress,this.transformerConstructor=_K,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(yK.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(yK.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()?kD:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?MD: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(dG(null===(i=hz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),uG("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(dG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),uG("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}yK.type=oB.circularProgress,yK.mark=rF,yK.transformerConstructor=_K;function bK(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const xK=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:bK(t)}),SK={type:"fadeIn"};function AK(t,e){return!1===e?{}:"fadeIn"===e?SK:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:bK(t)}))(t)}class kK extends oN{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 MK extends SG{constructor(){super(...arguments),this.type=oB.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(MK.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 GF(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 GF(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 GF(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 GF(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(MK.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 GF(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 GF(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(MK.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=GF(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(Tg({x:i,y:0,height:r,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=GF(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(Tg({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(dG(null===(i=hz.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),uG("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(dG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),uG("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new kK(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}MK.type=oB.linearProgress,MK.mark=dF;const TK=()=>{CW(),hz.registerAnimation("linearProgress",((t,e)=>({appear:AK(t,e),enter:{type:"grow"},disappear:xK(t)}))),$H(),hz.registerSeries(MK.type,MK)},wK=[0],CK=[20,40],EK=[200,500],PK={shrink:!1,enlarge:!1,fontSizeLimitMin:0},BK=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],RK=`${hB}_WORD_CLOUD_WEIGHT`,LK=`${hB}_WORD_CLOUD_TEXT`;class OK extends yG{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=CK}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:EK,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:wK,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)?LK:this._nameField,this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:PK},this._spec.wordCloudConfig),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:wK,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=!BK.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(OK.mark.word,{key:yD,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(dG(hz.getAnimationInKey("wordCloud")(n,s),uG("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 HF).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:bD])}}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 TC,o=this._fontWeightRange;if(r){const[e,i]=pb(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:RK,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:LK,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:Qy(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[r,a],shape:this._maskShape,dataIndexKey:yD,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:RK}: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:yD,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:RK}: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)}}OK.mark=lF;function IK(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)||UH.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 FK(){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 jK(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 zK=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function HK(t){return d(t)?t:function(){return t}}class VK{constructor(t){var e,i,s;switch(this.options=z({},VK.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=(s=this.options.shape,DK[s]?DK[s]():DK.circle()),this.getText=null!==(e=HK(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=HK(this.options.fontWeight),this.getTextFontSize=HK(this.options.fontSize),this.getTextFontStyle=HK(this.options.fontStyle),this.getTextFontFamily=HK(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>zK(10,50);break;case"random-light":this.getTextColor=()=>zK(50,90);break;default:this.getTextColor=HK(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 GK extends VK{constructor(t){var e;super(z({},GK.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<=GK.defaultOptions.minFontSize&&(this.options.minFontSize=GK.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=NK[this.options.spiral])&&void 0!==e?e:NK.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=HK(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}=jK(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(P_.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(KK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(YK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}KK(p,this._size)&&(p=XK(p,this._size))}else if(KK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||UK(p,i))&&(!i||!WK(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 WK(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 UK(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,KK=(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 XK(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}=jK(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)}qK.defaultOptions={enlarge:!1};const JK={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},QK=(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?tX(t.fontFamily):"sans-serif",d=t.fontStyle?tX(t.fontStyle):"normal",u=t.fontWeight?tX(t.fontWeight):"normal",p=t.rotate?tX(t.rotate):0,g=tX(t.text),m=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",f=t.padding?tX(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||JK,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?tX(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=iX(sX(t,l),C);w=i=>e(t(i))}let E=GK;"fast"===t.layoutType?E=qK:"grid"===t.layoutType&&(E=$K);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()},tX=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],eX=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),iX=(t,e)=>{if(t[0]===t[1])return t=>e[0];const i=eX(t[0]),s=eX(t[1]),n=Math.min(i,s),r=Math.max(i,s);return t=>(eX(t)-n)/(r-n)*(e[1]-e[0])+e[0]},sX=(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 nX(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{kR.registerTransform("wordcloud",{transform:QK,markPhase:"beforeJoin"},!0),rY(),hz.registerAnimation("wordCloud",((t,e)=>({appear:IK(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),hz.registerSeries(rX.type,rX)};(class extends OK{constructor(){super(...arguments),this.type=oB.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(OK.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(dG(null===(e=hz.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}})),uG("word",this._spec,this._markAttributeContext)))}}).type=oB.wordCloud3d;const oX=(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},lX=(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},hX=`${hB}_FUNNEL_TRANSFORM_RATIO`,cX=`${hB}_FUNNEL_REACH_RATIO`,dX=`${hB}_FUNNEL_HEIGHT_RATIO`,uX=`${hB}_FUNNEL_VALUE_RATIO`,pX=`${hB}_FUNNEL_LAST_VALUE_RATIO`,gX=`${hB}_FUNNEL_NEXT_VALUE_RATIO`,mX=`${hB}_FUNNEL_LAST_VALUE`,fX=`${hB}_FUNNEL_CURRENT_VALUE`,vX=`${hB}_FUNNEL_NEXT_VALUE`,_X=`${hB}_FUNNEL_TRANSFORM_LEVEL`,yX=20;class bX extends oN{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[cX])).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 xX extends zH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class SX extends xX{constructor(){super(...arguments),this.type=SX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}SX.type="polygon";const AX=()=>{hz.registerMark(SX.type,SX),fM(),cM(),kR.registerGraphic(RB.polygon,Zg),uO.useRegisters([UI,YI])};class kX extends _G{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class MX extends yG{constructor(){super(...arguments),this.type=oB.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=kX,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;Dz(this._dataSet,"funnel",oX),Dz(this._dataSet,"funnelTransform",lX);const t=new ya(this._dataSet,{name:`${hB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new iG(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:fX,asTransformRatio:hX,asReachRatio:cX,asHeightRatio:dX,asValueRatio:uX,asNextValueRatio:gX,asLastValueRatio:pX,asLastValue:mX,asNextValue:vX,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:_X}})}initMark(){var t,e,i,s,n,r,a,o,l,h,c,d;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},MX.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,morph:mG(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({},MX.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(MX.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(MX.mark.outerLabelLine,{themeSpec:e,markSpec:t,depend:[this._funnelOuterLabelMark.label],noSeparateStyle:!0})}}initTooltip(){this._tooltipHelper=new bX(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*aB(cX).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(dG(null===(s=hz.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),uG("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(dG(hz.getAnimationInKey("fadeInOut")(),uG(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(dG(hz.getAnimationInKey("funnel")({},o),uG(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(dG(null===(a=hz.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),uG("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[pX])/2:this._getSecondaryAxisLength(t[uX])/2,n=this._getSecondaryAxisLength(t[uX])/2):(s=this._getSecondaryAxisLength(t[uX])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[gX])/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[_X])}_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[yD]===t[yD]));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?yX: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{AX(),rY(),OU(),hz.registerSeries(MX.type,MX),hz.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},KH))),hz.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Gc,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Gc,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),$H()};class wX extends xX{constructor(){super(...arguments),this.type=wX.type}}wX.type="pyramid3d";class CX extends kX{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class EX extends MX{constructor(){super(...arguments),this.type=oB.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=CX}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},EX.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({},EX.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(EX.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(EX.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())}}EX.type=oB.funnel3d,EX.mark=cF,EX.transformerConstructor=CX;const PX=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},BX=t=>{const e=t.mark.elements.filter((t=>t.diffState===BB.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}))},RX=(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]},LX=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=BX(i),a=RX(r,s,n);return PX(e.startAngle,a)*(n-s)+s},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=BX(i),a=RX(r,s,n);return PX(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}}}),OX=t=>{const e=$(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),i=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[e,i]},IX=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=BX(i),a=OX(r);return PX(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=BX(i),a=OX(r);return PX(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}}}),DX=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},FX=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):FX(t.children,e,i)))})),e};function jX(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=VX(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}},NX=(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=NX(t.children,e,t,n))})),s},GX=(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=GX(t.children,e,t,n)),n=e(t,s,i,n)})),n},WX={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:jX,slice:zX,sliceDice:function(t,e,i,s,n){(t.depth%2==1?zX:jX)(t,e,i,s,n)}};class UX{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({},UX.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?cb(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?HX(this.options.aspectRatio):null!==(e=WX[this.options.splitType])&&void 0!==e?e:WX.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=VX(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)}))}}UX.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const YX=(t,e)=>{const i=new UX(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 FX(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},KX={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class XX{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];jX(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),KX);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({},XX.defaultOpionts,t):Object.assign({},XX.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?cb(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+mb(this.options.center[0],t.width),s=t.y0+mb(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=>mb(t,n))):mb(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>mb(t,n))):mb(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=mb(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=VX(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)}}}XX.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const $X=4294967296;function qX(t,e){let i,s;if(QX(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function QX(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 s$(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 n$(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 r$(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 a$(t){return{_:t,next:null,prev:null}}function o$(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];s$(n,s,r);let a,o,l,h,c,d,u,p=a$(s),g=a$(n),m=a$(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=VX(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)%$X)/$X}(),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:d$.defaultOpionts.nodeSort;NX([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)NX([o],l$(h)),GX([o],h$(this._getPadding,.5,a)),NX([o],c$(1,this._maxDepth));else{const t=Math.min(s.width,s.height);NX([o],l$(d$.defaultOpionts.setRadius)),GX([o],h$(ub,1,a)),c&&GX([o],h$(this._getPadding,o.radius/t,a)),NX([o],c$(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}d$.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const u$=(t,e={})=>{if(!t)return[];const i=[];return FX(t,i,e),i},p$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new XX(i).layout(t,{width:s,height:n})};class g$ extends oN{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var m$;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(m$||(m$={}));const f$=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===m$.DrillDown){return Y(sz(t,n,s,"children"))}if(i.type===m$.DrillUp){const e=nz(t,n,s,"children");if(e)return Y(e)}return t};class v${_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=vU(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;Dz(t,"drillFilter",f$),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:m$.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:m$.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:m$.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:m$.DrillUp},model:this}),r}}class _$ extends _Y{constructor(){super(...arguments),this.type=oB.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:nG),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:yD},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),Dz(this._dataSet,"sunburstLayout",p$),Dz(this._dataSet,"flatten",u$),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:sG,operations:["max","min","values"]},{key:nG,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(Dz(t.dataSet,"addVChartProperty",ZN),t.transform({type:"addVChartProperty",options:{beforeCall:lG.bind(this),call:hG}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t,e;if(!1===this._sunburst.visible)return;const i=this._createMark(_$.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()},Jz.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(_$.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},Jz.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new g$(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(dG(null===(e=hz.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),uG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(dG(null===(e=hz.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),uG(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]}}_$.type=oB.sunburst,_$.mark=_F,U(_$,v$);const y$=()=>{hz.registerSeries(_$.type,_$),EY(),rY(),$H(),hz.registerAnimation("sunburst",((t,e)=>({appear:DX(0,e),enter:LX(t),exit:IX(t),disappear:IX(t)})))},b$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new d$(i).layout(t,{width:s,height:n})};class x$ extends oN{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const S$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"};class A$ extends SG{constructor(){super(...arguments),this.type=oB.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:nG),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:yD},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),Dz(this._dataSet,"circlePackingLayout",b$),Dz(this._dataSet,"flatten",u$),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)||(Dz(t.dataSet,"addVChartProperty",ZN),t.transform({type:"addVChartProperty",options:{beforeCall:lG.bind(this),call:hG}}))}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(A$.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},Jz.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(A$.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"},Jz.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:sG,operations:["max","min","values"]},{key:nG,operations:["values"]}])}initTooltip(){this._tooltipHelper=new x$(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(dG(null===(i=hz.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),uG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(dG(null===(e=hz.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),uG(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]}}A$.type=oB.circlePacking,A$.mark=xF,U(A$,v$);const k$=()=>{hz.registerSeries(A$.type,A$),EY(),rY(),XH(),hz.registerAnimation("circlePacking",((t,e)=>({appear:S$(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},M$=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=M$(t.children):t.value=0),e+=Math.abs(t.value)})),e};function T$(t){return t.depth}function w$(t,e){return e-1-t.endDepth}const C$=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),E$=(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},P$={left:T$,right:w$,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:T$,end:w$},B$=yt(0,1);class R${constructor(t){this._ascendingSourceBreadth=(t,e)=>C$(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>C$(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},R$.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?cb(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):P$[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)};bb(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))),bb(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=[];M$(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}`;if(n[r])return n[r].value+=wt(t.value),void n[r].datum.push(t);const a={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[t],value:t.value,parents:t.parents.map((t=>t.key))};i.push(a),s[t.source].sourceLinks.push(a),s[t.target].targetLinks.push(a),n[r]=a})),{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=[E$(s[t.source]),E$(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=Math.min(n>0?Math.max(this.options.nodeGap,n):this.options.nodeGap,this._viewBox.height/e);a=()=>i,this._gapY=i,this.options.equalNodeHeight?o=this._viewBox.height/e-i:r=t.reduce(((t,e)=>{const s=e.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-(e.length-1)*i)/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,n,0),p=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.max(e.value?i*B$(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&&(o/=i.length-1,n+o>0)){n+=o,this._gapY=Math.min(n);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(C$),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(C$),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 R$(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]:[]},O$=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&O$(t,e.children,i)}))},I$=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},D$=(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 R$(e),r=[];return r.push(n.layout(s,i)),r},F$=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:[]},j$=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 z$ extends oN{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 H$=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),V$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:H$(t),N$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class G$ extends zH{constructor(){super(...arguments),this.type=G$.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}}G$.type="linkPath";const W$=()=>{kR.registerGlyph("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(BO).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),kR.registerAnimationType("linkPathGrowIn",RO),kR.registerAnimationType("linkPathGrowOut",LO),kR.registerAnimationType("linkPathUpdate",OO),_O(),pO(),hz.registerMark(G$.type,G$)};class U$ extends SG{constructor(){super(...arguments),this.type=oB.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=[Jz.STATE_SANKEY_EMPHASIS,Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:s})}else n.target===e.key?i.includes(n.source)||i.push(n.source):(t.removeState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState(Jz.STATE_SANKEY_EMPHASIS),e.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS)):(t.removeState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(Jz.STATE_SANKEY_EMPHASIS),void s.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(Jz.STATE_SANKEY_EMPHASIS),void s.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:h.value/r.value});s.removeState(Jz.STATE_SANKEY_EMPHASIS),s.addState(Jz.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=[Jz.STATE_SANKEY_EMPHASIS,Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS),void t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS),void t.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:o.value/i.value});t.removeState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.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){Dz(this._dataSet,"sankeyLayout",D$),Dz(this._dataSet,"sankeyFormat",I$),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:Xz.sankeyLayout});const{dataSet:a}=this._option;Dz(a,"sankeyNodes",F$),Dz(a,"flatten",u$);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:aG.bind(this),call:oG}},!1),this._nodesSeriesData=new iG(this._option,o),Dz(a,"sankeyLinks",j$);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:aG.bind(this),call:oG}},!1),this._linksSeriesData=new iG(this._option,l)}}initMark(){var t,e,i,s;const n=this._createMark(U$.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(U$.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(U$.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},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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(dG(null===(i=hz.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(r,a),uG("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(dG(null===(s=hz.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(r,a),uG("link",this._spec,this._markAttributeContext))),this._labelMark&&this._labelMark.setAnimationConfig(dG(null===(n=hz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),uG("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([Jz.STATE_SANKEY_EMPHASIS_REVERSE,Jz.STATE_SANKEY_EMPHASIS]),e.includes(t.getDatum().key)||t.addState(Jz.STATE_SANKEY_EMPHASIS_REVERSE)}))}initTooltip(){this._tooltipHelper=new z$(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 HF;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 O$(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]}}U$.type=oB.sankey,U$.mark=mF;const Y$=()=>{kR.registerTransform("sankey",{transform:L$,markPhase:"beforeJoin"},!0),CW(),W$(),rY(),hz.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:V$(t,e)},KH))),hz.registerAnimation("sankeyLinkPath",((t,e)=>({appear:N$(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),$H(),hz.registerSeries(U$.type,U$)},K$=(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=u$(n);return i=QN([{latestData:r}],e),i};class X$ extends oN{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}get defaultShapeType(){return"square"}}const $$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class q$ extends _G{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}class Z$ extends SG{constructor(){super(...arguments),this.type=oB.treemap,this.transformerConstructor=q$,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:nG),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:yD},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&&[nG,"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)&&(Dz(this._rawData.dataSet,"addVChartProperty",ZN),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:lG.bind(this),call:hG}}))}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){Dz(this._dataSet,"hierarchyDimensionStatistics",K$),Dz(this._dataSet,"flatten",u$);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:sG,operations:["max","min","values"]},{key:nG,operations:["values"]}])}initMark(){var t,e,i,s;const n=this._createMark(Z$.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(Z$.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()},Jz.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()},Jz.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},Jz.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},Jz.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},Jz.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},Jz.STATE_NORMAL,t.AttributeLevel.Series))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(dG(null===(e=hz.getAnimationInKey("treemap"))||void 0===e?void 0:e(),uG(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 X$(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]}}Z$.type=oB.treemap,Z$.mark=gF,Z$.transformerConstructor=q$,U(Z$,v$),U(Z$,yU);const J$=()=>{CW(),rY(),hz.registerAnimation("treemap",((t,e)=>({appear:$$(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),$H(),kR.registerTransform("treemap",{transform:YX,markPhase:"beforeJoin"},!0),hz.registerSeries(Z$.type,Z$)},Q$={type:"fadeIn"};function tq(t,e){return"fadeIn"===e?Q$:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class eq extends _G{constructor(){super(...arguments),this._supportStack=!1}}class iq extends gK{constructor(){super(...arguments),this.type=oB.gaugePointer,this.transformerConstructor=eq,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(iq.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},iq.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(iq.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(dG(null===(i=hz.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),uG("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}iq.type=oB.gaugePointer,iq.mark=vF,iq.transformerConstructor=eq;const sq=()=>{hz.registerSeries(iq.type,iq),pU(),CW(),hz.registerAnimation("gaugePointer",((t,e)=>{const i=tq(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),qY(),XY()};class nq extends _G{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class rq extends gK{constructor(){super(...arguments),this.type=oB.gauge,this.transformerConstructor=nq,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();Dz(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[OD]=t[this._angleField[0]],t[LD]=e>0?i[e-1][OD]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(rq.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(rq.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[LD])?this.angleAxisHelper.dataToPosition([t[LD]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[OD]])}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(dG(null===(i=hz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),uG("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}rq.type=oB.gauge,rq.mark=fF,rq.transformerConstructor=nq;class aq extends EG{constructor(){super(...arguments),this.type=aq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}aq.type="cell";const oq=()=>{hz.registerMark(aq.type,aq),fM(),_M(),kR.registerGraphic(RB.cell,bg),kR.registerMark(RB.cell,lD)};function lq(t){return!1===t?{}:{type:"fadeIn"}}class hq extends oN{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return p(i)&&"dimension"===t&&(i.visible=!1),i}}class cq extends _G{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class dq extends SG{constructor(){super(...arguments),this.type=oB.heatmap,this.transformerConstructor=cq}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(dq.mark.cell,{morph:mG(this._spec,dq.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(dq.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=xG(this);this._cellMark.setAnimationConfig(dG(null===(i=hz.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),uG("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 hq(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]}}dq.type=oB.heatmap,dq.mark=SF,dq.transformerConstructor=cq;const uq=()=>{rY(),oq(),hz.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},KH),{appear:lq(e)}))),QG(),qG(),hz.registerSeries(dq.type,dq)},pq=(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=mb(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=mb(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+mb(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+mb(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=cb(e.field),C=t.map(w),[E,P]=pb(C),B=E===P?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(P-E),R=u(e.radiusField)?w:cb(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?pb(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=gq(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),mq({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},mq=(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,[_D]:null==n?void 0:n[_D],[bD]:null==n?void 0:n[bD]}};class vq extends zH{constructor(){super(...arguments),this.type=vq.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}}vq.type="ripple";const _q=()=>{hz.registerMark(vq.type,vq),kR.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}}))),_O(),fO()},yq=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class bq extends _G{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class xq extends _Y{constructor(){super(...arguments),this.type=oB.correlation,this.transformerConstructor=bq,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;Dz(this._dataSet,"correlation",pq);const s=new va;Fz(s,"dataview",ga),Dz(s,"correlationCenter",fq);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 iG(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(xq.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:_D,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(xq.mark.ripplePoint,{key:_D,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});a&&(this._ripplePointMark=a);const o=this._createMark(xq.mark.centerPoint,{key:_D,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[gD],y:t=>t[mD],size:t=>t[fD],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},Jz.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},Jz.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},Jz.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)},Jz.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(dG(null===(e=hz.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),uG("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()}}xq.type=oB.correlation,xq.mark=AF,xq.transformerConstructor=bq;const Sq=()=>{BG(),_q(),hz.registerSeries(xq.type,xq),hz.registerAnimation("correlation",((t,e)=>Object.assign({appear:yq(0,e)},YH)))};class Aq extends zH{constructor(){super(...arguments),this.type=Aq.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}}Aq.type="liquid";const kq=(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/2):t;class Mq extends oN{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 Tq extends yG{constructor(){super(...arguments),this.type=oB.liquid,this.transformerConstructor=RG,this._liquidBackgroundMark=null,this._liquidOutlineMark=null}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){super.setAttrFromSpec(),this._marginSpec=$F(this._spec.outlineMargin),this._paddingSpec=$F(this._spec.outlinePadding),this.setValueField(this._spec.valueField)}rawDataUpdate(t){super.rawDataUpdate(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(Tq.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(Tq.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidMark=this._createMark(Tq.mark.liquid,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_getPosAndSizeFormRegion(t=!1){const{top:e=0,bottom:i=0,left:s=0,right:n=0}=this._marginSpec,{top:r=0,bottom:a=0,left:o=0,right:l=0}=this._paddingSpec,{width:h,height:c}=this._region.getLayoutRect();return t?{x:h/2+(s-n)/2,y:c/2+(e-i)/2,size:Math.min(h-(s+n),c-(e+i))}:{x:h/2+(s+l-(n+l))/2,y:c/2+(e+r-(i+a))/2,size:Math.min(h-(s+n+o+l),c-(e+i+r+a))}}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),x:()=>this._getPosAndSizeFormRegion(!0).x,y:()=>this._getPosAndSizeFormRegion(!0).y,size:()=>this._getPosAndSizeFormRegion(!0).size,symbolType:()=>{var t;return kq(null!==(t=this._spec.maskShape)&&void 0!==t?t:"circle",this._getPosAndSizeFormRegion(!0).size)}},"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:()=>{var t;const{x:e,y:i,size:s}=this._getPosAndSizeFormRegion();return[bg({x:e,y:i,size:s,symbolType:kq(null!==(t=this._spec.maskShape)&&void 0!==t?t:"circle",s),fill:!0})]}},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setInteractive(!1)}_initLiquidMarkStyle(){const e=this._liquidMark;e&&this.setMarkStyle(e,{dx:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,y:()=>{const{y:t,size:e}=this._getPosAndSizeFormRegion();return t-e/2+e-e*this._heightRatio},height:()=>{const{size:t}=this._getPosAndSizeFormRegion();return t*this._heightRatio},fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new Mq(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}initInteraction(){this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i;const s={y:{from:()=>{const{y:t,size:e}=this._getPosAndSizeFormRegion();return t-e/2+e},to:()=>{const{y:t,size:e}=this._getPosAndSizeFormRegion();return t-e/2+e-e*this._heightRatio}},height:{from:0,to:()=>{const{size:t}=this._getPosAndSizeFormRegion();return t*this._heightRatio}}},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(dG(null===(i=hz.getAnimationInKey("liquid"))||void 0===i?void 0:i(s,n),uG("liquid",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=DM(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]}}Tq.type=oB.liquid,Tq.mark=MF,Tq.transformerConstructor=RG;const wq=t=>Y(t).join(",");class Cq extends oN{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>wq(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>wq(null==t?void 0:t[this.series.getDimensionField()[0]])}}class Eq extends _G{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}class Pq extends yG{constructor(){super(...arguments),this.type=oB.venn,this.transformerConstructor=Eq,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:yD)}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(Pq.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(Pq.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()},Jz.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},Jz.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},Jz.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=>wq(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)}},Jz.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=>wq(t.sets)},Jz.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new Cq(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:wq(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return wq(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[wq(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(wq(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(dG(null===(e=hz.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),uG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(dG(null===(e=hz.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),uG(t.name,this._spec,this._markAttributeContext)))}))}}Pq.type=oB.venn,Pq.mark=TF,Pq.transformerConstructor=Eq;class Bq extends hW{_isValidSeries(t){return t===oB.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 Rq extends oW{constructor(){super(...arguments),this.transformerConstructor=Bq,this.type="map",this.seriesType=oB.map}}Rq.type="map",Rq.seriesType=oB.map,Rq.transformerConstructor=Bq;class Lq extends hW{_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 Oq extends Lq{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=PV(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,Tj({},s,l)),n&&Object.assign(o,Tj({},n,o))}}class Iq extends Lq{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 Dq extends Lq{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 Fq extends oW{constructor(){super(...arguments),this.transformerConstructor=Dq}}Fq.transformerConstructor=Dq;class jq extends Fq{constructor(){super(...arguments),this.transformerConstructor=Dq,this.type="pie",this.seriesType=oB.pie}}jq.type="pie",jq.seriesType=oB.pie,jq.transformerConstructor=Dq;class zq extends Dq{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class Hq extends Fq{constructor(){super(...arguments),this.transformerConstructor=zq,this.type="pie3d",this.seriesType=oB.pie3d}}Hq.type="pie3d",Hq.seriesType=oB.pie3d,Hq.transformerConstructor=zq;class Vq extends Iq{_getDefaultSeriesSpec(t){var e,i,s;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:EB,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:EB,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=>Tj({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}class Nq extends oW{constructor(){super(...arguments),this.transformerConstructor=Vq,this.type="rose",this.seriesType=oB.rose,this._canStack=!0}}Nq.type="rose",Nq.seriesType=oB.rose,Nq.transformerConstructor=Vq;class Gq extends Iq{_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:Tj({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=>Tj({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class Wq extends oW{constructor(){super(...arguments),this.transformerConstructor=Gq,this.type="radar",this.seriesType=oB.radar,this._canStack=!0}}Wq.type="radar",Wq.seriesType=oB.radar,Wq.transformerConstructor=Gq;class Uq extends hW{_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")&&Tj(e,aH(this.type,t))})),this._transformAxisSpec(t)}}class Yq extends oW{constructor(){super(...arguments),this.transformerConstructor=Uq,this.type="common",this._canStack=!0}}Yq.type="common",Yq.transformerConstructor=Uq;class Kq extends cW{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 Xq extends oW{constructor(){super(...arguments),this.transformerConstructor=Kq,this._canStack=!0}}Xq.transformerConstructor=Kq;class $q extends Kq{transformSpec(t){super.transformSpec(t),sH(t)}}class qq extends Xq{constructor(){super(...arguments),this.transformerConstructor=$q,this.type="histogram",this.seriesType=oB.bar}}qq.type="histogram",qq.seriesType=oB.bar,qq.transformerConstructor=$q;class Zq extends Xq{constructor(){super(...arguments),this.transformerConstructor=$q,this.type="histogram3d",this.seriesType=oB.bar3d}}Zq.type="histogram3d",Zq.seriesType=oB.bar3d,Zq.transformerConstructor=$q;class Jq extends Oq{_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 Qq extends oW{constructor(){super(...arguments),this.transformerConstructor=Jq,this.type="circularProgress",this.seriesType=oB.circularProgress,this._canStack=!0}}Qq.type="circularProgress",Qq.seriesType=oB.circularProgress,Qq.transformerConstructor=Jq;class tZ extends Oq{_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:oB.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===oB.gauge||t.type===oB.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===oB.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 eZ extends oW{constructor(){super(...arguments),this.transformerConstructor=tZ,this.type="gauge",this.seriesType=oB.gaugePointer}}eZ.type="gauge",eZ.seriesType=oB.gaugePointer,eZ.transformerConstructor=tZ;class iZ extends hW{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class sZ extends oW{constructor(){super(...arguments),this.transformerConstructor=iZ,this.type="wordCloud",this.seriesType=oB.wordCloud}}sZ.transformerConstructor=iZ;class nZ extends iZ{_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 rZ extends sZ{constructor(){super(...arguments),this.transformerConstructor=nZ,this.type="wordCloud",this.seriesType=oB.wordCloud}}rZ.type="wordCloud",rZ.seriesType=oB.wordCloud,rZ.transformerConstructor=nZ;class aZ extends iZ{_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 oZ extends sZ{constructor(){super(...arguments),this.transformerConstructor=aZ,this.type="wordCloud3d",this.seriesType=oB.wordCloud3d}}oZ.type="wordCloud3d",oZ.seriesType=oB.wordCloud3d,oZ.transformerConstructor=aZ;class lZ extends hW{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 hZ extends oW{constructor(){super(...arguments),this.transformerConstructor=lZ,this.type="funnel",this.seriesType=oB.funnel}}hZ.type="funnel",hZ.seriesType=oB.funnel,hZ.transformerConstructor=lZ;class cZ extends oW{constructor(){super(...arguments),this.transformerConstructor=lZ,this.type="funnel3d",this.seriesType=oB.funnel3d}}cZ.type="funnel3d",cZ.seriesType=oB.funnel3d,cZ.transformerConstructor=lZ;class dZ extends cW{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=PV(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=PV(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class uZ extends oW{constructor(){super(...arguments),this.transformerConstructor=dZ,this.type="linearProgress",this.seriesType=oB.linearProgress,this._canStack=!0}}uZ.type="linearProgress",uZ.seriesType=oB.linearProgress,uZ.transformerConstructor=dZ;class pZ extends cW{_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),sH(t)}}class gZ extends oW{constructor(){super(...arguments),this.transformerConstructor=pZ,this.type="rangeColumn",this.seriesType=oB.rangeColumn}}gZ.type="rangeColumn",gZ.seriesType=oB.rangeColumn,gZ.transformerConstructor=pZ;class mZ extends cW{_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 fZ extends oW{constructor(){super(...arguments),this.transformerConstructor=mZ,this.type="rangeColumn3d",this.seriesType=oB.rangeColumn3d}}fZ.type="rangeColumn3d",fZ.seriesType=oB.rangeColumn3d,fZ.transformerConstructor=mZ;class vZ extends hW{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:CB,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=oB.sunburst;return s.type=n,s[n]=t[n],s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class _Z extends oW{constructor(){super(...arguments),this.transformerConstructor=vZ,this.type="sunburst",this.seriesType=oB.sunburst}}_Z.type="sunburst",_Z.seriesType=oB.sunburst,_Z.transformerConstructor=vZ;class yZ extends hW{_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=oB.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class bZ extends oW{constructor(){super(...arguments),this.transformerConstructor=yZ,this.type="circlePacking",this.seriesType=oB.circlePacking}}bZ.type="circlePacking",bZ.seriesType=oB.circlePacking,bZ.transformerConstructor=yZ;class xZ extends hW{_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 SZ extends oW{constructor(){super(...arguments),this.transformerConstructor=xZ,this.type="treemap",this.seriesType=oB.treemap}}SZ.type="treemap",SZ.seriesType=oB.treemap,SZ.transformerConstructor=xZ;class AZ extends OW{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),sH(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}class kZ extends IW{constructor(){super(...arguments),this.transformerConstructor=AZ,this.type="waterfall",this.seriesType=oB.waterfall}}kZ.type="waterfall",kZ.seriesType=oB.waterfall,kZ.transformerConstructor=AZ;class MZ extends cW{_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"}]),sH(t)}}class TZ extends oW{constructor(){super(...arguments),this.transformerConstructor=MZ,this.type="boxPlot",this.seriesType=oB.boxPlot}}TZ.type="boxPlot",TZ.seriesType=oB.boxPlot,TZ.transformerConstructor=MZ;class wZ extends hW{_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 CZ extends oW{constructor(){super(...arguments),this.transformerConstructor=wZ,this.type="sankey",this.seriesType=oB.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)}))}}CZ.type="sankey",CZ.seriesType=oB.sankey,CZ.transformerConstructor=wZ;class EZ extends cW{_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),sH(t)}}class PZ extends oW{constructor(){super(...arguments),this.transformerConstructor=EZ,this.type="rangeArea",this.seriesType=oB.rangeArea}}PZ.type="rangeArea",PZ.seriesType=oB.rangeArea,PZ.transformerConstructor=EZ;class BZ extends cW{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}class RZ extends oW{constructor(){super(...arguments),this.transformerConstructor=BZ,this.type="heatmap",this.seriesType=oB.heatmap}}RZ.type="heatmap",RZ.seriesType=oB.heatmap,RZ.transformerConstructor=BZ;class LZ extends hW{_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=oB.correlation;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class OZ extends oW{constructor(){super(...arguments),this.transformerConstructor=LZ,this.type="correlation",this.seriesType=oB.correlation}}OZ.type="correlation",OZ.seriesType=oB.correlation,OZ.transformerConstructor=LZ;function IZ(t){var e,i;const s=Object.assign({},t);return B(t.style)||(s.textStyle=lz(t.style)),B(t.textStyle)||Tj(s.textStyle,lz(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&lz(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&lz(s.background.style),s}const DZ=(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},FZ=(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:bD;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 jZ extends FG{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:()=>{sB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),sB(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=UF(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 DH(this._option,e),this._initSelectedData(),sB(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)||(sB(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(Tj({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(Tj({},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(Tj({},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}}jZ.specKey="legends";class zZ extends jZ{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),sB(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:Xz.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){Dz(this._option.dataSet,"discreteLegendFilter",FZ),Dz(this._option.dataSet,"discreteLegendDataMake",DZ);const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return sB(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(!rb(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=qj(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=IZ(s)),B(n.focusIconStyle)||lz(n.focusIconStyle),n.shape&&(n.shape=az(n.shape)),n.label&&(n.label=az(n.label)),n.value&&(n.value=az(n.value)),n.background&&(n.background=az(n.background)),YF(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),YF(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),YF(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)||lz(r.railStyle),B(r.sliderStyle)||lz(r.sliderStyle)):(B(r.textStyle)||lz(r.textStyle),r.handler&&az(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(Tj(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 uP}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(rP.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(rP.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(rP.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}=wV(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=wV(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}zZ.specKey="legends",zZ.type=r.discreteLegend;const HZ=(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[]},VZ=(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)?rz(t,+e,+i):t.filter((t=>t[o]>=e&&t[o]<=i))}return t};function NZ(t){return"color"===t||"size"===t}const GZ={color:vP,size:yP},WZ=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],UZ=[2,10];class YZ extends jZ{static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!y(e))return NZ(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)=>{NZ(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),sB(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData},level:Xz.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(){Dz(this._option.dataSet,"continuousLegendFilter",VZ),Dz(this._option.dataSet,"continuousLegendDataMake",HZ);const t=new ya(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>nB(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=qj(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!rb(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=qj(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?WZ:UZ);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=Tj({},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=IZ(s)),w.showHandler=!1!==n.visible,B(n.style)||(w.handlerStyle=lz(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),B(r.style)||(w.railStyle=lz(r.style)),B(a.style)||(w.trackStyle=lz(a.style)),w.startText=az(o),w.endText=az(l),w.handlerText=az(h),B(c)||(w.sizeBackground=lz(c)),d.visible&&!B(d.style)&&(Tj(w,d.style),p(d.padding)&&(w.padding=d.padding)),w}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return GZ[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))}}}YZ.specKey="legends",YZ.type=r.continuousLegend;class KZ{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=Tz(n,a,!0))&&void 0!==e?e:[],...null!==(i=gz(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(!jw(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=nN(s).includes(t):p(e.visible)||p(e.activeType)?d.visible=nN(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)&&(pN(s).every((t=>{var e;return!nN(null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec).includes("dimension")}))?d.visible=!1:p(e.visible)||p(e.activeType)?d.visible=nN(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=dN(t,i,s),m=uN(t,i,s),f=Tj({},I(e[t]),m),v=g.title,_=mN(void 0,f,u.shape,void 0,v);p(f.title)?f.title=hN(f.title,Object.assign(Object.assign({},v),_)):f.title=hN(v,_,!0);const y=Y(g.content);if(p(f.content)){const t=gN(y);f.content=cN(f.content,(e=>mN(e,f,u.shape,t)))}else f.content=cN(y,(t=>mN(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=SN(a,t,e),l=!!p(o)&&!1!==vN(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 XZ extends KZ{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 $Z extends KZ{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 qZ extends KZ{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 ZZ=t=>p(t)&&!y(t),JZ=t=>p(t)&&y(t);class QZ extends DG{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:s}=super._initTheme(t,e);return i.style=Tj({},this._theme,i.style),{spec:i,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h,c,d;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=nN(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:eb(this._option.mode)||!Qy(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=null===(d=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===d?void 0:d.getElementById(t.parentElement)):Qy(this._option.mode)&&(t.parentElement=null==Jy?void 0:Jy.body)}}class tJ extends FG{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=QZ,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._getMouseOutHandler=t=>e=>{var i,s,n;if(this._alwaysShow)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=Qy(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(!t&&this._clickLock)return;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&&ZZ(this._cacheInfo)?a.mark=this._showTooltipByMouseEvent("mark",i,e,t,!0):r&&JZ(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),t&&this._clickLock&&(this._clickLock=!1))},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(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));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&sV.globalConfig.uniqueTooltip&&l&&sV.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._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?_N.canvas:_N.dom,n=hz.getComponentPluginInType(t);n||$y("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 $Z(this),dimension:new XZ(this),group:new qZ(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)),(tb(i)||eb(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)))}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=iN(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(JZ(t)){if(ZZ(this._cacheInfo))return!1;const e=this._cacheInfo;if(!(e.length===t.length&&t.every(((t,i)=>cz(t,e[i])))))return!1}else{if(JZ(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}}tJ.type=r.tooltip,tJ.transformerConstructor=QZ,tJ.specKey="tooltip";var eJ,iJ;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(eJ||(eJ={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(iJ||(iJ={}));const sJ={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class nJ extends FG{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=>{this._handleIn(t),this._clickLock=this._hasActive&&this._spec.lockAfterClick,this._clickLock&&S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._clickLock=!1,this._handleOutEvent()}),this.triggerOff))},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"}:tb(e)||eb(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=this.trigger||"hover",e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;if(y(t)){const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return[{click:"click"===t,in:i[t],out:e(t)}]}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)=>{sJ[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||t.yField)&&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){mz(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=>{jw(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[0],s=e.series.dataToPosition(e.datum[0]);(p(t.dimType)?"y"===t.dimType:fz(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=s.y:r=s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=e.x,a=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=rB(this._regions,"cartesian");if(!e)return;const{x:i,y:s,offsetWidth:n,offsetHeight:r,bandWidth:a,bandHeight:o}=zV(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=NV(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=GV(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 uT(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(n=new pT(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 QM(e)),null==s||s.add(t)),FV(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}rJ.specKey="crosshair",rJ.type=r.cartesianCrosshair;class aJ extends nJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return e.categoryField||e.valueField?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.polarCrosshair}]:void 0;const i=[];return e.forEach(((t,e)=>{(t.categoryField||t.valueField)&&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=>{jw(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=rB(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:"",Tj(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=EV(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=EV(s.getSpec())),c.angle=a.angle,c.axis=s,Tj(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}=wV(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}=wV(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 uT(Object.assign(Object.assign({},l),{lineStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===o&&(t=new mT(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 fT(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex+1})):new gT(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 QM(e),null==s||s.add(t),i(t)),FV(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair]}}aJ.specKey="crosshair",aJ.type=r.polarCrosshair;const oJ=(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)},lJ=(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 hJ extends FG{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 sB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),sB(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=_z(t),this._isHorizontal="horizontal"===yz(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=>!Dw(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(Dw(this._stateScale.type));this._stateScale.domain(e,!0),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={};sB(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=Dw(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 sB(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;Fz(s,"dataview",ga),Dz(s,"dataFilterComputeDomain",lJ);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 DH(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(Dw(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&&Dw(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,Dw(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=Dw(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 rC,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||(Dz(this._option.dataSet,"dataFilterWithNewDomain",oJ),sB(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:()=>Dw(this._stateScale.type)},level:Xz.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(Dw(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&&jw(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,jw(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(hJ,yU);class cJ extends DG{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=Tj({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 dJ extends hJ{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=cJ,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 TC;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(!Dw(t.type)||e[0]!==e[1])&&(!jw(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 rE(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:lz(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:lz(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:lz(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:lz(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:lz(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:lz(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:lz(g.style)},selectedBackgroundStyle:lz(this._spec.selectedBackground.style),dragMaskStyle:lz(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:Tj(lz(null===(l=m.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},lz(null===(h=m.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:Tj(lz(null===(c=f.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},lz(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}=wV(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()}}dJ.type=r.dataZoom,dJ.transformerConstructor=cJ,dJ.specKey="dataZoom";class uJ extends hJ{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 EM(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=$P(this._start,e)&&$P(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=lz(t.style)),B(null==e?void 0:e.style)||(s.sliderStyle=lz(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}uJ.type=r.scrollBar,uJ.specKey="scrollBar";const pJ=(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 gJ extends FG{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!==gJ.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(){Dz(this._option.dataSet,"indicatorFilter",pJ);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 DH(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=Tj({},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({},lz(e.style)),{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?ZF(this._spec.offsetX,this._computeLayoutRadius()):0,dy:this._spec.offsetY?ZF(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({},lz(this._spec.title.style)),{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 SP(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}}gJ.type=r.indicator,gJ.specKey="indicator";const mJ=["sum","average","min","max","variance","standardDeviation","median"];function fJ(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=X(s);return er}function vJ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&fJ(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=YF(t.x)?xJ(t.x,n)+r.x:l.getXAxisHelper().dataToPosition([t.x])+r.x,h}function _J(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&fJ(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=YF(t.y)?xJ(t.y,n)+r.y:l.getYAxisHelper().dataToPosition([t.y])+r.y,h}function yJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&fJ(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 bJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&fJ(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 xJ(t,e){return Number(t.substring(0,t.length-1))*e/100}function SJ(t){return mJ.includes(t)}function AJ(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=vJ(t,m,n,d,h,a),i=_J(t,f,n,d,c,a);u.push([{x:e,y:i}])}else if(e){const e=vJ(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=_J(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 kJ(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=yJ(t,l,n,r),i=bJ(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=yJ(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=bJ(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function MJ(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=YF(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=YF(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])&&fJ(_,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])&&fJ(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 TJ(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])&&fJ(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])&&fJ(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 wJ(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 YF(e)&&(e=xJ(e,r)),e+=s,YF(i)&&(i=xJ(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 YF(e)&&(e=xJ(e,s)),YF(i)&&(i=xJ(i,n)),{x:e,y:i}}))}function CJ(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 EJ(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},lz(r.style)):t.shape={visible:!1},!1!==s.visible?(t.panel=Object.assign({visible:!0},BJ(lz(s.style),i)),p(s.padding)&&(t.padding=ei(s.padding))):(t.panel={visible:!1},t.padding=0),n&&(t.textStyle=BJ(lz(n),i)),t}return{visible:!1}}function PJ(t,e){for(const i in t)d(t[i])&&(t[i]=t[i](e));return t}function BJ(t,e){return d(t)?t(e):t}function RJ(t,e){return d(t)?t(e):t}function LJ(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 OJ(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 IJ(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 DJ(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function FJ(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=>zJ(i,t,e))):s.x=zJ(i,t,e)}if(p(e.y)){const i=e.y;y(i)?s.y=i.map((i=>zJ(i,t,e))):s.y=zJ(i,t,e)}if(p(e.angle)){const i=e.angle;y(i)?s.angle=i.map((i=>zJ(i,t,e))):s.angle=zJ(i,t,e)}if(p(e.radius)){const i=e.radius;y(i)?s.radius=i.map((i=>zJ(i,t,e))):s.radius=zJ(i,t,e)}if(p(e.areaName)){const i=e.areaName;s.areaName=zJ(i,t,e)}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),i.push(s)})),i}const jJ={min:(t,e)=>qP(t[0].latestData,e.field),max:(t,e)=>ZP(t[0].latestData,e.field),sum:function(t,e){return JP(t[0].latestData,e.field)},average:function(t,e){return QP(t[0].latestData,e.field)},variance:function(t,e){return tB(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(tB(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 zJ(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 jJ[i](e,{field:s})}return t}class HJ extends FG{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)&&SJ(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])&&SJ(t[h])?i.x={field:h,aggrType:t[h]}:i.x=Y(h).map((e=>t[e])),_(t[c])&&SJ(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])&&SJ(t[o])?i.angle={field:o,aggrType:t[o]}:i.angle=Y(o).map((e=>t[e])),_(t[l])&&SJ(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=rB(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=KF(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=KF(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 VJ(t,e){return function(t,e,i){const{predict:s}=_b(t,(t=>t[e]),(t=>t[i])),n=qP(t,e),r=ZP(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 NJ(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 GJ extends HJ{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}=OJ(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:BJ(lz(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:EJ(y,this._markerData),state:{line:PJ(null!==(a=null===(r=this._spec.line)||void 0===r?void 0:r.state)&&void 0!==a?a:{},this._markerData),lineStartSymbol:PJ(null!==(l=null===(o=this._spec.startSymbol)||void 0===o?void 0:o.state)&&void 0!==l?l:{},this._markerData),lineEndSymbol:PJ(null!==(c=null===(h=this._spec.endSymbol)||void 0===h?void 0:h.state)&&void 0!==c?c:{},this._markerData),label:PJ(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:PJ(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:lz(b.style)}):S.startSymbol={visible:!1},x.visible?S.endSymbol=Object.assign(Object.assign({},x),{visible:!0,style:lz(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}=CJ([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}=OJ(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;Dz(this._option.dataSet,"markerAggregation",FJ),Dz(this._option.dataSet,"markerRegression",VJ),Dz(this._option.dataSet,"markerFilter",NJ);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}}GJ.specKey="markLine";class WJ extends GJ{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new UE(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:_}=OJ(e);let y=[];if(u||m||g||f||v||a&&l||a&&h){const t=AJ(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=MJ(i,r,d,e.coordinatesOffset):c&&(y=wJ(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(YF(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}=OJ(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}}}WJ.type=r.markLine,WJ.coordinateType="cartesian";class UJ extends GJ{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=OJ(this._spec);return e||i?new XE(t):new UE(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}=OJ(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=kJ(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=TJ(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}=OJ(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}}}UJ.type=r.polarMarkLine,UJ.coordinateType="polar";class YJ extends FG{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=UF(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 bP(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}}YJ.type=r.title,YJ.specKey=r.title;class KJ extends HJ{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=IJ(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:BJ(lz(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:EJ(u,this._markerData),state:{area:PJ(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData),label:PJ(null===(o=this._spec.label)||void 0===o?void 0:o.state,this._markerData),labelBackground:PJ(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}=CJ([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}=IJ(t);if(!(e||i||s||n||r||a||o))return null;const{options:l}=this._computeOptions(),h=this._getRelativeDataView();Dz(this._option.dataSet,"markerAggregation",FJ),Dz(this._option.dataSet,"markerFilter",NJ);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}}KJ.specKey="markArea";class XJ extends KJ{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new KE(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}=IJ(e),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t;let u=[],g=[];if(l){g=AJ(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=AJ(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[...t,e[1],e[0]])}else h?u=MJ(i,r,d,e.coordinatesOffset):c&&(u=wJ(e.positions,r,e.regionRelative));return{points:u}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=IJ(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}}}XJ.type=r.markArea,XJ.coordinateType="cartesian";class $J extends KJ{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=IJ(this._spec);return i||e||s?new $E(t):new KE(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}=IJ(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=kJ(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=TJ(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}=IJ(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}}}$J.type=r.polarMarkArea,$J.coordinateType="polar";const qJ=t=>lz(Object.assign({},t)),ZJ=t=>Object.assign(Object.assign({},t),{style:Object.assign({},lz(t.style))}),JJ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,m;const f=qJ(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=qJ(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:{},lz(Object.assign({},y)));var y;const b=ZJ(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=ZJ(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=ZJ(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=ZJ(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},QJ=t=>"left"===t||"right"===t,tQ=t=>"top"===t||"bottom"===t;class eQ extends FG{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({},JJ(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({},JJ(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 DP(t):this._playerComponent=new zP(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=QJ(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=QJ(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(PP.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(PP.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(PP.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(PP.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(PP.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(PP.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=QJ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=tQ(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)):QJ(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))):tQ(this._orient)?this._maxSize():t.height}_computeDx(t){return QJ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return tQ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}}eQ.specKey="player",eQ.type=r.player;class iQ extends FG{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)))}}iQ.type=r.label;class sQ extends nY{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}}sQ.type="text",sQ.constructorType="label";const nQ=()=>{hz.registerMark(sQ.constructorType,sQ),vO()};class rQ extends DG{_initTheme(t,e){return{spec:t,theme:this._theme}}}class aQ extends iQ{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=rQ,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),sB(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=Tj({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=zU[t])&&void 0!==i?i:zU.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}:HU(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}}aQ.type=r.label,aQ.specKey="label",aQ.transformerConstructor=rQ;class oQ extends iQ{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[PD]},"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 Tj({textStyle:{pickable:!0===this._spec.interactive},position:lQ(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[RD]))},a))}})).encode((e=>HU({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 lQ(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}oQ.type=r.totalLabel,oQ.specKey="totalLabel";class hQ extends HJ{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=DJ(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:RJ(E.offsetX,this._relativeSeries.getRegion()),offsetY:RJ(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:BJ(B.style,this._markerData)},state:{line:PJ(null!==(h=null===(l=this._spec.itemLine.line)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData),lineStartSymbol:PJ(null!==(d=null===(c=this._spec.itemLine.startSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData),lineEndSymbol:PJ(null!==(p=null===(u=this._spec.itemLine.endSymbol)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData),symbol:PJ(null!==(m=null===(g=this._spec.itemContent.symbol)||void 0===g?void 0:g.state)&&void 0!==m?m:{},this._markerData),image:PJ(null!==(v=null===(f=this._spec.itemContent.image)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData),text:PJ(null!==(y=null===(_=this._spec.itemContent.text)||void 0===_?void 0:_.state)&&void 0!==y?y:{},this._markerData),textBackground:PJ(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:PJ(null!==(A=null===(S=this._spec.itemContent.richText)||void 0===S?void 0:S.state)&&void 0!==A?A:{},this._markerData),customMark:PJ(null!==(M=null===(k=this._spec.itemContent.customMark)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData),targetItem:PJ(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=lz(BJ(L.style,this._markerData))),(null==O?void 0:O.style)&&(F.itemContent.imageStyle=BJ(O.style,this._markerData)),R&&(F.itemContent.textStyle=EJ(R,this._markerData)),(null==I?void 0:I.style)&&(F.itemContent.richTextStyle=BJ(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:lz(z.style)}):{visible:!1};return new ZE(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}=CJ([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:LJ(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:LJ(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}=DJ(t);if(!(p(t.coordinate)||e||i||s))return;Dz(this._option.dataSet,"markerAggregation",FJ),Dz(this._option.dataSet,"markerFilter",NJ);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}}hQ.specKey="markPoint";class cQ extends hQ{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=AJ(i,s,s,s,o)[0][0]:r?l=MJ(i,s,o,e.coordinatesOffset)[0]:a&&(l=wJ([e.position],s,e.regionRelative)[0]),{point:l}}_computeOptions(){const t=this._spec,{doXYProcess:e}=DJ(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}}}cQ.type=r.markPoint,cQ.coordinateType="cartesian";class dQ extends hQ{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=kJ(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}])]}}}dQ.type=r.polarMarkPoint,dQ.coordinateType="polar";class uQ extends hQ{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}])]}}}uQ.type=r.geoMarkPoint,uQ.coordinateType="geo";const pQ="inBrush",gQ="outOfBrush";class mQ extends FG{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),pQ,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),gQ,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 GP(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:lz(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(FP.drawStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(FP.moveStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(FP.drawing,(s=>{this._needInitOutState&&"single"===o&&this._initMarkBrushState(i,gQ),this._needInitOutState=!1,this._needDisablePickable=!0,this._handleBrushChange(t.ChartEvent.brushChange,e,s),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(FP.moving,(i=>{this._handleBrushChange(t.ChartEvent.brushChange,e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(FP.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(FP.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(FP.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({},lz(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(pQ),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(pQ),i.addState(gQ),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(pQ),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(pQ),i.addState(gQ),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(pQ),i.removeState(gQ),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}}}mQ.type=r.brush,mQ.specKey="brush";class fQ extends FG{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,`${hB}_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=dG({},uG(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}}}fQ.type=r.customMark,fQ.specKey="customMark";function vQ(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 _Q(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function yQ(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:_Q(t.rect),anchorCandidates:MQ(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=>vQ(t,r)));if(n.anchorCandidates)if(a&&(null===(e=n.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;tvQ(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 bQ(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=AQ(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(!AQ(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],xQ(SQ(t.point,l)))):t.point;n&&(s.x=n.x,s.y=n.y);const r=xQ(SQ(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=kQ(t.rect,a,0),t}));return yQ(h)}function xQ(t){return t>180?t-360:t}function SQ(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function AQ(t,e){for(let i=0;i{const{x:r,y:a}=kQ(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,s);n.push({x:r,y:a})})),n}class TQ extends FG{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:Xz.copyDataView},!1),this._data=new DH(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 ZE({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=$F(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=ku({});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=Tg(lz(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=bg(lz(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=mp(lz(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=mp(lz(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=kQ(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:lz(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]}))):yQ(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}}TQ.type=r.mapLabel,TQ.specKey="mapLabel";class wQ{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=>CQ(t))),a=n.filter((t=>!CQ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>CQ(t))),h=o.filter((t=>!CQ(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 CQ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}wQ.type="grid";sV.useRegisters([()=>{iI(),sI(),CG(),BG(),ZH(),XH(),QG(),qG(),hz.registerSeries(sW.type,sW),hz.registerChart(uW.type,uW)},()=>{iI(),sI(),CG(),gW(),BG(),fW(),QG(),qG(),hz.registerSeries(_W.type,_W),hz.registerChart(bW.type,bW)},()=>{LW(),hz.registerChart(IW.type,IW)},()=>{XW(),hz.registerChart(qW.type,qW)},()=>{LY(),hz.registerChart(jq.type,jq)},()=>{JY(),hz.registerChart(Nq.type,Nq)},()=>{aK(),hz.registerChart(Wq.type,Wq)},()=>{LW(),hz.registerChart(qq.type,qq)},()=>{MU(),hz.registerChart(Rq.type,Rq)},()=>{sq(),hz.registerSeries(rq.type,rq),EY(),vK(),XY(),hz.registerChart(eZ.type,eZ)},()=>{aX(),hz.registerChart(rZ.type,rZ)},()=>{TX(),hz.registerChart(hZ.type,hZ)},()=>{qU(),hz.registerChart(kZ.type,kZ)},()=>{iY(),BG(),XH(),QG(),qG(),hz.registerSeries(sY.type,sY),hz.registerChart(TZ.type,TZ)},()=>{hz.registerSeries(yK.type,yK),EY(),vK(),$H(),qY(),XY(),hz.registerChart(Qq.type,Qq)},()=>{TK(),hz.registerChart(uZ.type,uZ)},()=>{gY(),hz.registerChart(gZ.type,gZ)},()=>{gW(),QG(),qG(),hz.registerSeries(vY.type,vY),hz.registerChart(PZ.type,PZ)},()=>{y$(),hz.registerChart(_Z.type,_Z)},()=>{k$(),hz.registerChart(bZ.type,bZ)},()=>{J$(),hz.registerChart(SZ.type,SZ)},()=>{Y$(),hz.registerChart(CZ.type,CZ)},()=>{uq(),hz.registerChart(RZ.type,RZ)},()=>{Sq(),hz.registerChart(OZ.type,OZ)},()=>{hz.registerChart(Yq.type,Yq)},qG,QG,()=>{NG(),hz.registerComponent(tW.type,tW)},()=>{NG(),hz.registerComponent(eW.type,eW)},()=>{NG(),hz.registerComponent(iW.type,iW)},qY,XY,()=>{hz.registerComponent(zZ.type,zZ)},()=>{hz.registerComponent(YZ.type,YZ)},()=>{hz.registerComponent(tJ.type,tJ)},()=>{hz.registerComponent(rJ.type,rJ)},()=>{hz.registerComponent(aJ.type,aJ)},()=>{hz.registerComponent(dJ.type,dJ)},()=>{hz.registerComponent(uJ.type,uJ)},()=>{hz.registerComponent(gJ.type,gJ)},SU,()=>{hz.registerComponent(WJ.type,WJ),WE()},()=>{hz.registerComponent(XJ.type,XJ),YE()},()=>{hz.registerComponent(cQ.type,cQ),qE()},()=>{hz.registerComponent(UJ.type,UJ),XE._animate=TE,WE()},()=>{hz.registerComponent($J.type,$J),$E._animate=CE,YE()},()=>{hz.registerComponent(dQ.type,dQ),qE()},()=>{hz.registerComponent(uQ.type,uQ),qE()},()=>{hz.registerComponent(YJ.type,YJ)},()=>{hz.registerComponent(eQ.type,eQ)},()=>{zO(),nQ(),zG(),hz.registerComponent(aQ.type,aQ,!0)},()=>{zO(),nQ(),zG(),hz.registerComponent(oQ.type,oQ,!0)},()=>{hz.registerComponent(mQ.type,mQ)},()=>{hz.registerComponent(fQ.type,fQ)},()=>{hz.registerComponent(TQ.type,TQ)},()=>{ql.load(cT)},()=>{hz.registerLayout(wQ.type,wQ)},qN,pV,UR,WR]),sV.useRegisters([()=>{cA(ql)}]),t.ARC_END_ANGLE=xB,t.ARC_K=SB,t.ARC_MIDDLE_ANGLE=AB,t.ARC_QUADRANT=kB,t.ARC_RADIAN=MB,t.ARC_RATIO=yB,t.ARC_START_ANGLE=bB,t.ARC_TRANSFORM_VALUE=_B,t.AxisSyncPlugin=xV,t.BASE_EVENTS=hD,t.CORRELATION_SIZE=fD,t.CORRELATION_X=gD,t.CORRELATION_Y=mD,t.CanvasTooltipHandler=$N,t.DEFAULT_CHART_HEIGHT=dB,t.DEFAULT_CHART_WIDTH=cB,t.DEFAULT_CONICAL_GRADIENT_CONFIG=HD,t.DEFAULT_DATA_INDEX=_D,t.DEFAULT_DATA_KEY=yD,t.DEFAULT_DATA_SERIES_FIELD=bD,t.DEFAULT_GRADIENT_CONFIG=VD,t.DEFAULT_LABEL_ALIGN=pB,t.DEFAULT_LABEL_LIMIT=uB,t.DEFAULT_LABEL_TEXT=gB,t.DEFAULT_LABEL_VISIBLE=mB,t.DEFAULT_LABEL_X=fB,t.DEFAULT_LABEL_Y=vB,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_GRADIENT_CONFIG=jD,t.DEFAULT_MEASURE_CANVAS_ID=vD,t.DEFAULT_RADIAL_GRADIENT_CONFIG=zD,t.DEFAULT_SERIES_STYLE_NAME=xD,t.DomTooltipHandler=XN,t.Factory=hz,t.FormatterPlugin=uV,t.GradientType=FD,t.MediaQuery=lV,t.POLAR_DEFAULT_RADIUS=EB,t.POLAR_END_ANGLE=270,t.POLAR_END_RADIAN=wB,t.POLAR_START_ANGLE=CB,t.POLAR_START_RADIAN=TB,t.PREFIX=hB,t.SEGMENT_FIELD_END=OD,t.SEGMENT_FIELD_START=LD,t.STACK_FIELD_END=MD,t.STACK_FIELD_END_OffsetSilhouette=ED,t.STACK_FIELD_END_PERCENT=wD,t.STACK_FIELD_KEY=AD,t.STACK_FIELD_START=kD,t.STACK_FIELD_START_OffsetSilhouette=CD,t.STACK_FIELD_START_PERCENT=TD,t.STACK_FIELD_TOTAL=PD,t.STACK_FIELD_TOTAL_PERCENT=BD,t.STACK_FIELD_TOTAL_TOP=RD,t.ThemeManager=Wj,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=sV,t.WaterfallDefaultSeriesField=pD,t.builtinThemes=Lj,t.computeActualDataScheme=LF,t.darkTheme=yj,t.dataScheme=JF,t.default=sV,t.defaultThemeName=Oj,t.getActualColor=IF,t.getColorSchemeBySeries=zF,t.getDataScheme=RF,t.getMergedTheme=Nj,t.getTheme=zj,t.hasThemeMerged=Fj,t.isColorKey=DF,t.isProgressiveDataColorScheme=FF,t.isTokenKey=fj,t.lightTheme=_j,t.queryColorFromColorScheme=OF,t.queryToken=mj,t.registerCanvasTooltipHandler=qN,t.registerChartPlugin=oV,t.registerDomTooltipHandler=()=>{KN(XN)},t.registerFormatPlugin=pV,t.registerMediaQuery=()=>{oV(lV)},t.registerTheme=jj,t.removeTheme=Hj,t.themeExist=Vj,t.themes=Ij,t.token=vj,t.transformColorSchemeToStandardStruct=jF,t.version="1.11.5",t.vglobal=P_,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/vchart-extension/package.json b/packages/vchart-extension/package.json index 08940abf40..de39b5d0e8 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.4", + "@visactor/vchart": "workspace:1.11.5", "@visactor/vrender-core": "0.19.11", "@visactor/vrender-kits": "0.19.11", "@visactor/vutils": "~0.18.9" diff --git a/packages/vchart-schema/package.json b/packages/vchart-schema/package.json index ac9a98114a..f3e52e2520 100644 --- a/packages/vchart-schema/package.json +++ b/packages/vchart-schema/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vchart-schema", - "version": "1.11.4", + "version": "1.11.5", "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 af52b49498..136610cdfa 100644 --- a/packages/vchart-schema/vchart.json +++ b/packages/vchart-schema/vchart.json @@ -73646,6 +73646,14 @@ }, "ITooltipTheme": { "properties": { + "align": { + "enum": [ + "left", + "right" + ], + "since": "1.11.5\n\nshape、key、value的对齐方式,可选项如下:\n'left': 从左到右对齐\n'right': 从右到左对齐", + "type": "string" + }, "keyLabel": { "$ref": "#/definitions/Omit,\"autoWidth\">", "description": "tooltip内容,key字段" @@ -86002,6 +86010,14 @@ }, "Omit,\"offset\">": { "properties": { + "align": { + "enum": [ + "left", + "right" + ], + "since": "1.11.5\n\nshape、key、value的对齐方式,可选项如下:\n'left': 从左到右对齐\n'right': 从右到左对齐", + "type": "string" + }, "keyLabel": { "$ref": "#/definitions/Omit,\"autoWidth\">", "description": "tooltip内容,key字段" diff --git a/packages/vchart-types/package.json b/packages/vchart-types/package.json index 17e5c967a2..937c7e9585 100644 --- a/packages/vchart-types/package.json +++ b/packages/vchart-types/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vchart-types", - "version": "1.11.4", + "version": "1.11.5", "description": "Provide the type declarations of VChart.", "sideEffects": false, "main": "types/index.d.ts", diff --git a/packages/vchart-types/types/component/tooltip/interface/theme.d.ts b/packages/vchart-types/types/component/tooltip/interface/theme.d.ts index 0a690901fc..5248d0a1cf 100644 --- a/packages/vchart-types/types/component/tooltip/interface/theme.d.ts +++ b/packages/vchart-types/types/component/tooltip/interface/theme.d.ts @@ -47,4 +47,5 @@ export interface ITooltipTheme { x?: number; y?: number; }; + align?: 'left' | 'right'; } diff --git a/packages/vchart-types/types/plugin/components/tooltip-handler/dom/interface.d.ts b/packages/vchart-types/types/plugin/components/tooltip-handler/dom/interface.d.ts index 9dbd0e60e3..ec15af7a41 100644 --- a/packages/vchart-types/types/plugin/components/tooltip-handler/dom/interface.d.ts +++ b/packages/vchart-types/types/plugin/components/tooltip-handler/dom/interface.d.ts @@ -16,6 +16,7 @@ export interface IDomTooltipStyle { shapeColumn: TooltipColumnStyle; keyColumn: TooltipColumnStyle; valueColumn: TooltipColumnStyle; + align?: 'left' | 'right'; } export type TooltipColumnStyle = IMargin & { width?: string; diff --git a/packages/vchart-types/types/plugin/components/tooltip-handler/dom/model/content-model.d.ts b/packages/vchart-types/types/plugin/components/tooltip-handler/dom/model/content-model.d.ts index fb23050b33..e228fa674c 100644 --- a/packages/vchart-types/types/plugin/components/tooltip-handler/dom/model/content-model.d.ts +++ b/packages/vchart-types/types/plugin/components/tooltip-handler/dom/model/content-model.d.ts @@ -6,9 +6,7 @@ export declare class ContentModel extends BaseTooltipModel { keyBox: Maybe; valueBox: Maybe; init(): void; - private _initShapeBox; - private _initKeyBox; - private _initValueBox; + private _initBox; setStyle(style?: Partial): void; setContent(): void; protected _getContentContainerStyle(): Partial; diff --git a/packages/vchart-types/types/plugin/components/tooltip-handler/interface/style.d.ts b/packages/vchart-types/types/plugin/components/tooltip-handler/interface/style.d.ts index b2afaef370..68c2a1e917 100644 --- a/packages/vchart-types/types/plugin/components/tooltip-handler/interface/style.d.ts +++ b/packages/vchart-types/types/plugin/components/tooltip-handler/interface/style.d.ts @@ -10,4 +10,5 @@ export interface ITooltipTextStyle extends Partial export interface ITooltipAttributes extends TooltipAttributes { panelDomHeight?: number; maxContentHeight?: number; + align?: 'left' | 'right'; } diff --git a/packages/vchart/CHANGELOG.json b/packages/vchart/CHANGELOG.json index f6b645147b..30e42432c7 100644 --- a/packages/vchart/CHANGELOG.json +++ b/packages/vchart/CHANGELOG.json @@ -1,6 +1,21 @@ { "name": "@visactor/vchart", "entries": [ + { + "version": "1.11.5", + "tag": "@visactor/vchart_v1.11.5", + "date": "Thu, 20 Jun 2024 10:18:10 GMT", + "comments": { + "none": [ + { + "comment": "fix: optimize discrete legend pager color in dark theme, related #2654" + }, + { + "comment": "fix: fix the issue issue with stacked waterfall charts where positive and negative values were not stacked separately when there were both positive and negative values in the same stack\n\n" + } + ] + } + }, { "version": "1.11.4", "tag": "@visactor/vchart_v1.11.4", diff --git a/packages/vchart/CHANGELOG.md b/packages/vchart/CHANGELOG.md index 7ea91523e4..b7d82627fb 100644 --- a/packages/vchart/CHANGELOG.md +++ b/packages/vchart/CHANGELOG.md @@ -1,6 +1,16 @@ # Change Log - @visactor/vchart -This log was last generated on Tue, 18 Jun 2024 06:15:31 GMT and should not be manually modified. +This log was last generated on Thu, 20 Jun 2024 10:18:10 GMT and should not be manually modified. + +## 1.11.5 +Thu, 20 Jun 2024 10:18:10 GMT + +### Updates + +- fix: optimize discrete legend pager color in dark theme, related #2654 +- fix: fix the issue issue with stacked waterfall charts where positive and negative values were not stacked separately when there were both positive and negative values in the same stack + + ## 1.11.4 Tue, 18 Jun 2024 06:15:31 GMT diff --git a/packages/vchart/dist/index-wx-simple.min.js b/packages/vchart/dist/index-wx-simple.min.js index 8bbcd193f1..0035ffaabc 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,a;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 Wt=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 Ut(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 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=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"):Ue[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=Ue[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 Ue={"%":(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 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 Un{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 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 Un(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){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"linearClosed":return ss(t,i)}}class as 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 os=["l",0,0,0,0,0,0,0];function ls(t,e,i){const n=os[0]=t[0];if("a"===n||"A"===n)os[1]=e*t[1],os[2]=i*t[2],os[3]=t[3],os[4]=t[4],os[5]=t[5],os[6]=e*t[6],os[7]=i*t[7];else if("h"===n||"H"===n)os[1]=e*t[1];else if("v"===n||"V"===n)os[1]=i*t[1];else for(let n=1,s=t.length;n{it.getInstance().warn("空函数")}}),ks=Object.assign(Object.assign({},ms),{points:[],cornerRadius:0,closePath:!0}),ws=Object.assign(Object.assign({},ms),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},ms),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const Ts=Object.assign(Object.assign({},ms),{symbolType:"circle",size:10,keepDirIn3d:!0}),Cs=Object.assign(Object.assign(Object.assign({},ms),ps),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Es=Object.assign(Object.assign(Object.assign({},ms),ps),{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}),Ms=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},ms),{fill:!0,cornerRadius:0}),Bs=Object.assign(Object.assign({},Ms),{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 Rs=new class{},Os={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"}},Is=!0,Ps=!1,Ls=/\w|\(|\)|-/,Ds=/[.?!,;:/,。?!、;:]/,Fs=/\S/;function js(t,e,i,n,s){if(!e||e<=0)return 0;const r=Rs.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=Ns(t,a)),a}function Ns(t,e){let i=e;for(;Ls.test(t[i-1])&&Ls.test(t[i])||Ds.test(t[i]);)if(i--,i<=0)return e;return i}function zs(t,e){const i=Rs.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 Vs=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 Hs=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=Cs.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=Ns(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=Ns(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}};Hs=Vs([Bi()],Hs);var Gs=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 Ws=Symbol.for("TextMeasureContribution");let Us=class extends Hs{};Us=Gs([Bi()],Us);const Ys=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 Ui(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)}},Ks=Symbol.for("CanvasFactory"),Xs=Symbol.for("Context2dFactory");function $s(t){return Ys.getNamed(Ks,Rs.global.env)(t)}const Zs=1e-4,qs=Math.sqrt(3),Js=1/3;function Qs(t){return t>-pr&&tpr||t<-pr}const er=[0,0],ir=[0,0],nr=[0,0];function sr(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function rr(t,e,i,n){const s=1-n;return s*(s*t+2*n*e)+n*n*i}function ar(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 or(t){return(t%=kt)<0&&(t+=kt),t}function lr(t,e,i,n,s,r){if(r>e&&r>n||rs?o:0}function hr(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 ur(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(Qs(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 fr=[-1,-1,-1],mr=[-1,-1];function vr(){const t=mr[0];mr[0]=mr[1],mr[1]=t}function yr(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(Qs(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,Js):Math.pow(i,Js),n=n<0?-Math.pow(-n,Js):Math.pow(n,Js);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+qs*Math.sin(e)))/(3*a),h=(-o+i*(n-qs*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,fr);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&vr(),p=ar(e,n,r,o,mr[0]),u>1&&(g=ar(e,n,r,o,mr[1]))),2===u?ce&&o>n&&o>r||o=0&&t<=1&&(s[l++]=t)}}else{const t=a*a-4*r*o;if(Qs(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,fr);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=rr(e,n,r,h);for(let n=0;ni||o<-i)return 0;const l=Math.sqrt(i*i-o*o);fr[0]=-l,fr[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>=fr[0]+t&&a<=fr[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=fr[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 xr(t){return Math.round(t/xt*1e8)/1e8%2*xt}function Sr(t,e){let i=xr(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-xr(i-s)):e&&i1&&(i||(h+=lr(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;Ar[0]=S,Ar[1]=A,Sr(Ar,Boolean(a[6])),S=Ar[0],A=Ar[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(ur(c,d,m,v,e,n,s))return!0}else h+=lr(c,d,m,v,n,s)||0;c=m,d=v;break;case hn.C:if(i){if(cr(c,d,m,v,y,_,b,x,e,n,s))return!0}else h+=yr(c,d,m,v,y,_,b,x,n,s)||0;c=b,d=x;break;case hn.Q:if(i){if(hr(c,d,m,v,y,_,e,n,s))return!0}else h+=_r(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+=lr(c,d,o,l,n,s),i){if(dr(m,v,y,k,k+w,T,e,C,s))return!0}else h+=br(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(ur(u,p,o,p,e,n,s)||ur(o,p,o,l,e,n,s)||ur(o,l,u,l,e,n,s)||ur(u,l,u,p,e,n,s))return!0}else h+=lr(o,p,o,l,n,s),h+=lr(u,l,u,p,n,s);break;case hn.Z:if(i){if(ur(c,d,u,p,e,n,s))return!0}else h+=lr(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},Cr=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Er=Symbol.for("VWindow"),Mr=Symbol.for("WindowHandlerContribution");let Br=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&&(Ys.getNamed(Mr,t.env).configure(this,t),this.actived=!0)},this._uid=mi.GenAutoIncrementId(),this.global=Rs.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)}};Br=Tr([Bi(),Cr("design:paramtypes",[])],Br);var Rr=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},Or=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ir=function(t,e){return function(i,n){e(i,n,t)}};let Pr=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=Rs.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=wr.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:ps.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:ps.fontFamily,fontSize:ps.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=Ys.get(Er),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 Lr;Pr=Rr([Bi(),Ir(0,Ei(Yi)),Ir(0,Ri(Ws)),Or("design:paramtypes",[Object])],Pr),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Lr||(Lr={}));const Dr=new Xt;let Fr=class{constructor(){this.matrix=new Xt}init(t){return this.mode=Lr.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Lr.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(Dr.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(Dr.a,Dr.b,Dr.c,Dr.d,Dr.e,Dr.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Dr.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(Dr.a,Dr.b,Dr.c,Dr.d,Dr.e,Dr.f),this}scale(t,e,i){return this.mode===Lr.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Lr.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Dr.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Dr.a,Dr.b,Dr.c,Dr.d,Dr.e,Dr.f),this}translate(t,e){return this.mode===Lr.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Lr.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Fr=Rr([Bi(),Or("design:paramtypes",[])],Fr);const jr={arc:vs,area:ys,circle:_s,line:Ss,path:As,symbol:Ts,text:Cs,rect:ws,polygon:ks,richtext:Es,richtextIcon:Bs,image:Ms,group:bs,glyph:xs},Nr=Object.keys(jr);function zr(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Vr={arc:Object.assign({},jr.arc),area:Object.assign({},jr.area),circle:Object.assign({},jr.circle),line:Object.assign({},jr.line),path:Object.assign({},jr.path),symbol:Object.assign({},jr.symbol),text:Object.assign({},jr.text),rect:Object.assign({},jr.rect),polygon:Object.assign({},jr.polygon),richtext:Object.assign({},jr.richtext),richtextIcon:Object.assign({},jr.richtextIcon),image:Object.assign({},jr.image),group:Object.assign({},jr.group),glyph:Object.assign({},jr.glyph)};class Hr{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Nr.forEach((t=>{this._defaultTheme[t]=Object.create(Vr[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;Nr.forEach((n=>{const s=Object.create(Vr[n]);t&&t[n]&&zr(s,t[n]),i[n]&&zr(s,i[n]),e[n]&&zr(s,e[n]),this.combinedTheme[n]=s})),e.common&&Nr.forEach((t=>{zr(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 Gr=new Hr;function Wr(t,e){return t.glyphHost?Wr(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)):Gr.getTheme()}return null}(t)||t.attachedThemeGraphic&&Wr(t.attachedThemeGraphic)||Gr.getTheme()}var Ur=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 Yr 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 Ur(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 $r))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(Qr(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 $r))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=Qr(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 $r))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=Qr(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 $r))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=Qr(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 $r))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=Jr.now(),s=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(s,"pointerup"),"touch"===s.pointerType)this.dispatchEvent(s,"touchend");else if(Qr(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(Qr(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,Qr(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 $r))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"):Qr(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 Zr))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=Jr.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 ta(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 $r,this.rootWheelEvent=new Zr,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 sa{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return sa.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 ra{static Avaliable(){return!0}avaliable(){return ra.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 aa{static Avaliable(){return!!Rs.global.getRequestAnimationFrame()}avaliable(){return aa.Avaliable()}tick(t,e){Rs.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var oa;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(oa||(oa={}));class la{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-la.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*la.bounceIn(2*t):.5*la.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}}}la.quadIn=la.getPowIn(2),la.quadOut=la.getPowOut(2),la.quadInOut=la.getPowInOut(2),la.cubicIn=la.getPowIn(3),la.cubicOut=la.getPowOut(3),la.cubicInOut=la.getPowInOut(3),la.quartIn=la.getPowIn(4),la.quartOut=la.getPowOut(4),la.quartInOut=la.getPowInOut(4),la.quintIn=la.getPowIn(5),la.quintOut=la.getPowOut(5),la.quintInOut=la.getPowInOut(5),la.backIn=la.getBackIn(1.7),la.backOut=la.getBackOut(1.7),la.backInOut=la.getBackInOut(1.7),la.elasticIn=la.getElasticIn(1,.3),la.elasticOut=la.getElasticOut(1,.3),la.elasticInOut=la.getElasticInOut(1,.3*1.5);class ha{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 ca=new ha;class da{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(){}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 ua extends da{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let pa=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]:ca;this.id=t,this.timeline=e,this.status=_n.INITIAL,this.tailAnimate=new ga(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.duration===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 ua((()=>{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 ga(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()}};pa.mode=bn.NORMAL,pa.interpolateMap=new Map;class ga{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 fa(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?la[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?la[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 fa(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 fa{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 ma=200,va="cubicOut",ya=1e3,_a="quadInOut";var ba;!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"}(ba||(ba={}));const xa=[!1,!1,!1,!1],Sa=[0,0,0,0],Aa=t=>t?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Sa[0]=t[0],Sa[2]=t[0],Sa[1]=t[1],Sa[3]=t[1],Sa):t:t:0,ka=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],wa=[1,2,3,0,1,2,3,0];function Ta(t,e,i,n){for(;t>=kt;)t-=kt;for(;t<0;)t+=kt;for(;t>e;)e+=kt;ka[0].x=i,ka[1].y=i,ka[2].x=-i,ka[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]:Ra.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)}}Ra.TimeOut=1e3/60;const Oa=new Ra,Ia=(t,e)=>y(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class Pa extends da{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 La;!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"}(La||(La={}));class Da extends da{constructor(t,e,i,n,s){super(t,e,i,n,s),this.newPointAnimateType="appear"===(null==s?void 0:s.newPointAnimateType)?"appear":"grow"}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}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?[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=Ca(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}}class Fa extends da{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 ja extends da{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?la[s]:s;e=r(e),n.onUpdate(t,e,i)})),this.updating=!1)}}function Na(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 za(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 Ya(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 Ka(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 Za(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}))),Qa=(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]},to=(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 Qa(t,{x:n,y:e.y1},{x:n,y:e.y2})}const s=e.y1+n/2;return Qa(t,{x:e.x1,y:s},{x:e.x2,y:s})})(t);to(s[0],n,i),to(s[1],e-n,i)}};var eo;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(eo||(eo={}));class io{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eo.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===eo.Color1){const e=io.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];io.store1[t]=e,io.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=io.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&&(io.store1[t]=[s.r/255,s.g/255,s.b/255,s.opacity],io.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===eo.Color1){if(io.store1[t])return;io.store1[t]=i,io.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(io.store255[t])return;io.store255[t]=i,io.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function no(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 so(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)=>ro(_(t)?t[r]:t,_(e)?e[r]:e,i,n))):ro(t,e,i,n,s)}function ro(t,e,i,n,s){if(!t||!e)return t&&no(t)||e&&no(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=io.Get(t,eo.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=io.Get(e,eo.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:no(a)})))});return o?so(r,l,i,n,s):so(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:lo(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:lo(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:lo(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),no(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)}io.store255={},io.store1={};const ao=[0,0,0,0],oo=[0,0,0,0];function lo(t,e,i){return io.Get(t,eo.Color255,ao),io.Get(e,eo.Color255,oo),`rgba(${Math.round(ao[0]+(oo[0]-ao[0])*i)},${Math.round(ao[1]+(oo[1]-ao[1])*i)},${Math.round(ao[2]+(oo[2]-ao[2])*i)},${ao[3]+(oo[3]-ao[3])*i})`}const ho=(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=so(t.from,t.to,i,!1);n&&(e[t.key]=n)}}))},co=(t,e,i)=>{const n=[],s=[];e.clear();for(let r=0;r{const n=t?Ya(t):[],s=Ya(e);i&&n&&(i.fromTransform&&Ka(n,i.fromTransform.clone().getInverse()),Ka(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})))},po=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],go=(t,e)=>{if(!t||!e)return null;const i=[];let n=!1;return Object.keys(t).forEach((s=>{if(!po.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]?io.Get(t[s],eo.Color255):t[s],to:"string"==typeof r?io.Get(r,eo.Color255):r,key:s}):i.push({from:t[s],to:r,key:s}),n=!0)})),n?i:null};class fo extends da{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;co(this.morphingData,s,e),this.otherAttrs&&this.otherAttrs.length&&ho(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const mo=(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=uo(null===(s=null==t?void 0:t.toCustomPath)||void 0===s?void 0:s.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=go(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 fo({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:ya,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:_a)),c};class vo extends da{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;co(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&&ho(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const yo=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Ma.includes(t))(i)||(e[i]=t[i])})),e},_o=(t,e,i)=>{const n=yo(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=Rs.graphicService.creator.rect({x:0,y:0,width:a,height:o});s.appendChild(i),e.push(i)}))}},bo=(t,e,i)=>{const n=[],s=i?null:yo(t.attribute),r=t.toCustomPath();for(let t=0;t{const n=[],s=i?null:yo(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:n}=$a(t.attribute),s=Za(i,n,e),r=[],a=n/s.length;for(let t=0,e=s.length;t{n.push(Rs.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=Za(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(Rs.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=Za(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(Rs.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 qa(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 qa(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{n.push(Rs.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:Ja(i)}];const n=[];return to(i,e,n),n})(t,e).forEach((t=>{n.push(Rs.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 to(r,e,h),h})(t,e).forEach((t=>{n.push(Rs.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"path"===t.type&&((t,e)=>{const i=Ya(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(Rs.graphicService.creator.path(i?t:Object.assign({},s,t))):n.push(Rs.graphicService.creator.polygon(i?t:Object.assign({},s,t)))}));return i&&_o(t,n,e),n};class So{static GetImage(t,e){var i;const n=So.cache.get(t);n?"fail"===n.loadState?Rs.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):So.loadImage(t,e)}static GetSvg(t,e){var i;let n=So.cache.get(t);n?"fail"===n.loadState?Rs.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"},So.cache.set(t,n),n.dataPromise=Rs.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=So.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"},So.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Rs.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Rs.global.loadBlob(t):"json"===e&&(i.dataPromise=Rs.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!So.isLoading&&So.toLoadAueue.length){So.isLoading=!0;const t=So.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:n}=t,s={type:"image",loadState:"init"};if(So.cache.set(i,s),s.dataPromise=Rs.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((()=>{So.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),So.loading()})).catch((t=>{console.error(t),So.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),So.loading()}))}}),0)}static loadImage(t,e){const i=Ao(t,So.toLoadAueue);if(-1!==i)return So.toLoadAueue[i].marks.push(e),void So.loading();So.toLoadAueue.push({url:t,marks:[e]}),So.loading()}static improveImageLoading(t){const e=Ao(t,So.toLoadAueue);if(-1!==e){const t=So.toLoadAueue.splice(e,1);So.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Ao(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;Bo.x=s+(null!==(i=t.scrollX)&&void 0!==i?i:0),Bo.y=r+(null!==(n=t.scrollY)&&void 0!==n?n:0)}else Bo.x=s,Bo.y=r;return Bo}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Rs.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Rs.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]:To;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:To;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(Rs.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:ma,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:va),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 wo.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(wo),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=hs.x,y:e=hs.y,scaleX:i=hs.scaleX,scaleY:n=hs.scaleY,angle:s=hs.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),Rs.transformUtil.fromMatrix(a,a).scale(i,n,{x:l[0],y:l[1]})}const c=this.getOffsetXY(hs);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=ko.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),Rs.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=so(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=so(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=so(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 Wr(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:Rs.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 as).fromString(t):this.pathProxy=new as,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",Rs.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const s=new qr(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)}}}Oo.mixin(ea);class Io{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 Po(t,e,i,n){const s=t.indexOf(e,i);if(-1===s)throw new Error(n);return s+e.length-1}function Lo(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 Do=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class Fo{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=Lo(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Po(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Lo(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 Io(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 Io(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 jo(t,e){return No(t)}function No(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 Uo=0;function Yo(){return Uo++}var Ko;function Xo(t){const e=[];let i=0,n="";for(let s=0;s$o.set(t,!0)));const Zo=new Map;function qo(t){if($o.has(t))return!0;if(Zo.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Zo.set(t,!0)));const Jo=Yo(),Qo=Yo(),tl=Yo(),el=Yo(),il=Yo(),nl=Yo(),sl=Yo(),rl=Yo(),al=Yo(),ol=Yo();Yo();const ll=Yo();Yo();const hl=Yo(),cl=Yo(),dl=Yo(),ul=Symbol.for("GraphicService"),pl=Symbol.for("GraphicCreator"),gl={"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"},fl=Object.keys(gl);var ml;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(ml||(ml={}));class vl extends Oo{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=nl,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 Hr),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Hr)}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;Rs.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),Rs.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=hs.x,y:e=hs.y,dx:i=hs.dx,dy:n=hs.dy,scaleX:s=hs.scaleX,scaleY:r=hs.scaleY,angle:a=hs.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=Wr(this).group;this._AABBBounds.clear();const i=Rs.graphicService.updateGroupAABBBounds(t,e,this._AABBBounds,this),{boundsPadding:n=e.boundsPadding}=t,s=Aa(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(),Rs.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Rs.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,Rs.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{Rs.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),Rs.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=Rs.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new vl(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return vl.NOWORK_ANIMATE_ATTR}}function yl(t){return new vl(t)}vl.NOWORK_ANIMATE_ATTR=Ro;class _l extends vl{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 Hr,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=>{Rs.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=>{Rs.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 bl=Symbol.for("TransformUtil"),xl=Symbol.for("GraphicUtil"),Sl=Symbol.for("LayerService"),Al=Symbol.for("StaticLayerHandlerContribution"),kl=Symbol.for("DynamicLayerHandlerContribution"),wl=Symbol.for("VirtualLayerHandlerContribution");var Tl,Cl=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},El=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ml=Tl=class{static GenerateLayerId(){return`${Tl.idprefix}_${Tl.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Rs.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?Ys.get(Al):"dynamic"===t?Ys.get(kl):Ys.get(wl),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 _l(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:n,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Tl.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)}};Ml.idprefix="visactor_layer",Ml.prefix_count=0,Ml=Tl=Cl([Bi(),El("design:paramtypes",[])],Ml);var Bl=new vi((t=>{t(Ji).to(nn).inSingletonScope(),t(Er).to(Br),t(xl).to(Pr).inSingletonScope(),t(bl).to(Fr).inSingletonScope(),t(Sl).to(Ml).inSingletonScope()}));function Rl(t,e){return!(!t&&!e)}function Ol(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Il(t,e,i){return i&&t*e>0}function Pl(t,e,i,n,s){return s&&t*e>0&&0!==i&&0!==n}function Ll(t,e){return t*e>0}function Dl(t,e,i,n){return t*e>0&&0!==i&&0!==n}function Fl(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 Nl(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(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:f,outerEndAngle:m,innerEndAngle:v,innerStartAngle:y}=t.getParsePadAngle(o,l),_=u,b=u,x=u,S=u,A=Math.max(b,_),k=Math.max(x,S);let w=A,T=k;const C=s*Ct(f),E=s*Bt(f),M=r*Ct(v),B=r*Bt(v);let R,O,I,P;if((k>bt||A>bt)&&(R=s*Ct(m),O=s*Bt(m),I=r*Ct(y),P=r*Bt(y),hbt){const t=Mt(_,w),r=Mt(b,w),o=jl(I,P,C,E,s,t,Number(c)),l=jl(R,O,M,B,s,r,Number(c));w0&&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+R,n+s*Bt(m))}else!a||a[0]?(e.moveTo(i+C,n+E),e.arc(i,n,s,f,m,!c)):e.moveTo(i+s*Ct(m),n+s*Bt(m));if(!(r>bt)||g<.001)!a||a[1]?e.lineTo(i+M,n+B):e.moveTo(i+M,n+B),d=!0;else if(T>bt){const t=Mt(S,T),s=Mt(x,T),o=jl(M,B,R,O,r,-s,Number(c)),l=jl(C,E,I,P,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),T0&&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+I,n+P)}else!a||a[1]?e.lineTo(i+M,n+B):e.moveTo(i+M,n+B),!a||a[2]?e.arc(i,n,r,v,y,c):e.moveTo(i+r*Ct(y),n+r*Bt(y))}return a?a[3]&&e.lineTo(i+s*Ct(o),n+s*Bt(o)):e.closePath(),d}class zl{static GetCanvas(){try{return zl.canvas||(zl.canvas=Rs.global.createCanvas({})),zl.canvas}catch(t){return null}}static GetCtx(){if(!zl.ctx){const t=zl.GetCanvas();zl.ctx=t.getContext("2d")}return zl.ctx}}class Vl extends $t{static getInstance(){return Vl._instance||(Vl._instance=new Vl),Vl._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=zl.GetCanvas(),n=zl.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 Vl(s,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Hl{static GetSize(t){for(let e=0;e=t)return Hl.ImageSize[e];return t}static Get(t,e,i,n,s,r,a){const o=Hl.GenKey(t,e,i,n,s),l=Hl.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=Hl.GenKey(t,e,i,n,s);Hl.cache[l]?Hl.cache[l].push({width:a,height:o,pattern:r}):Hl.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,n,s){return`${e},${i},${n},${s},${t.join()}`}}Hl.cache={},Hl.ImageSize=[20,40,80,160,320,640,1280,2560];const Gl=Symbol.for("ArcRenderContribution"),Wl=Symbol.for("AreaRenderContribution"),Ul=Symbol.for("CircleRenderContribution"),Yl=Symbol.for("GroupRenderContribution"),Kl=Symbol.for("PathRenderContribution"),Xl=Symbol.for("PolygonRenderContribution"),$l=Symbol.for("RectRenderContribution"),Zl=Symbol.for("SymbolRenderContribution"),ql=Symbol.for("TextRenderContribution"),Jl=Symbol.for("InteractiveSubRenderContribution"),Ql=["radius","startAngle","endAngle",...To];class th extends Oo{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=el}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=Wr(this).circle;this._AABBBounds.clear();const i=this.attribute,n=Rs.graphicService.updateCircleAABBBounds(i,Wr(this).circle,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=Aa(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Wr(this).circle[t]}needUpdateTags(t){return super.needUpdateTags(t,Ql)}needUpdateTag(t){return super.needUpdateTag(t,Ql)}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 as;return o.arc(0,0,s,r,a),o}clone(){return new th(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return th.NOWORK_ANIMATE_ATTR}}function eh(t){return new th(t)}function ih(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 nh(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function sh(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)}th.NOWORK_ANIMATE_ATTR=Ro;class rh{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=dl,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=Wr(this).text;this._AABBBounds.clear();const e=this.attribute,i=Rs.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=this.attribute,s=Aa(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}updateWrapAABBBounds(t){var e,i,n,s;const r=Wr(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=Ia(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=Rs.graphicUtil.textMeasure,k=new rh(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===Ko.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=nh(x,o),w=sh(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=Wr(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=Ia(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=Rs.graphicUtil.textMeasure,_=new rh(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=Wr(this).text,a=Rs.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=Ia(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=nh(x,o),e=this.cache.verticalList.length*b,i=sh(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=>Xo(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===Ko.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=nh(x,o),w=this.cache.verticalList.length*b,T=sh(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 Wr(this).text[t]}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ah;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ah;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function lh(t){return new oh(t)}oh.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Ro),oh.baselineMapAlign={top:"left",bottom:"right",middle:"center"},oh.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class hh{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 ch(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 dh=new class extends hh{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 ch(t,e/2,i,n,s)}drawOffset(t,e,i,n,s,r){return ch(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 uh=new class extends hh{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 ph(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 gh=new class extends hh{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 ph(t,e/2,i,n,s)}drawFitDir(t,e,i,n,s){return ph(t,e/2,i,n,s)}drawOffset(t,e,i,n,s,r){return ph(t,e/2+s,i,n,r)}};function fh(t,e,i,n){const s=2*e;return t.rect(i-e,n-e,s,s),!1}var mh=new class extends hh{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,n){return fh(t,e/2,i,n)}drawOffset(t,e,i,n,s){return fh(t,e/2+s,i,n)}};class vh extends hh{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 yh=new vh;var _h=new class extends vh{constructor(){super(...arguments),this.type="triangle"}};const bh=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),xh=Math.sin(At/10)*bh,Sh=-Math.cos(At/10)*bh;function Ah(t,e,i,n){const s=xh*e,r=Sh*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 kh=new class extends hh{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 Ah(t,e/2,i,n)}drawOffset(t,e,i,n,s){return Ah(t,e/2+s,i,n)}};const wh=Rt(3);function Th(t,e,i,n){const s=e,r=s/wh,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 Ch=new class extends hh{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 Th(t,e/2,i,n)}drawOffset(t,e,i,n,s){return Th(t,e/2+s,i,n)}};function Eh(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 Mh=new class extends hh{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}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)}};function Bh(t,e,i,n){return t.moveTo(-e+i,n),t.lineTo(i,e+n),!1}var Rh=new class extends hh{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}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)}};const Oh=-.5,Ih=Rt(3)/2,Ph=1/Rt(12);function Lh(t,e,i,n){const s=e/2,r=e*Ph,a=s,o=e*Ph+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(Oh*s-Ih*r+i,Ih*s+Oh*r+n),t.lineTo(Oh*a-Ih*o+i,Ih*a+Oh*o+n),t.lineTo(Oh*l-Ih*h+i,Ih*l+Oh*h+n),t.lineTo(Oh*s+Ih*r+i,Oh*r-Ih*s+n),t.lineTo(Oh*a+Ih*o+i,Oh*o-Ih*a+n),t.lineTo(Oh*l+Ih*h+i,Oh*h-Ih*l+n),t.closePath(),!1}var Dh=new class extends hh{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 Lh(t,e/2,i,n)}drawOffset(t,e,i,n,s){return Lh(t,e/2+s,i,n)}};var Fh=new class extends hh{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 jh=new class extends hh{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 Nh=new class extends hh{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 zh=Rt(3);function Vh(t,e,i,n){const s=e*zh;return t.moveTo(i,n+-s/3*2),t.lineTo(e+i,n+s),t.lineTo(i-e,n+s),t.closePath(),!0}var Hh=new class extends vh{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,n){return Vh(t,e/2/zh,i,n)}drawOffset(t,e,i,n,s){return Vh(t,e/2/zh+s,i,n)}};function Gh(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 Wh=new class extends hh{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 Gh(t,e/4,i,n)}drawOffset(t,e,i,n,s){return Gh(t,e/4+s,i,n)}};function Uh(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 Yh=new class extends hh{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 Uh(t,e/4,i,n)}drawOffset(t,e,i,n,s){return Uh(t,e/4+s,i,n)}};function Kh(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 Xh=new class extends hh{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 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-s,n-e),t.lineTo(i,n+e),t.lineTo(i+s,n-e),!0}var Zh=new class extends hh{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 $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,s){return t.moveTo(i,n-e),t.lineTo(i,n+e),!0}var Jh=new class extends hh{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,n,s){return qh(t,e/2,i,n)}drawOffset(t,e,i,n,s,r){return qh(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 Qh(t,e,i,n,s){return t.moveTo(i-e,n),t.lineTo(i+e,n),!0}var tc=new class extends hh{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,n,s){return Qh(t,e/2,i,n)}drawOffset(t,e,i,n,s,r){return Qh(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 ec(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 ic=new class extends hh{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 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-s}, ${i-s} L ${e+s},${i+s} M ${e+s}, ${i-s} L ${e-s},${i+s}`}};function nc(t,e,i,n){return t.rect(i-e[0]/2,n-e[1]/2,e[0],e[1]),!1}function sc(t,e,i,n){const s=e,r=e/2;return t.rect(i-s/2,n-r/2,s,r),!1}var rc=new class extends hh{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)?sc(t,e,i,n):nc(t,e,i,n)}drawOffset(t,e,i,n,s){return S(e)?sc(t,e+2*s,i,n):nc(t,[e[0]+2*s,e[1]+2*s],i,n)}};const ac=new Ht;class oc{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;ac.x1=n.bounds.x1*t,ac.y1=n.bounds.y1*t,ac.x2=n.bounds.x2*t,ac.y2=n.bounds.y2*t,e.union(ac)}))}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 lc={};[dh,uh,gh,mh,Hh,_h,kh,Ch,Mh,Rh,Dh,Fh,jh,yh,Nh,Wh,Yh,Xh,Zh,rc,Jh,tc,ic].forEach((t=>{lc[t.type]=t}));const hc={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"},cc=new Ht,dc=["symbolType","size",...To];let uc=class t extends Oo{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=cl}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=Wr(this).symbol;let{symbolType:i=e.symbolType}=this.attribute,n=lc[i];if(n)return this._parsedPath=n,n;if(n=t.userSymbolMap[i],n)return this._parsedPath=n,n;if(i=hc[i]||i,!0===((s=i).startsWith("{const e=(new as).fromString(t.d),i={};fl.forEach((e=>{t[e]&&(i[gl[e]]=t[e])})),r.push({path:e,attribute:i}),cc.union(e.bounds)}));const a=cc.width(),o=cc.height(),l=1/Et(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new oc(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var s;const r=(new as).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 oc(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=Wr(this).symbol;this._AABBBounds.clear();const i=this.attribute,n=Rs.graphicService.updateSymbolAABBBounds(i,Wr(this).symbol,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=Aa(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Wr(this).symbol[t]}needUpdateTags(t){return super.needUpdateTags(t,dc)}needUpdateTag(t){return super.needUpdateTag(t,dc)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new as).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new as).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function pc(t){return new uc(t)}uc.userSymbolMap={},uc.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Ro);const gc=["segments","points","curveType",...To];let fc=class t extends Oo{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",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||t.length<=1)}_interpolate(t,e,i,n,s){"points"===t&&(s.points=Ea(i,n,e))}doUpdateAABBBounds(){const t=Wr(this).line;this._AABBBounds.clear();const e=this.attribute,i=Rs.graphicService.updateLineAABBBounds(e,Wr(this).line,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=Aa(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Wr(this).line[t]}needUpdateTags(t){return super.needUpdateTags(t,gc)}needUpdateTag(t){return super.needUpdateTag(t,gc)}toCustomPath(){const t=this.attribute,e=new as,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 mc(t){return new fc(t)}fc.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ro);const vc=["width","x1","y1","height","cornerRadius",...To];class yc extends Oo{constructor(t){super(t),this.type="rect",this.numberType=ll}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}doUpdateAABBBounds(){const t=Wr(this).rect;this._AABBBounds.clear();const e=this.attribute,i=Rs.graphicService.updateRectAABBBounds(e,Wr(this).rect,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=Aa(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Wr(this).rect[t]}needUpdateTags(t){return super.needUpdateTags(t,vc)}needUpdateTag(t){return super.needUpdateTag(t,vc)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:n,height:s}=$a(t),r=new as;return r.moveTo(e,i),r.rect(e,i,n,s),r}clone(){return new yc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return yc.NOWORK_ANIMATE_ATTR}}function _c(t){return new yc(t)}yc.NOWORK_ANIMATE_ATTR=Ro;class bc{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=Os[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 xc{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const n=Ia(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}=zs(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}=zs(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=js(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}=zs(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||Ps;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||Is;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=js(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:n}=zs(this.text.slice(t),this.character);return i+this.ellipsisWidth-n}return i}}const Sc=["width","height","image",...To];class Ac extends Oo{constructor(t){super(t),this.type="image",this.numberType=sl,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=Wr(this).image;this._AABBBounds.clear();const e=this.attribute,i=Rs.graphicService.updateImageAABBBounds(e,Wr(this).image,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=Aa(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Ms[t]}needUpdateTags(t){return super.needUpdateTags(t,Sc)}needUpdateTag(t){return super.needUpdateTag(t,Sc)}clone(){return new Ac(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ac.NOWORK_ANIMATE_ATTR}}Ac.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Ro);class kc extends Ac{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=Aa(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=Aa(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=Ms.width,height:e=Ms.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 wc{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 kc?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=Os[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof xc){const e=Fs.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 kc)break;if("vertical"===this.direction&&"vertical"!==n.direction){n.verticalEllipsis=!0;break}const r=!0===s?"...":s||"";n.ellipsisStr=r;const{width:a}=zs(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 kc)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 kc)break;const{width:s}=zs(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 kc?t.width:t.getWidthWithEllips(this.direction)})),i}}class Tc{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=Os[this.direction]}store(t){if(t instanceof kc){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 wc(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 kc?"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=js(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 xc(i,t.newLine,t.character),new xc(n,!0,t.character)]}(t,n);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const Cc=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...To];class Ec extends Oo{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=hl}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Es.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:Es.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:Es.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:Es.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:Es.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:Es.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:Es.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:Es.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=Wr(this).richtext;this._AABBBounds.clear();const e=this.attribute,i=Rs.graphicService.updateRichTextAABBBounds(e,Wr(this).richtext,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=Aa(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Es[t]}needUpdateTags(t){return super.needUpdateTags(t,Cc)}needUpdateTag(t){return super.needUpdateTag(t,Cc)}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(){var t;const{textConfig:e=[],maxWidth:i,maxHeight:n,width:s,height:r,ellipsis:a,wordBreak:o,verticalDirection:l,textAlign:h,textBaseline:c,layoutDirection:d,singleLine:u,disableAutoWrapLine:p}=this.attribute,g=[];for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,g.push(t)}}else{const i=this.combinedStyleToCharacter(e[t]);if(S(i.text)&&(i.text=`${i.text}`),i.text&&i.text.includes("\n")){const t=i.text.split("\n");for(let e=0;e0,m="number"==typeof n&&Number.isFinite(n)&&n>0,v="number"==typeof s&&Number.isFinite(s)&&s>0&&(!f||s<=i),y="number"==typeof r&&Number.isFinite(r)&&r>0&&(!m||r<=n),_=new bc(0,0,(v?s:f?i:0)||0,(y?r:m?n:0)||0,a,o,l,h,c,d||"horizontal",!v&&f,!y&&m,u||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),b=new Tc(_);if(p){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 Ec.NOWORK_ANIMATE_ATTR}}function Mc(t){return new Ec(t)}Ec.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Ro);const Bc=["path","customPath",...To];class Rc extends Oo{constructor(t){super(t),this.type="path",this.numberType=al}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=Wr(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof as?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof as?this.cache:t.path)}doUpdateAABBBounds(){const t=Wr(this).path;this.doUpdatePathShape(),this._AABBBounds.clear();const e=this.attribute,i=Rs.graphicService.updatePathAABBBounds(e,Wr(this).path,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=Aa(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;y(t.path,!0)?this.cache=(new as).fromString(t.path):t.customPath&&(this.cache=new as,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Wr(this).path[t]}needUpdateTags(t){return super.needUpdateTags(t,Bc)}needUpdateTag(t){return super.needUpdateTag(t,Bc)}toCustomPath(){return(new as).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Rc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Rc.NOWORK_ANIMATE_ATTR}}function Oc(t){return new Rc(t)}Rc.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Ro);const Ic=["segments","points","curveType",...To];class Pc extends Oo{constructor(t){super(t),this.type="area",this.numberType=tl}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=Wr(this).area;this._AABBBounds.clear();const e=this.attribute,i=Rs.graphicService.updateAreaAABBBounds(e,Wr(this).area,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=Aa(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,s){"points"===t&&(s.points=Ea(i,n,e))}getDefaultAttribute(t){return Wr(this).area[t]}needUpdateTags(t){return super.needUpdateTags(t,Ic)}needUpdateTag(t){return super.needUpdateTag(t,Ic)}toCustomPath(){const t=new as,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 Pc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Pc.NOWORK_ANIMATE_ATTR}}function Lc(t){return new Pc(t)}Pc.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ro);const Dc=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...To];class Fc extends Oo{constructor(t){super(t),this.type="arc",this.numberType=Jo}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=Wr(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);return Math.min(S(e,!0)?e:a*parseFloat(e)/100,a/2)}getParsedAngle(){const t=Wr(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=Wt(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=Wr(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=Wr(this).arc;this._AABBBounds.clear();const i=this.attribute,n=Rs.graphicService.updateArcAABBBounds(i,Wr(this).arc,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=Aa(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return super.needUpdateTags(t,Dc)}needUpdateTag(t){return super.needUpdateTag(t,Dc)}getDefaultAttribute(t){return Wr(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 Fc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Fc.NOWORK_ANIMATE_ATTR}}function jc(t){return new Fc(t)}Fc.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Ro);const Nc=["points","cornerRadius",...To];class zc extends Oo{constructor(t){super(t),this.type="polygon",this.numberType=ol}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=Wr(this).polygon;this._AABBBounds.clear();const e=this.attribute,i=Rs.graphicService.updatePolygonAABBBounds(e,Wr(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=Aa(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,s){"points"===t&&(s.points=Ea(i,n,e))}getDefaultAttribute(t){return Wr(this).polygon[t]}needUpdateTags(t){return super.needUpdateTags(t,Nc)}needUpdateTag(t){return super.needUpdateTag(t,Nc)}toCustomPath(){const t=this.attribute.points,e=new as;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 zc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return zc.NOWORK_ANIMATE_ATTR}}function Vc(t){return new zc(t)}zc.NOWORK_ANIMATE_ATTR=Ro;class Hc extends vl{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 Gc(t){return new Hc(t)}class Wc{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 Uc extends Wc{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;Wo(i,n+(r+o)/2,!0,a)}return i}}class Yc{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 Yc.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},Zc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qc=function(t,e){return function(i,n){e(i,n,t)}};function Jc(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 Qc(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 td(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 ed(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),Jc(t,t,[s+o,r+l,a+h]),Jc(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),Jc(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=Xc.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]}Jc(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),Jc(i,i,[-n[0],-n[1],0]),td(t,t,i)}}let id=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 Wc],this._symbolBoundsContribitions=[new Uc],this._imageBoundsContribitions=[new Wc],this._circleBoundsContribitions=[new Wc],this._arcBoundsContribitions=[new Wc],this._pathBoundsContribitions=[new Wc]}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,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}=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 h=this.tempAABBBounds1,c=this.tempAABBBounds2;return h.setValue(i.x1,i.y1,i.x2,i.y2),c.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=sh(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=nh(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){Wo(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}=t,r=i;return s.forEach((t=>{r.add(t.x,t.y)})),r}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{r.add(t.x,t.y)}))})),r}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):Ta(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):(Ta(h,l,s,i),Ta(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){Wo(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;Wo(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)}};id=$c([Bi(),qc(0,Ei(pl)),Zc("design:paramtypes",[Object])],id);const nd=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 sd,rd;function ad(t){return sd||(sd=nd.CreateGraphic("text",{})),sd.initAttributes(t),sd.AABBBounds}const od={x:0,y:0,z:0,lastModelMatrix:null};class ld{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=Il(o,l,s),p=Ll(o,c),g=Rl(s,r),f=Ol(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;od.x=s,od.y=r,od.z=a,od.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=Xc.allocate(),s=Xc.allocate();ed(s,t,e),td(n,d||n,s),od.x=0,od.y=0,od.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),Xc.free(s)}if(g&&!d){const n=t.getOffsetXY(e);od.x+=n.x,od.y+=n.y,od.z=a,i.setTransformForCurrent()}else if(p)od.x=0,od.y=0,od.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const n=t.getOffsetXY(e);od.x+=n.x,od.y+=n.y,this.transformWithoutTranslate(i,od.x,od.y,od.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),od.x=0,od.y=0,od.z=0;return od}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=Wr(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=Il(d,u,h),_=Ll(d,g),b=Rl(h),x=Ol(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&&Xc.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}const hd=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 cd{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(cd.IsGradientStr(t))try{const e=hd(t)[0];if(e){if("linear"===e.type)return cd.ParseLinear(e);if("radial"===e.type)return cd.ParseRadial(e);if("conic"===e.type)return cd.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 dd(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 ud(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 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},gd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fd=function(t,e){return function(i,n){e(i,n,t)}};class md{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=Wr(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=wr.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),wr.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 vd=new md;let yd=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)}))}};yd=pd([Bi(),fd(0,Ei(Yi)),fd(0,Ri(Jl)),gd("design:paramtypes",[Object])],yd);class _d{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=wr.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])),wr.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 bd=new _d;const xd=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=dd(e,s,e.dpr),a=s/T;if(t.setAttributes({outerRadius:T+r,innerRadius:w-r,startAngle:y-a,endAngle:_+a}),e.beginPath(),Nl(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=dd(e,s,e.dpr),a=s/T;if(t.setAttributes({outerRadius:T-r,innerRadius:w+r,startAngle:y+a,endAngle:_-a}),e.beginPath(),Nl(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:_})}},Sd=bd,Ad=vd;const kd=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=dd(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=dd(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()}}}},wd=bd,Td=vd;const Cd=new class extends md{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()}},Ed=xt/2;function Md(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],-Ed,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,Ed,!1)}if(t.lineTo(_[0],_[1]),!$(_,b)){const e=_[0],i=_[1]-u[3];t.arc(e,i,u[3],Ed,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+Ed,!1)}return t.closePath(),t}var Bd=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 Rd=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)}};Rd=Bd([Bi()],Rd);let Od=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()}}};Od=Bd([Bi()],Od);const Id=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=dd(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(),Md(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=dd(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(),Md(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()}}}},Pd=bd,Ld=vd;const Dd=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=dd(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=dd(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()}}}},Fd=bd,jd=vd;var Nd=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},zd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vd=function(t,e){return function(i,n){e(i,n,t)}};let Hd=class extends ld{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=Jo,this.builtinContributions=[xd,Ad,Sd],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||T>bt)&&(P=s*Ct(_),L=s*Bt(_),D=r*Ct(x),F=r*Bt(x),ubt){const t=Mt(S,E),r=Mt(A,E),a=jl(D,F,B,R,s,t,Number(p)),o=jl(P,L,O,I,s,r,Number(p));if(E0&&e.arc(i+o.cx,n+o.cy,r,Tt(o.y11,o.x11),Tt(o.y01,o.x01),!p)}}else e.moveTo(i+B,n+R);if(!(r>bt)||v<.001)e.lineTo(i+O,n+I),g=!0;else if(M>bt){const t=Mt(w,M),s=Mt(k,M),a=jl(O,I,P,L,r,-s,Number(p)),o=jl(B,R,D,F,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,n+a.cy+a.y01),M0&&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(x),n+r*Bt(x));return g}drawShape(t,e,i,n,s,r,a,o){const l=Wr(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++)xa[n]=t,i&&(i=!(null!==(e=xa[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)xa[e]=!!t[e],i&&(i=!!xa[e]);else xa[0]=!1,xa[1]=!1,xa[2]=!1,xa[3]=!1;return{isFullStroke:i,stroke:xa}})(d);if((v||E)&&(e.beginPath(),Nl(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(),Nl(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),so(o.color,l.color,h,!1)}(0,0,h,s);a||Il&&(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=Wr(t,null==n?void 0:n.theme).arc;this._draw(t,s,!1,i,n)}};Hd=Nd([Bi(),Vd(0,Ei(Yi)),Vd(0,Ri(Gl)),zd("design:paramtypes",[Object])],Hd);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},Wd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ud=function(t,e){return function(i,n){e(i,n,t)}};let Yd=class extends ld{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=el,this.builtinContributions=[kd,Td,wd],this.init(t)}drawShape(t,e,i,n,s,r,a,o){const l=Wr(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=Wr(t,null==n?void 0:n.theme).circle;this._draw(t,s,!1,i,n)}};function Kd(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 Xd(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),Kd(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 Zd=class extends ld{constructor(){super(...arguments),this.numberType=rl}draw(t,e,i,n){const s=Wr(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;Xd(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(),Xd(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"===m)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=rs(t.points,m,{startPoint:e});return n=s,s})).filter((t=>!!t)),"linearClosed"===m){let e;for(let i=0;it.points.length));if(1===s[0].points.length&&s.shift(),1===v){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,s[g],[l,t.attribute],v,y,i,n,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=v*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,s[m],[l,t.attribute],Mt(_,1),y,i,n,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,v,y,i,n,t,a,o)}};function qd(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 Jd(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),Kd(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),Kd(t,l,1,n),o=!1):o=!0}t.closePath()}Zd=$d([Bi()],Zd);const Qd=new class extends _d{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:Ba(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Ba(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:Ba(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:Ba(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,n,l,_,b,x)}},tu=vd;var eu=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},iu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nu=function(t,e){return function(i,n){e(i,n,t)}};function su(t,e,i){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"linearClosed":return ss(t,i)}}let ru=class extends ld{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=tl,this.builtinContributions=[Qd,tu],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=Wr(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}=t.attribute,b=this.valid(t,g,a,o);if(!b)return;const{doFill:x,doStroke:S}=b,{clipRange:A=g.clipRange,closePath:k,points:w,segments:T}=t.attribute;let{curveType:C=g.curveType}=t.attribute;if(k&&"linear"===C&&(C="linearClosed"),1===A&&!T&&!w.some((t=>!1===t.defined))&&"linear"===C)return this.drawLinearAreaHighPerformance(t,e,!!f,S,v,_,i,n,g,s,r,a,o);if(t.shouldUpdateShape()){if(T&&T.length){let e,i;const n=T.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=su(t.points,C,{startPoint:e});return i=s,s})).filter((t=>!!t));let s;const r=[];for(let t=T.length-1;t>=0;t--){const e=T[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=T[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=su(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C),r.unshift(s))}t.cacheArea=r.map(((t,e)=>({top:n[e],bottom:t})))}else{if(!w||!w.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=w,i=[];for(let t=w.length-1;t>=0;t--)i.push({x:null!==(u=w[t].x1)&&void 0!==u?u:w[t].x,y:null!==(p=w[t].y1)&&void 0!==p?p:w[t].y});const n=su(e,C),s=su(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C);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===A){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,x,v,S,_,r[c],[g,t.attribute],A,i,n,y,t,s,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=A*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,x,v,S,_,r[u],[g,t.attribute],Mt(f,1),i,n,y,t,s,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,x,v,S,_,t.attribute,g,A,i,n,y,t,s,a,o)}draw(t,e,i,n){const s=Wr(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=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),qd(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),qd(t,e,i,n),e.length=0,i.length=0)}s=o})),qd(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},hu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cu=function(t,e){return function(i,n){e(i,n,t)}};let du=class extends ld{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=al,this.builtinContributions=[ou,au],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:Wr(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=Wr(t,null==n?void 0:n.theme).path;this.tempTheme=s,this._draw(t,s,!1,i,n),this.tempTheme=null}};du=lu([Bi(),cu(0,Ei(Yi)),cu(0,Ri(Kl)),hu("design:paramtypes",[Object])],du);var uu=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},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 ld{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=ll,this.builtinContributions=[Id,Ld,Pd],this.init(t)}drawShape(t,e,i,n,s,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Wr(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=Pl(g,f,k,w,c),C=Dl(g,v,k,w),E=Rl(c,d),M=Ol(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(),Md(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=Wr(t,null==n?void 0:n.theme).rect;this.tempTheme=s,this._draw(t,s,!1,i,n),this.tempTheme=null}};fu=uu([Bi(),gu(0,Ei(Yi)),gu(0,Ri($l)),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 ld{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=cl,this.builtinContributions=[Dd,jd,Fd],this.init(t)}drawShape(t,e,i,n,s,r,a,o){var l;const h=Wr(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=Wr(t,null==n?void 0:n.theme).symbol;this._draw(t,s,!1,i,n)}};_u=mu([Bi(),yu(0,Ei(Yi)),yu(0,Ri(Zl)),vu("design:paramtypes",[Object])],_u);const bu=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 xu=new class extends md{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=bu.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=ad(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?(Md(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&&bu.free(E),C()}};var Su=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)},ku=function(t,e){return function(i,n){e(i,n,t)}};let wu=class extends ld{constructor(t){super(),this.textRenderContribitions=t,this.numberType=dl,this.builtinContributions=[xu],this.init(t)}drawShape(t,e,i,n,s,r,a,o){var l,h,c;const d=Wr(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=Ia(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=Kc.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Kc.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=Wr(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=nh(l,m),y=sh(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=sh("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 Tu(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},Ou=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Iu=function(t,e){return function(i,n){e(i,n,t)}};let Pu=class extends ld{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=ol,this.builtinContributions=[Bu,Mu],this.init(t)}drawShape(t,e,i,n,s,r,a,o){const l=Wr(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))?Tu(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 Tu(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 _=Cu(d,u),b=Cu(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=Eu(h,y,_,d,u),A=Eu(h,y,b,p,g),k=2*h.x-S.x-A.x,w=2*h.y-S.y-A.y,T=Cu(k,w),C=Eu(h,Cu(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=Wr(t,null==n?void 0:n.theme).polygon;this._draw(t,s,!1,i,n)}};Pu=Ru([Bi(),Iu(0,Ei(Yi)),Iu(0,Ri(Xl)),Ou("design:paramtypes",[Object])],Pu);const Lu=Symbol.for("IncrementalDrawContribution"),Du=Symbol.for("ArcRender"),Fu=Symbol.for("AreaRender"),ju=Symbol.for("CircleRender"),Nu=Symbol.for("GraphicRender"),zu=Symbol.for("GroupRender"),Vu=Symbol.for("LineRender"),Hu=Symbol.for("PathRender"),Gu=Symbol.for("PolygonRender"),Wu=Symbol.for("RectRender"),Uu=Symbol.for("SymbolRender"),Yu=Symbol.for("TextRender"),Ku=Symbol.for("RichTextRender"),Xu=Symbol.for("GlyphRender"),$u=Symbol.for("DrawContribution");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},qu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Ju=Symbol.for("DrawItemInterceptor"),Qu=new Ht,tp=new Ht;class ep{constructor(){this.order=1}afterDrawItem(t,e,i,n,s){return(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx)&&this.drawItem(t,e,i,n,s),!1}beforeDrawItem(t,e,i,n,s){return t.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){Qu.copy(n.dirtyBounds),tp.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(Qu),n.backupDirtyBounds.copy(tp)),!0}}class ip{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 np=class{constructor(){this.order=1,this.interceptors=[new ep,new rp,new sp,new ip]}afterDrawItem(t,e,i,n,s){for(let r=0;r(e=t.numberType===Qo,!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&&Xc.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}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},op=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lp=function(t,e){return function(i,n){e(i,n,t)}};const hp=Symbol.for("RenderService");let cp=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}};cp=ap([Bi(),lp(0,Ei($u)),op("design:paramtypes",[Object])],cp);var dp=new vi((t=>{t(hp).to(cp)}));const up=Symbol.for("PickerService"),pp=Symbol.for("GlobalPickerService");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};const fp=Symbol.for("PickItemInterceptor");let mp=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){if(!t.shadowRoot)return null;const{parentMatrix:r}=s||{};if(!r)return null;const a=e.pickContext;a.highPerformanceSave();const o=t.shadowRoot,l=Kc.allocateByObj(r),h=new jt(l.a*i.x+l.c*i.y+l.e,l.b*i.x+l.d*i.y+l.f),c=e.pickGroup(o,h,l,n);return a.highPerformanceRestore(),c}};mp=gp([Bi()],mp);let vp=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}};vp=gp([Bi()],vp);let yp=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===Qo,!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()}};yp=gp([Bi()],yp);var _p=new vi(((t,e,i)=>{i(up)||(t(pp).toSelf(),t(up).toService(pp)),t(yp).toSelf().inSingletonScope(),t(fp).toService(yp),t(mp).toSelf().inSingletonScope(),t(fp).toService(mp),t(vp).toSelf().inSingletonScope(),t(fp).toService(vp),Xi(t,fp)})),bp=new vi((t=>{t(ul).to(id).inSingletonScope(),t(pl).toConstantValue(nd)}));const xp=Symbol.for("AutoEnablePlugins"),Sp=Symbol.for("PluginService");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},kp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wp=function(t,e){return function(i,n){e(i,n,t)}};let Tp=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&&Ys.isBound(xp)&&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=[]}};Tp=Ap([Bi(),wp(0,Ei(Yi)),wp(0,Ri(xp)),kp("design:paramtypes",[Object])],Tp);var Cp=new vi((t=>{t(Sp).to(Tp),function(t,e){t(Yi).toDynamicValue((t=>{let{container:i}=t;return new Ki(e,i)})).whenTargetNamed(e)}(t,xp)})),Ep=new vi((t=>{Xi(t,qi)})),Mp=new vi((t=>{t(Ws).to(Us).inSingletonScope(),Xi(t,Ws)})),Bp=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)};let Op=class{constructor(){this.type="static",this.offscreen=!1,this.global=Rs.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=$s({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()}};Op=Bp([Bi(),Rp("design:paramtypes",[])],Op);var Ip=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},Pp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Lp=class{constructor(){this.offscreen=!1,this.type="virtual",this.global=Rs.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(){}};Lp=Ip([Bi(),Pp("design:paramtypes",[])],Lp);var Dp=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)};let jp=class{constructor(){this.offscreen=!0,this.type="dynamic",this.global=Rs.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;const n=$s({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){}};jp=Dp([Bi(),Fp("design:paramtypes",[])],jp);var Np=new vi((t=>{t(Op).toSelf(),t(jp).toSelf(),t(Lp).toSelf(),t(Al).toService(Op),t(kl).toService(jp),t(wl).toService(Lp)}));var zp=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 Vp(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 zp(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,n)}))}function Gp(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 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},Up=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Yp=function(t,e){return function(i,n){e(i,n,t)}};let Kp=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=Rs.global,this.layerService=Rs.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:ms.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:ms.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Kc.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=Gp(e,i,ms.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=bu.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Kc.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))})):Vp(t,ms.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),bu.free(s),Kc.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||Ys.get(Lu);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},$p=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zp=function(t,e){return function(i,n){e(i,n,t)}};let qp=class{constructor(t){this.groupRenderContribitions=t,this.numberType=nl}drawShape(t,e,i,n,s,r,a,o){const l=Wr(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=Pl(u,m,p,g,h),k=Dl(u,v,p,g),w=Rl(h,c),T=Ol(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(),Md(e,i,n,p,g,y));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Cd));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=Wr(t,null==n?void 0:n.theme).group,l=s.modelMatrix;if(s.camera){const e=Xc.allocate(),i=Xc.allocate();ed(i,t,o),td(e,l||e,i),s.modelMatrix=e,Xc.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&&Xc.free(s.modelMatrix),s.modelMatrix=l,s.baseGlobalAlpha/=a,d&&d.then?d.then((()=>{r?s.restore():s.highPerformanceRestore()})):r?s.restore():s.highPerformanceRestore()}};qp=Xp([Bi(),Zp(0,Ei(Yi)),Zp(0,Ri(Yl)),$p("design:paramtypes",[Object])],qp);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};let Qp=class extends Zd{constructor(){super(...arguments),this.numberType=rl}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=Wr(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=Il(u,p,c),y=Ll(u,g),_=Rl(c),b=Ol(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())}};Qp=Jp([Bi()],Qp);var tg=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 eg=class extends ru{constructor(){super(...arguments),this.numberType=tl}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=Wr(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Il(u,d,c),f=Rl(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())}};eg=tg([Bi()],eg);var ig,ng=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},sg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rg=function(t,e){return function(i,n){e(i,n,t)}},ag=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"}(ig||(ig={}));let og=class extends Kp{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=ig.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 ag(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:ms.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:ms.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 ag(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return ag(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>ag(this,void 0,void 0,(function*(){if(2!==t.count)yield Hp(t,ms.zIndex,((i,n)=>{if(this.status===ig.STOP)return!0;if(i.isContainer)return!1;if(n{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return ag(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return ag(this,void 0,void 0,(function*(){this.rendering&&(this.status=ig.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=ig.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 ag(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:()=>ag(this,void 0,void 0,(function*(){yield Hp(t,ms.zIndex,(t=>ag(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};og=ng([Bi(),rg(0,Mi(Nu)),rg(1,Ei(Qp)),rg(2,Ei(eg)),rg(3,Ei(Yi)),rg(3,Ri(Ju)),sg("design:paramtypes",[Array,Object,Object,Object])],og);var lg=new vi((t=>{t(md).toSelf().inSingletonScope(),t(_d).toSelf().inSingletonScope(),t($u).to(Kp),t(Lu).to(og),t(zu).to(qp).inSingletonScope(),t(Nu).toService(zu),Xi(t,Yl),t(yd).toSelf().inSingletonScope(),Xi(t,Jl),Xi(t,Nu),t(np).toSelf().inSingletonScope(),t(Ju).toService(np),Xi(t,Ju)}));function hg(){hg.__loaded||(hg.__loaded=!0,Ys.load(Bl),Ys.load(bp),Ys.load(dp),Ys.load(_p),Ys.load(Cp),function(t){t.load(Ep),t.load(Mp),t.load(Np)}(Ys),function(t){t.load(lg)}(Ys))}hg.__loaded=!1,hg();const cg=Ys.get(Ji);Rs.global=cg;const dg=Ys.get(xl);Rs.graphicUtil=dg;const ug=Ys.get(bl);Rs.transformUtil=ug;const pg=Ys.get(ul);Rs.graphicService=pg;const gg=Ys.get(Sl);Rs.layerService=gg;class fg{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=mi.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Rs.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),Rs.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){Rs.graphicService.hooks.onAttributeUpdate.taps=Rs.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Rs.graphicService.hooks.onSetStage.taps=Rs.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class mg{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 vg{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,Rs.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))})),Rs.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){Rs.graphicService.hooks.onAddIncremental.taps=Rs.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Rs.graphicService.hooks.onClearIncremental.taps=Rs.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Rs.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 yg{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)),Rs.graphicService.hooks.onRemove.unTap(this.key),Rs.graphicService.hooks.onRelease.unTap(this.key),this.release()}getWrapContainer(t,e,i){let n;return n=e?"string"==typeof e?Rs.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:Rs.global.createDom(Object.assign({tagName:"div",parent:n},i)),nativeContainer:n}}parseDefaultStyleFromGraphic(t){return function(t){const e={};return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[Le(i)]=t[i])})),["fontSize","lineHeight"].forEach((i=>{const n=Le(i);u(t[i])||(e[n]=/^[0-9]*$/.test(`${t[i]}`)?`${t[i]}px`:`${t[i]}`)})),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:Wr(t).text)}getTransformOfText(t){const e=Wr(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=Rs.global.getElementTopLeft(n,!1),f=e.window.getTopLeft(!1),m=o+f.left-p.left,v=l+f.top-p.top;if(a.left=`${m}px`,a.top=`${v}px`,"text"===t.type&&"position"===c&&(a=Object.assign(Object.assign({},a),this.getTransformOfText(t))),d(s.style)){const e=s.style({top:v,left:m,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)));Rs.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"===Rs.global.env&&(t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:ms.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:ms.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&&Rs.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"===Rs.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 Ht;class bg{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()})),Rs.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&&(_g.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(_g,t.parent&&t.parent.globalTransMatrix)))})),Rs.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))})),Rs.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){Rs.graphicService.hooks.beforeUpdateAABBBounds.taps=Rs.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Rs.graphicService.hooks.afterUpdateAABBBounds.taps=Rs.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)),Rs.graphicService.hooks.onRemove.taps=Rs.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const xg=new Ht;class Sg{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=Wr(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,Rs.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),Rs.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&xg.copy(n)})),Rs.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,s)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(xg.equals(i)||this.tryLayout(t,!1))})),Rs.graphicService.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1)}))}deactivate(t){Rs.graphicService.hooks.onAttributeUpdate.taps=Rs.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Rs.graphicService.hooks.beforeUpdateAABBBounds.taps=Rs.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Rs.graphicService.hooks.afterUpdateAABBBounds.taps=Rs.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Rs.graphicService.hooks.onSetStage.taps=Rs.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const Ag=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===oa.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=oa.INITIAL,Rs.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),Rs.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:aa},{mode:"timeout",cons:ra},{mode:"manual",cons:sa}];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!==oa.INITIAL&&(this.status=oa.PAUSE,!0)}resume(){return this.status!==oa.INITIAL&&(this.status=oa.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===oa.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===oa.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=oa.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=oa.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};Ag.addTimeline(ca),Ag.setFPS(60);class kg{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=io.Get(e,eo.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)?io.Get(e,eo.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*s[0]*n}, ${r[1]*s[1]*n}, ${r[2]*s[2]*n})`}}function wg(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 Tg(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 Cg{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=Xc.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=Xc.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()})),i&&Rs.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))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])this.htmlMap[o].root.render(r);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(n,a);if(t){const i=s.createRoot(t);i.render(r),this.htmlMap||(this.htmlMap={}),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}}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 Rg="white";class Og extends vl{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:Rg}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 Hr,this.hooks={beforeRender:new Zi(["stage"]),afterRender:new Zi(["stage"])},this.global=Rs.global,!this.global.env&&Mg()&&this.global.setEnv("browser"),this.window=Ys.get(Er),this.renderService=Ys.get(hp),this.pluginService=Ys.get(Sp),this.layerService=Ys.get(Sl),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:Rg,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||Ag,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new ha,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 na(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 kg(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 Cg(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 mg))}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 fg))}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 vg))}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 bg,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 Sg))}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 yg))}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 Bg))}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){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(){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){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(){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];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];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){this.pickerService||(this.pickerService=Ys.get(up));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){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){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;const e=Ys.get(Er),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;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 Ig=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},Pg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Lg=new Xt(1,0,0,1,0,0),Dg={x:0,y:0};let Fg=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 as,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 Kc.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(Kc.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Kc.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},Dg),function(t,e,i){return kr(t,0,!1,e,i)}(this.path.commandList,Dg.x,Dg.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},Dg);const i=dd(this,this.lineWidth,this.dpr);return function(t,e,i,n){return kr(t,e,!0,i,n)}(this.path.commandList,i,Dg.x,Dg.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(Lg,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=>Kc.free(t))),this.stack.length=0}};Fg=Ig([Bi(),Pg("design:paramtypes",[Object,Number])],Fg);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={WIDTH:500,HEIGHT:500,DPR:1};let Vg=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=zg.WIDTH,height:s=zg.HEIGHT,dpr:r=zg.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)}};Vg.env="browser",Vg=jg([Bi(),Ng("design:paramtypes",[Object])],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};let Gg=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}}};Gg=Hg([Bi()],Gg);var Wg=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)};let Yg=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}};Yg=Wg([Bi(),Ug("design:paramtypes",[])],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},Xg=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 Zg=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=Rs.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=Xc.allocate();if(Qc(i,e),a){if(i){const t=Xc.allocate();r.modelMatrix=td(t,a,i),Xc.free(i)}}else Qc(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=Wr(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=Wr(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&&Xc.free(r.modelMatrix),r.modelMatrix=a,s.graphic||s.group||!u||t.stage.camera||(s.group=t),Kc.free(l),s}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};Zg=Kg([Bi(),$g(0,Ei(Yi)),$g(0,Ri(fp)),Xg("design:paramtypes",[Object])],Zg);let qg=!1;const Jg=new vi((t=>{qg||(qg=!0,t(Hd).toSelf().inSingletonScope(),t(Du).to(Hd).inSingletonScope(),t(Nu).toService(Du),t(Gl).toService(yd),Xi(t,Gl))}));let Qg=!1;const tf=new vi((t=>{Qg||(Qg=!0,t(fu).toSelf().inSingletonScope(),t(Wu).to(fu).inSingletonScope(),t(Nu).toService(Wu),t(Od).toSelf(),t(Rd).toSelf(),t($l).toService(Od),t($l).toService(Rd),t($l).toService(yd),Xi(t,$l))}));let ef=!1;const nf=new vi((t=>{ef||(ef=!0,t(Zd).toSelf().inSingletonScope(),t(Qp).toSelf().inSingletonScope(),t(Vu).to(Zd).inSingletonScope(),t(Nu).toService(Vu))}));let sf=!1;const rf=new vi((t=>{sf||(sf=!0,t(ru).toSelf().inSingletonScope(),t(Fu).to(ru).inSingletonScope(),t(Nu).toService(Fu),t(Wl).toService(yd),Xi(t,Wl),t(eg).toSelf().inSingletonScope())}));let af=!1;const of=new vi((t=>{af||(af=!0,t(_u).toSelf().inSingletonScope(),t(Uu).to(_u).inSingletonScope(),t(Nu).toService(Uu),t(Zl).toService(yd),Xi(t,Zl))}));let lf=!1;const hf=new vi((t=>{lf||(lf=!0,t(Yd).toSelf().inSingletonScope(),t(ju).to(Yd).inSingletonScope(),t(Nu).toService(ju),t(Ul).toService(yd),Xi(t,Ul))}));let cf=!1;const df=new vi((t=>{cf||(cf=!0,t(Yu).to(wu).inSingletonScope(),t(Nu).toService(Yu),t(ql).toService(yd),Xi(t,ql))}));let uf=!1;const pf=new vi((t=>{uf||(uf=!0,t(du).toSelf().inSingletonScope(),t(Hu).to(du).inSingletonScope(),t(Nu).toService(Hu),t(Kl).toService(yd),Xi(t,Kl))}));let gf=!1;const ff=new vi((t=>{gf||(gf=!0,t(Gu).to(Pu).inSingletonScope(),t(Nu).toService(Gu),t(Xl).toService(yd),Xi(t,Xl))}));var mf=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},vf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let yf=class extends ld{constructor(){super(),this.numberType=hl,this.builtinContributions=[xu],this.init()}drawShape(t,e,i,n,s){const r=Wr(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=Il(o,l,!0),d=Il(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=Wr(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(),Md(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=Wr(t).richtext;this._draw(t,n,!1,i)}};yf=mf([Bi(),vf("design:paramtypes",[])],yf);let _f=!1;const bf=new vi((t=>{_f||(_f=!0,t(Ku).to(yf).inSingletonScope(),t(Nu).toService(Ku))}));const xf=(t,e)=>(d(Af.warnHandler)&&Af.warnHandler.call(null,t,e),e?it.getInstance().warn(`[VChart warn]: ${t}`,e):it.getInstance().warn(`[VChart warn]: ${t}`)),Sf=(t,e,i)=>{if(!d(Af.errorHandler))throw new Error(t);Af.errorHandler.call(null,t,e)},Af={silent:!1,warnHandler:!1,errorHandler:!1},kf=Mg(),wf=kf&&globalThis?globalThis.document:void 0;function Tf(t){return("desktop-browser"===t||"mobile-browser"===t)&&kf}function Cf(t){return Ef(t)||"mobile-browser"===t}function Ef(t){return t.includes("miniApp")||"lynx"===t||"wx"===t}let Mf=0;function Bf(){return Mf>=9999999&&(Mf=0),Mf++}function Rf(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function Of(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&_(t[0].fields))}const If=(t,e,i)=>(t.fields=e||[],t.fname=i,t),Pf=t=>e=>R(e,t),Lf=t=>{it.getInstance().error(t)},Df=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||Lf("Access path missing open bracket: "+t),o>0&&h(),o=0,n=s+1):s>n?h():n=s+1}return o&&Lf("Access path missing closing bracket: "+t),a&&Lf("Access path missing closing quote: "+t),s>n&&(s+=1,h()),e})(t),s=1===n.length?n[0]:t;return If((i&&i.get||Pf)(n),[s],e||s)},Ff=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(_(t)){const n=t.map((t=>Df(t,e,i)));return t=>n.map((e=>e(t)))}return Df(t,e,i)};Ff("id");const jf=If((function(t){return t}),[],"identity");If((function(){return 0}),[],"zero"),If((function(){return 1}),[],"one"),If((function(){return!0}),[],"true"),If((function(){return!1}),[],"false"),If((function(){return{}}),[],"emptyObject");const Nf=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=>Nf(t,r,s)))))},zf=(t,e)=>u(t)?e:y(t)?e*parseFloat(t)/100:t,Vf=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Hf extends vl{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,Vf.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=>Vf.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 gm=(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"},fm=(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 mm 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=Jr.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=Jr.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||gm(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=fm(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=Jr.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=fm(i,s),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=gm(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=Jr.now()-i>this.config.press.time&&fm(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},ym=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const _m=[0,0,0];let bm=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({},cs),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},us),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},ps),{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 Kc.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&&(Kc.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(Kc.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&&Hl.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&&(Tg(_m,[t,e,i],this.modelMatrix),t=_m[0],e=_m[1],i=_m[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&&(Tg(_m,[t,e,i],this.modelMatrix),t=_m[0],e=_m[1],i=_m[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(Tg(_m,[e,i,n],this.modelMatrix),e=_m[0],i=_m[1],n=_m[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]:Rs.global.measureTextMethod;var i,n;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Rs.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const s=null!==(i=this.fontFamily)&&void 0!==i?i:ps.fontFamily,r=null!==(n=this.fontSize)&&void 0!==n?n:ps.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&&(Tg(_m,[e,i,n],this.modelMatrix),e=_m[0],i=_m[1],n=_m[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=ud(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=dd(this,l,this.dpr),r.strokeStyle=ud(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=ih(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=ih(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=>Kc.free(t))),this.stack.length=0}};bm.env="browser",bm=vm([Bi(),ym("design:paramtypes",[Object,Number])],bm);var xm=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},Sm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Am=class extends Vg{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Rs.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new bm(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 km(t,e){return new vi((i=>{i(Ks).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Xs).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Am.env="browser",Am=xm([Bi(),Sm("design:paramtypes",[Object])],Am);const wm=km(Am,bm);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)},Em=function(t,e){return function(i,n){e(i,n,t)}};let Mm=class extends Zg{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=wr.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 Rm=class{constructor(){this.type="group",this.numberType=nl}contains(t,e,i){return!1}};Rm=Bm([Bi()],Rm);const Om=new vi(((t,e,i,n)=>{Om.__vloaded||(Om.__vloaded=!0,t(dm).to(Rm).inSingletonScope(),t(um).toService(dm),Xi(t,um))}));Om.__vloaded=!1;var Im=Om;const Pm=new vi(((t,e,i,n)=>{i(Mm)||t(Mm).toSelf().inSingletonScope(),i(up)?n(up).toService(Mm):t(up).toService(Mm)}));var Lm,Dm=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},Fm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let jm=Lm=class extends Yg{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Lm.idprefix}_${Lm.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Rs.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:Lm.GenerateCanvasId(),canvasControled:!0};this.canvas=new Am(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 Am({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)}};jm.env="browser",jm.idprefix="visactor_window",jm.prefix_count=0,jm=Lm=Dm([Bi(),Fm("design:paramtypes",[])],jm);const Nm=new vi((t=>{t(jm).toSelf(),t(Mr).toDynamicValue((t=>t.container.get(jm))).whenTargetNamed(jm.env)}));var 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)};class Hm{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 Gm(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 Wm=class extends Gg{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 Hm(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 Gm(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Gm(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}}};Wm=zm([Bi(),Vm("design:paramtypes",[])],Wm);const Um=new vi((t=>{Um.isBrowserBound||(Um.isBrowserBound=!0,t(Wm).toSelf().inSingletonScope(),t(qi).toService(Wm))}));function Ym(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Ym.__loaded||(Ym.__loaded=!0,t.load(Um),t.load(wm),t.load(Nm),e&&function(t){t.load(Im),t.load(Pm)}(t))}Um.isBrowserBound=!1,Ym.__loaded=!1;var Km=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},Xm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$m=function(t,e){return function(i,n){e(i,n,t)}};let Zm=class extends Zg{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 Fg(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}};Zm=Km([Bi(),$m(0,Ei(Yi)),$m(0,Ri(Gf)),$m(1,Ei(Yi)),$m(1,Ri(fp)),Xm("design:paramtypes",[Object,Object])],Zm);const qm=new vi((t=>{qm.__vloaded||(qm.__vloaded=!0,Xi(t,Gf))}));qm.__vloaded=!1;var Jm=qm,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},tv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ev=function(t,e){return function(i,n){e(i,n,t)}};let iv=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=Jo}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=Wr(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}};iv=Qm([Bi(),ev(0,Ei(Du)),tv("design:paramtypes",[Object])],iv);let nv=!1;const sv=new vi(((t,e,i,n)=>{nv||(nv=!0,t(Wf).to(iv).inSingletonScope(),t(Gf).toService(Wf))}));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},av=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ov=function(t,e){return function(i,n){e(i,n,t)}};let lv=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=tl}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=Wr(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}};lv=rv([Bi(),ov(0,Ei(Fu)),av("design:paramtypes",[Object])],lv);let hv=!1;const cv=new vi(((t,e,i,n)=>{hv||(hv=!0,t(Uf).to(lv).inSingletonScope(),t(Gf).toService(Uf))}));var dv=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)},pv=function(t,e){return function(i,n){e(i,n,t)}};let gv=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=el}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=Wr(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}};gv=dv([Bi(),pv(0,Ei(ju)),uv("design:paramtypes",[Object])],gv);let fv=!1;const mv=new vi(((t,e,i,n)=>{fv||(fv=!0,t(Yf).to(gv).inSingletonScope(),t(Gf).toService(Yf))}));var vv=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},yv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_v=function(t,e){return function(i,n){e(i,n,t)}};let bv=class{constructor(t){this.canvasRenderer=t,this.type="glyph",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=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}};bv=vv([Bi(),_v(0,Ei(Xu)),yv("design:paramtypes",[Object])],bv);let xv=!1;const Sv=new vi(((t,e,i,n)=>{xv||(xv=!0,t(tm).to(bv).inSingletonScope(),t(bv).toService(tm))}));var Av=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 kv=class{constructor(){this.type="image",this.numberType=sl}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};kv=Av([Bi()],kv);let wv=!1;const Tv=new vi(((t,e,i,n)=>{wv||(wv=!0,t(Kf).to(kv).inSingletonScope(),t(kv).toService(Kf))}));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},Ev=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mv=function(t,e){return function(i,n){e(i,n,t)}};let Bv=class{constructor(t){this.canvasRenderer=t,this.type="line",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=Wr(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}};Bv=Cv([Bi(),Mv(0,Ei(Vu)),Ev("design:paramtypes",[Object])],Bv);let Rv=!1;const Ov=new vi(((t,e,i,n)=>{Rv||(Rv=!0,t(Xf).to(Bv).inSingletonScope(),t(Gf).toService(Xf))}));var Iv=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},Pv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Lv=function(t,e){return function(i,n){e(i,n,t)}};let Dv=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=ol}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=Wr(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}};Dv=Iv([Bi(),Lv(0,Ei(Gu)),Pv("design:paramtypes",[Object])],Dv);let Fv=!1;const jv=new vi(((t,e,i,n)=>{Fv||(Fv=!0,t(Qf).to(Dv).inSingletonScope(),t(Gf).toService(Qf))}));var 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},zv=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 Hv=class{constructor(t){this.canvasRenderer=t,this.type="path",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=Wr(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}};Hv=Nv([Bi(),Vv(0,Ei(Hu)),zv("design:paramtypes",[Object])],Hv);let Gv=!1;const Wv=new vi(((t,e,i,n)=>{Gv||(Gv=!0,t($f).to(Hv).inSingletonScope(),t(Gf).toService($f))}));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},Yv=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)}};const Xv=new Ht;let $v=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=ll}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=Wr(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;Xv.setValue(i.x1,i.y1,i.x2,i.y2),Xv.expand(-r/2),h=!Xv.containsPoint(e)}}return n.highPerformanceRestore(),h}};$v=Uv([Bi(),Kv(0,Ei(Wu)),Yv("design:paramtypes",[Object])],$v);let Zv=!1;const qv=new vi(((t,e,i,n)=>{Zv||(Zv=!0,t(Zf).to($v).inSingletonScope(),t(Gf).toService(Zf))}));let Jv=!1;const Qv=new vi(((t,e,i,n)=>{Jv||(Jv=!0,t(Kf).to(kv).inSingletonScope(),t(kv).toService(Kf))}));var ty=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},ey=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},iy=function(t,e){return function(i,n){e(i,n,t)}};let ny=class{constructor(t){this.canvasRenderer=t,this.type="symbol",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=Wr(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}};ny=ty([Bi(),iy(0,Ei(Uu)),ey("design:paramtypes",[Object])],ny);let sy=!1;const ry=new vi(((t,e,i,n)=>{sy||(sy=!0,t(qf).to(ny).inSingletonScope(),t(Gf).toService(qf))}));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};let oy=class{constructor(){this.type="text",this.numberType=dl}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};oy=ay([Bi()],oy);let ly=!1;const hy=new vi(((t,e,i,n)=>{ly||(ly=!0,t(Jf).to(oy).inSingletonScope(),t(Gf).toService(Jf))})),cy=new vi(((t,e,i,n)=>{i(Zm)||t(Zm).toSelf().inSingletonScope(),i(up)?n(up).toService(Zm):t(up).toService(Zm)}));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},uy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let py=class extends bm{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(){}};py.env="node",py=dy([Bi(),uy("design:paramtypes",[Object,Number])],py);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},fy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let my=class extends Vg{constructor(t){super(t)}init(){this._context=new py(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};my.env="node",my=gy([Bi(),fy("design:paramtypes",[Object])],my);const vy=km(my,py);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)},by=function(t,e){return function(i,n){e(i,n,t)}};let xy=class extends Yg{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 my(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 my({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){}};xy.env="node",xy=yy([Bi(),by(0,Ei(Ji)),_y("design:paramtypes",[Object])],xy);const Sy=new vi((t=>{t(xy).toSelf(),t(Mr).toDynamicValue((t=>t.container.get(xy))).whenTargetNamed(xy.env)}));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};let ky=class extends Gg{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 Oa.call(t)}}getCancelAnimationFrame(){return t=>{Oa.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};ky=Ay([Bi()],ky);const wy=new vi((t=>{wy.isNodeBound||(wy.isNodeBound=!0,t(ky).toSelf().inSingletonScope(),t(qi).toService(ky))}));function Ty(t){Ty.__loaded||(Ty.__loaded=!0,t.load(wy),t.load(vy),t.load(Sy))}wy.isNodeBound=!1,Ty.__loaded=!1;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 bm{draw(){}createPattern(t,e){return null}};Ey.env="wx",Ey=Cy([Bi()],Ey);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},By=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ry=class extends Vg{constructor(t){super(t)}init(){this._context=new Ey(this,this._dpr)}release(){}};Ry.env="wx",Ry=My([Bi(),By("design:paramtypes",[Object])],Ry);const Oy=km(Ry,Ey);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)},Ly=function(t,e){return function(i,n){e(i,n,t)}};class Dy{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 Fy=class extends Yg{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new Dy}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 Ry(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 Ry({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()}};Fy.env="wx",Fy=Iy([Bi(),Ly(0,Ei(Ji)),Py("design:paramtypes",[Object])],Fy);const jy=new vi((t=>{t(Fy).toSelf(),t(Mr).toDynamicValue((t=>t.container.get(Fy))).whenTargetNamed(Fy.env)}));var Ny=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)},Vy=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 Hy=class extends Gg{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 Vy(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 Oa.call(t)}}getCancelAnimationFrame(){return t=>{Oa.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}};Hy=Ny([Bi(),zy("design:paramtypes",[])],Hy);const Gy=new vi((t=>{Gy._isWxBound||(Gy._isWxBound=!0,t(Hy).toSelf().inSingletonScope(),t(qi).toService(Hy))}));function Wy(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Wy.__loaded||(Wy.__loaded=!0,t.load(Gy),t.load(Oy),t.load(jy),e&&function(t){t.load(Jm),t.load(cy),t.load(sv),t.load(cv),t.load(mv),t.load(Sv),t.load(Tv),t.load(Ov),t.load(jv),t.load(Wv),t.load(qv),t.load(Qv),t.load(ry),t.load(hy)}(t))}Gy._isWxBound=!1,Wy.__loaded=!1;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},Yy=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 Xy=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=Jo}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=Wr(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=dd(n,r+a,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};Xy=Uy([Bi(),Ky(0,Ei(Du)),Yy("design:paramtypes",[Object])],Xy);let $y=!1;const Zy=new vi(((t,e,i,n)=>{$y||($y=!0,t(em).to(Xy).inSingletonScope(),t(um).toService(em))}));var qy=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)},Qy=function(t,e){return function(i,n){e(i,n,t)}};const t_=new Ht;let e_=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=ll}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=Wr(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=dd(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;t_.setValue(i.x1,i.y1,i.x2,i.y2),t_.expand(-r/2),h=!t_.containsPoint(e)}}return n.highPerformanceRestore(),h}};e_=qy([Bi(),Qy(0,Ei(Wu)),Jy("design:paramtypes",[Object])],e_);let i_=!1;const n_=new vi(((t,e,i,n)=>{i_||(i_=!0,t(am).to(e_).inSingletonScope(),t(um).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};let r_=class extends ld{};r_=s_([Bi()],r_);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},o_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},l_=function(t,e){return function(i,n){e(i,n,t)}};let h_=class extends r_{constructor(t){super(),this.canvasRenderer=t,this.type="line",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;n.highPerformanceSave();const s=Wr(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=dd(n,s+r,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&Xc.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};h_=a_([Bi(),l_(0,Ei(Vu)),o_("design:paramtypes",[Object])],h_);let c_=!1;const d_=new vi(((t,e,i,n)=>{c_||(c_=!0,t(sm).to(h_).inSingletonScope(),t(um).toService(sm))}));var u_=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},p_=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 f_=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=tl}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=Wr(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=dd(n,r+a,n.dpr),h=t.isPointInStroke(e.x,e.y),h})),n.highPerformanceRestore(),h}};f_=u_([Bi(),g_(0,Ei(Fu)),p_("design:paramtypes",[Object])],f_);let m_=!1;const v_=new vi(((t,e,i,n)=>{m_||(m_=!0,t(im).to(f_).inSingletonScope(),t(um).toService(im))}));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},__=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 x_=class extends r_{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=cl}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=Wr(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=dd(n,s+r,n.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,n.modelMatrix!==c&&Xc.free(n.modelMatrix),n.modelMatrix=c,n.highPerformanceRestore(),u}};x_=y_([Bi(),b_(0,Ei(Uu)),__("design:paramtypes",[Object])],x_);let S_=!1;const A_=new vi(((t,e,i,n)=>{S_||(S_=!0,t(om).to(x_).inSingletonScope(),t(um).toService(om))}));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},w_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},T_=function(t,e){return function(i,n){e(i,n,t)}};let C_=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=el}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=Wr(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=dd(n,r+a,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};C_=k_([Bi(),T_(0,Ei(ju)),w_("design:paramtypes",[Object])],C_);let E_=!1;const M_=new vi(((t,e,i,n)=>{E_||(E_=!0,t(nm).to(C_).inSingletonScope(),t(um).toService(nm))}));var B_=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},R_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},O_=function(t,e){return function(i,n){e(i,n,t)}};let I_=class extends r_{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=dl}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=Wr(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=sh(a,u,s),v=nh(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&&Xc.free(n.modelMatrix),n.modelMatrix=u,n.highPerformanceRestore(),g}};I_=B_([Bi(),O_(0,Ei(Yu)),R_("design:paramtypes",[Object])],I_);let P_=!1;const L_=new vi(((t,e,i,n)=>{P_||(P_=!0,t(lm).to(I_).inSingletonScope(),t(um).toService(lm))}));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},F_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},j_=function(t,e){return function(i,n){e(i,n,t)}};let N_=class extends r_{constructor(t){super(),this.canvasRenderer=t,this.type="path",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=Wr(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=dd(n,s+r,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&Xc.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};N_=D_([Bi(),j_(0,Ei(Hu)),F_("design:paramtypes",[Object])],N_);let z_=!1;const V_=new vi(((t,e,i,n)=>{z_||(z_=!0,t(rm).to(N_).inSingletonScope(),t(um).toService(rm))}));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},G_=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 U_=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=ol}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=Wr(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=dd(n,r+a,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};U_=H_([Bi(),W_(0,Ei(Gu)),G_("design:paramtypes",[Object])],U_);let Y_=!1;const K_=new vi(((t,e,i,n)=>{Y_||(Y_=!0,t(hm).to(U_).inSingletonScope(),t(um).toService(hm))}));var X_=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},$_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Z_=function(t,e){return function(i,n){e(i,n,t)}};let q_=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=hl}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};q_=X_([Bi(),Z_(0,Ei(Ku)),$_("design:paramtypes",[Object])],q_);let J_=!1;const Q_=new vi(((t,e,i,n)=>{J_||(J_=!0,t(cm).to(q_).inSingletonScope(),t(um).toService(cm))})),tb=Mg();function eb(){eb.__loaded||(eb.__loaded=!0,nd.RegisterGraphicCreator("arc",jc),Ys.load(Jg),Ys.load(tb?Zy:sv))}eb.__loaded=!1;const ib=eb;function nb(){nb.__loaded||(nb.__loaded=!0,nd.RegisterGraphicCreator("area",Lc),Ys.load(rf),Ys.load(tb?v_:cv))}nb.__loaded=!1;const sb=nb;function rb(){rb.__loaded||(rb.__loaded=!0,nd.RegisterGraphicCreator("circle",eh),Ys.load(hf),Ys.load(tb?M_:mv))}rb.__loaded=!1;const ab=rb;function ob(){ob.__loaded||(ob.__loaded=!0,nd.RegisterGraphicCreator("group",yl))}ob.__loaded=!1;const lb=ob;function hb(){hb.__loaded||(hb.__loaded=!0,nd.RegisterGraphicCreator("line",mc),Ys.load(nf),Ys.load(tb?d_:Ov))}hb.__loaded=!1;const cb=hb;function db(){db.__loaded||(db.__loaded=!0,nd.RegisterGraphicCreator("path",Oc),Ys.load(pf),Ys.load(tb?V_:Wv))}db.__loaded=!1;const ub=db;function pb(){pb.__loaded||(pb.__loaded=!0,nd.RegisterGraphicCreator("polygon",Vc),Ys.load(ff),Ys.load(tb?K_:jv))}pb.__loaded=!1;const gb=pb;function fb(){fb.__loaded||(fb.__loaded=!0,nd.RegisterGraphicCreator("rect",_c),Ys.load(tf),Ys.load(tb?n_:qv))}fb.__loaded=!1;const mb=fb;function vb(){vb.__loaded||(vb.__loaded=!0,nd.RegisterGraphicCreator("richtext",Mc),Ys.load(bf),Ys.load(tb?Q_:Qv))}vb.__loaded=!1;const yb=vb;function _b(){_b.__loaded||(_b.__loaded=!0,nd.RegisterGraphicCreator("shadowRoot",Gc))}_b.__loaded=!1;const bb=_b;function xb(){xb.__loaded||(xb.__loaded=!0,nd.RegisterGraphicCreator("symbol",pc),Ys.load(of),Ys.load(tb?A_:ry))}xb.__loaded=!1;const Sb=xb;function Ab(){Ab.__loaded||(Ab.__loaded=!0,nd.RegisterGraphicCreator("text",lh),Ys.load(df),Ys.load(tb?L_:hy))}Ab.__loaded=!1;const kb=Ab;function wb(){lb(),mb()}const Tb=-.5*Math.PI,Cb=1.5*Math.PI,Eb="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 Mb;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(Mb||(Mb={}));const Bb={[Mb.selectedReverse]:{},[Mb.selected]:{},[Mb.hover]:{},[Mb.hoverReverse]:{}},Rb={container:"",width:30,height:30,style:{}},Ob={debounce:gt,throttle:ft};wb();class Ib extends Hf{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},Ib.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"===cg.env?(cg.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),cg.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:Ob[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"===cg.env?(cg.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),cg.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",Ob[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 Pb(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&Pb(t,e)}))}Ib.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 Lb=t=>!u(t)&&!1!==t.visible;const Db=["#ffffff","#000000"];function Fb(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 jb(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(...Db);for(const s of a)if(t!==s&&jb(s,e,i,n,r))return s}(a,o,i,n,s,r)}function jb(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?Nb(t,e)>n:"largeText"===i?Nb(t,e)>3:Nb(t,e)>4.5}function Nb(t,e){const i=zb(t),n=zb(e);return((i>n?i:n)+.05)/((i>n?n:i)+.05)}function zb(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 Vb(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 Hb(t,e){return[t[0]*e,t[1]*e]}function Gb(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 Wb=(t,e,i,n)=>new Be(Object.assign({defaultFontParams:Object.assign({fontFamily:Eb,fontSize:14},n),getTextBounds:i?void 0:ad,specialCharSet:"-/: .,@%'\"~"+Be.ALPHABET_CHAR_SET+Be.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function Ub(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const n=ad({text:t,fontFamily:e.fontFamily||i.fontFamily||Eb,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 Yb(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 Kb(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 Xb(t){const e=Yb(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?nd.richtext(Kb(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)),nd.text(t))}function $b(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 Zb(){lb(),mb(),Sb(),yb(),kb()}var qb=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({},Kb(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=qb(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");B(null==m?void 0:m.panel)||(t.states=m.panel),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=Ub(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=qb(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");B(null==m?void 0:m.panel)||(t.states=m.panel),this._bgRect=t}}this._textShape=R}}Jb.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const Qb={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}},tx={poptip:j({},Qb)};class ex extends Hf{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}lb(),cb();class ix extends ex{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},ix.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})}}ix.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},lb(),mb();class nx extends ex{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},nx.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})}}nx.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};const sx=new Uint32Array(33),rx=new Uint32Array(33);rx[0]=0,sx[0]=~rx[0];for(let t=1;t<=32;++t)rx[t]=rx[t-1]<<1|1,sx[t]=~rx[t];function ax(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]&sx[31&l]&rx[1+(31&h)])return!0}else{if(i[c]&sx[31&l])return!0;if(i[d]&rx[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,sx[31&s]&rx[1+(31&r)]);else for(n(a,sx[31&s]),n(o,rx[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,rx[31&i]|sx[1+(31&n)]);else for(s(r,rx[31&i]),s(a,sx[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 ox(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 lx(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=ox(t,r),!(n&&e.outOfBounds(r)||e.getRange(r))}function hx(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 hx(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 hx(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 hx(t,e,s,n,h,c)}return!1}const dx=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],ux=["top","inside-top","inside"];function px(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 gx={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 fx(t,e){var i,n;return null!==(n=null===(i=gx[e])||void 0===i?void 0:i.call(gx,t))&&void 0!==n?n:{from:{},to:{}}}const mx=(t,e,i,n)=>{const s=Object.assign({},t.attribute),r=Object.assign({},e.attribute);return U(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 vx(t,e,i,n){t.attribute.text!==e.attribute.text&&A(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new Pa({text:t.attribute.text},{text:e.attribute.text},i,n))}const yx={mode:"same-time",duration:300,easing:"linear"};function _x(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 bx(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 xx(t){return 3===t||4===t}function Sx(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 Ax=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)}},kx=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 Tx(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 Cx(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)}}lb(),kb(),yb(),cb();class Ex extends Hf{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},Ex.defaultAttributes,t)),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(Mb.hover,!0),Pb(this,(t=>{t===e||B(t.states)||t.addState(Mb.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(Pb(this,(t=>{B(t.states)||(t.removeState(Mb.hoverReverse),t.removeState(Mb.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void Pb(this,(t=>{B(t.states)||(t.removeState(Mb.selectedReverse),t.removeState(Mb.selected))}));B(e.states)||(e.addState(Mb.selected,!0),Pb(this,(t=>{t===e||B(t.states)||t.addState(Mb.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:[];(this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)]).forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(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[Cx(g,f,c,d,a,o),Cx(-g,-f,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds);if(i){const t=nd.line({points:i});return e&&e.attribute.fill&&t.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&t.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(t),t}}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)),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 Xb(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&&_.setRange(ox(v,t.AABBBounds,!0))}))),f.length>0&&f.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&&_.setRange(ox(v,t.AABBBounds,!0))})):t.AABBBounds&&_.setRange(ox(v,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 i=new Map,n=this._graphicToText||new Map,s=[],r=[],{visible:a}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{const o=this.getRelatedGraphic(t.attribute),l=t.attribute.id,h=this._isCollectionBase?l:o,c=(null==n?void 0:n.get(h))?"update":"enter";let d;if(a&&(d=this._createLabelLine(t,o)),"enter"===c){if(s.push(t),i.set(h,d?{text:t,labelLine:d}:{text:t}),o){const{from:i,to:n}=fx(t.attribute,"fadeIn");this.add(t),d&&(r.push(d),this.add(d)),this._syncStateWithRelatedGraphic(o),this._animationConfig.enter.duration>0&&o.once("animate-bind",(a=>{t.setAttributes(i),d&&d.setAttributes(i);const l=this._afterRelatedGraphicAttributeUpdate(t,s,d,r,e,o,n,this._animationConfig.enter);o.on("afterAttributeUpdate",l)}))}}else if("update"===c){const e=n.get(h);n.delete(h),i.set(h,e);const s=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&&vx(t,e,n,s))}i.forEach(((i,n)=>{const{duration:s,easing:r,increaseEffect:a=!0,channel:o}=i,{from:l,to:h}=mx(t,e,o,i.options);B(h)||t.animate().to(h,s,r),"text"in l&&"text"in h&&a&&vx(t,e,s,r)}))})(s,t,this._animationConfig.update),e.labelLine&&d&&e.labelLine.animate().to(d.attribute,r,a)}})),n.forEach((t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(fx(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=i}_renderWithOutAnimation(t){var e;const i=new Map,n=this._graphicToText||new Map,{visible:s}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach((t=>{const e=this.getRelatedGraphic(t.attribute),r=(null==n?void 0:n.get(e))?"update":"enter",a=this._isCollectionBase?t.attribute.id:e;let o;if(s&&(o=this._createLabelLine(t,e)),"enter"===r)i.set(a,o?{text:t,labelLine:o}:{text:t}),this.add(t),o&&this.add(o),this._syncStateWithRelatedGraphic(e);else if("update"===r){const e=n.get(a);n.delete(a),i.set(a,e),e.text.setAttributes(t.attribute),e.labelLine&&o&&e.labelLine.setAttributes(o.attribute)}})),n.forEach((t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)})),this._graphicToText=i}_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)}}Mx.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};class Bx extends Ex{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},Bx.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}}}Bx.tag="rect-label",Bx.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};let Rx=class t extends Ex{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 Tx(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};Rx.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class Ox{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 Ix extends Ex{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},Ix.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:"…"}),s=this._createLabelText(n),r=this.getGraphicBounds(s),a=r.x2-r.x1,o=e.map((t=>t.attribute)),l=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),o,i,a);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=bx(l.endAngle-d/2),p=_x(h.x,h.y,l.outerRadius,o),g=_x(h.x,h.y,a+e.line.line1MinLength,o),f=new Ox(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);f.pointA=_x(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):xx(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=_x(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=xx(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=xx(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=xx(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?xx(t.quadrant)?"left":"right":xx(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*(xx(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;e1&&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 Tx(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}Px.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class Lx extends Ex{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},Lx.defaultAttributes,t)),this.name="line-data-label"}labeling(t,e){return Ax(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}Lx.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const Dx={rect:Bx,symbol:Mx,arc:Ix,line:Rx,area:Px,"line-data":Lx};class Fx extends Hf{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},Fx.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=ax(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()}))}}Fx.defaultAttributes={pickable:!1},lb(),cb(),gb(),Sb();class jx extends Hf{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({},jx.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=nd.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=nd.line;U(i)[0].cornerRadius&&(t=nd.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},U(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=nd.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 Nx,zx;jx.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"}(Nx||(Nx={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(zx||(zx={}));const Vx={[zx.selectedReverse]:{},[zx.selected]:{},[zx.hover]:{},[zx.hoverReverse]:{}},Hx={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}}},Gx=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 Wx(t,e,i){return!lt(t,e,0,1e-6)&&!ot(t,i,0,1e-6)}function Ux(t,e,i,n){const s=ad(Object.assign({text:i},n)),r=s.width(),a=s.height(),o=Gx(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=Wx(o,-l,-h)?((o+l)/c-.5)*r:Wx(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=Wx(o,-l,-h)?.5*-a:Wx(o,h,l)?.5*a:Math.cos(o)>=0?(.5-(h-o)/c)*a:(.5-Gx(o-l)/c)*a,{x:p,y:g-f}}function Yx(t){const e={};return Pb(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function Kx(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function Xx(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 Hb(r,(n?-1:1)*(s?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}class $x extends Hf{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(Mb.hover,!0),Pb(e,(t=>{t!==n&&t.name&&!B(t.states)&&t.addState(Mb.hoverReverse,!0)})),n):i})(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=((t,e,i)=>i?(Pb(e,(t=>{t.name&&!B(t.states)&&(t.removeState(Mb.hoverReverse),t.removeState(Mb.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(Mb.selected)?(Pb(e,(t=>{t.name&&!B(t.states)&&(t.removeState(Mb.selectedReverse),t.removeState(Mb.selected))})),null):n.name&&!B(n.states)?(n.addState(Mb.selected,!0),Pb(e,(t=>{t!==n&&t.name&&!B(t.states)&&t.addState(Mb.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=nd.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&&Yx(this._innerView),this.removeAllChild(!0),this._innerView=nd.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=nd.group({x:0,y:0,zIndex:1});if(a.name=Nx.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=nd.group({x:0,y:0,pickable:!1});t.name=Nx.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=nd.group({x:0,y:0,pickable:!1});i.name=Nx.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,n)=>{var s;const r=nd.line(Object.assign({},this._getTickLineAttribute("tick",t,n,e)));if(r.name=Nx.tick,r.id=this._getNodeId(t.id),B(null===(s=this.attribute.tick)||void 0===s?void 0:s.state))r.states=Bb;else{const t=this.data[n],e=j({},Bb,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=nd.line(Object.assign({},this._getTickLineAttribute("subTick",t,s,e)));if(r.name=Nx.subTick,r.id=this._getNodeId(`${s}`),B(n.state))r.states=Bb;else{const i=j({},Bb,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=nd.group({x:0,y:0,pickable:!1});return r.name=`${Nx.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),s.forEach(((t,e)=>{var n;const a=Xb(this._getLabelAttribute(t,e,s,i));if(a.name=Nx.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=Bb;else{const n=j({},Bb,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 Jb(Object.assign({},e));i.name=Nx.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return Kx(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({},Hx.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 Zx(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 qx(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 Jx={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&&Qx(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function Qx(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 tS(t,e){for(let i,n=1,s=t.length,r=t[0];n1&&e.height()>1}function iS(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},rS(t,e.attribute.angle)),{angle:sS(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({},aS(t,e.attribute.angle)),{angle:sS(e.attribute.angle)}))}))}(t,e),Zx(e)}function sS(){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 rS(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=sS(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 aS(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=sS(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 oS{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 Hb([n[1],-1*n[0]],t*(e?1:-1)*i)}}function lS(){lb(),cb(),yb(),kb()}var hS=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=Gb(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({},Vx,c.text),shape:j({},Vx,c.shape),panel:j({},Vx,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 rS(e?"bottom"===n?"top":"bottom":n,i);if("left"===n||"right"===n)return aS(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)})),nS(i,t),!iS(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(eS);if(B(i))return;let n;n=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i),Zx(n);const{method:s="parity",separation:r=0}=e,a=d(s)?s:Jx[s]||Jx.parity;if(n.length>=3&&tS(n,r)){do{n=a(n,r)}while(n.length>=3&&tS(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&&Qx(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=nd.rect({x:e,y:n,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=Nx.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=Ub(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}}cS.defaultAttributes=Hx,W(cS,oS);class dS{isInValidValue(t){const{startAngle:e=Tb,endAngle:i=Cb}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=Tb,endAngle:i=Cb,center:n,radius:s,inside:r=!1,innerRadius:a=0}=this.attribute;return Ut(n,r&&a>0?a:s,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Xx(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 uS,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);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=nd.circle(c);d.name=Nx.line,d.id=this._getNodeId("line"),B(a.state)||(d.states=j({},Vx,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=pS(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({},Vx,d.text),shape:j({},Vx,d.shape),panel:j({},Vx,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 Ux(t,e,i,n)}}gS.defaultAttributes=Hx,W(gS,dS);class fS extends da{constructor(){super(...arguments),this.mode=bn.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},Pb(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{vS[t]=!0}));const SS=t=>-Math.log(-t),AS=t=>-Math.exp(-t),kS=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,wS=t=>10===t?kS:t===Math.E?Math.exp:e=>Math.pow(t,e),TS=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),CS=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),ES=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function MS(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 BS(t,e,i){const n=t[0],s=t[1],r=e[0],a=e[1];let o,l;return sl(o(t))}function RS(t,e,i){let n;return n=1===t?t+2*i:t-e+2*i,t?n>0?n:1:0}function OS(t,e,i,n){return 1===i&&(i=0),RS(t,i,n)*(e/(1-i))}function IS(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),n=t[0]-i*e[0];return[n,i+n]}function PS(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 FS{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=IS(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 jS=Symbol("implicit");class NS extends FS{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=uS.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=jS}clone(){const t=(new NS).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!==jS)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 VS extends NS{constructor(t){super(),this.type=uS.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=OS(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:zS(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 zS(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 VS(!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:HS}=le;function GS(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=HS(re.parseColorString(t),n);return t=>e(t).formatRgb()}return mt(Number(t),Number(e))}return e instanceof ae?HS(t,e):e instanceof re?HS(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 WS extends FS{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:xS,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:xS;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=xS,this._piecewise=BS,this._interpolate=GS}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?PS:BS,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:xS),this.rescale(i)):this._clamp!==xS}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 US=Math.sqrt(50),YS=Math.sqrt(10),KS=Math.sqrt(2),XS=[1,2,5,10],$S=(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=QS(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?qS(0,-(e-1)/n,n):qS((e-1)/n,0,n)},ZS=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 $S(t,i,null==n?void 0:n.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return $S(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=qS(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=qS(t,e,l);return s&&r.reverse(),r})),QS=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let n=XS[0];return i>=US?n=XS[3]:i>=YS?n=XS[2]:i>=KS&&(n=XS[1]),e>=0?{step:n*10**e,gap:n,power:e}:{step:-(10**-e)/n,gap:n,power:e}};function tA(t,e,i){const n=(e-t)/Math.max(0,i);return QS(n)}function eA(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=tA(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 nA(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 sA=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),rA=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})),aA=ht(((t,e,i,n,s,r)=>{const a=[],o={},l=s(t),h=s(e);let c=[];if(Number.isInteger(n))c=JS(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const s=r(i),l=Number.isInteger(n)?sA(t,e,s):sA(t,e,DS(s)),h=sA(t,e,((t,e)=>{let i,n;return e[0]1&&(o[h]=1,a.push(h))})),a})),oA=ht(((t,e,i,n,s)=>eA(n(t),n(e),i).map((t=>DS(s(t))))));class lA extends WS{constructor(){super(...arguments),this.type=uS.Linear}clone(){return(new lA).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 ZS(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=JS(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 eA(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=nA(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=iA(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=iA(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=iA(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function hA(t){return e=>-t(-e)}function cA(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class dA extends WS{constructor(){super(TS(10),wS(10)),this.type=uS.Log,this._limit=cA(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new dA).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=TS(this._base),n=wS(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=hA(i),this._pows=hA(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=SS,this.untransformer=AS):(this._logs=i,this._pows=n,this._limit=cA(),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 xS}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 rA(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 aA(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 oA(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return oA(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=nA(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=LS(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 uA extends lA{constructor(){super(CS(1),ES(1)),this.type=uS.Symlog,this._const=1}clone(){return(new uA).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=CS(t),this.untransformer=ES(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 rA(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 aA(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 oA(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return oA(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=nA(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=LS(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 pA{constructor(){this.type=uS.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 pA).domain(this._domain).range(this._range).unknown(this._unknown)}}const gA=t=>t.map(((t,e)=>({index:e,value:t}))),fA=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 mA(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function vA(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=Wb(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=yA(S,_,f[0],f[f.length-1]):a&&c&&n===e.length-1?T=yA(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=yA(A,b,f[0],f[f.length-1]):a&&d&&n===e.length-1?C=yA(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},bA=(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=Wb(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=Ut({x:0,y:0},i,t),l=Kx(o,Xx(n,o,e,s));return Ux(l,Xx(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},xA={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,n)=>!(n&&mA(i.AABBBounds,t.AABBBounds,e)||(i=t,0))))}},SA=(t,e,i,n)=>_A(t,e,i).map((t=>n?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),AA=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},kA=(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&&!AA(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?kA(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&&fA(e[0],e[i]);)r++,i-=s}return{step:s,delCount:r}},CA=(t,e)=>{if(yS(t.type))return((t,e)=>{if(!yS(t.type))return gA(t.domain());const i=t.range(),n=Math.abs(i[i.length-1]-i[0]);if(n<2)return gA([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=_A(t,h,e).map(((t,e)=>({AABBBounds:t,value:h[e]})));for(;s.length>=3&&vA(s,i);)s=xA.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 gA(h)})(t,e);if(bS(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?gA([n[n.length-1]]):gA([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=SA(t,n,e,c),l=Math.min(...s.map((t=>t[2]))),h=wA(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=SA(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 gA(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=bA(t,i,e),r=X(n),l=K(n),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=TA(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 gA(c)})(t,e)}return gA(t.domain())};function EA(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 MA(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 BA(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=EA(t,!!s),o=EA(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=MA(e,t,!1,!!s),o=MA(e,r,!0,!!s)}else"line"!==n&&"polygon"!==n||(a=EA(t,!!s),o=EA(r,!!s));return s?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class RA extends Hf{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&Yx(this._innerView),this.removeAllChild(!0),this._innerView=nd.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 Kx(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?`${Nx.grid}-sub`:`${Nx.grid}`;if(s.forEach(((t,i)=>{const{id:s,points:o}=t;let c="";if("line"===n||"polygon"===n)c=EA(o,!!a);else if("circle"===n){const{center:t}=this.attribute;c=MA(t,o,!1,!!a)}const u=nd.path(Object.assign({path:c,z:l},d(r)?j({},this.skipDefault?null:RA.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=EA(o,!!a),m=wt(o[0].x-o[1].x),v=wt(o[0].y-o[1].y),y=nd.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:RA.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})}}W(OA,oS);var IA=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 LA(){lb(),Sb(),kb()}W(PA,dS);const DA={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};LA();class FA extends Hf{getCurrent(){return this._current}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},FA.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(GA.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(GA.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===GA.focus||"focus"===o){const n=a.hasState(VA.focus);a.toggleState(VA.focus),n?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[VA.unSelected,VA.unSelectedHover,VA.focus],t),this._setLegendItemState(e,VA.selected,t)})):(this._setLegendItemState(a,VA.selected,t),this._removeLegendItemState(a,[VA.unSelected,VA.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[VA.selected,VA.selectedHover,VA.focus],t),this._setLegendItemState(e,VA.unSelected,t))})))}else{null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((t=>{t.removeState(VA.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(VA.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(HA.legendItemClick,a,t);i?(this._removeLegendItemState(a,[VA.selected,VA.selectedHover],t),this._setLegendItemState(a,VA.unSelected,t)):(this._setLegendItemState(a,VA.selected,t),this._removeLegendItemState(a,[VA.unSelected,VA.unSelectedHover],t))}else this._setLegendItemState(a,VA.selected,t),this._removeLegendItemState(a,[VA.unSelected,VA.unSelectedHover],t),null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[VA.selected,VA.selectedHover],t),this._setLegendItemState(e,VA.unSelected,t))}))}this._dispatchLegendEvent(HA.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,VA.selected),this._removeLegendItemState(e,[VA.unSelected,VA.unSelectedHover])):(this._removeLegendItemState(e,[VA.selected,VA.selectedHover]),this._setLegendItemState(e,VA.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=jA,spaceRow:h=NA}=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;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):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=nd.group({x:0,y:0,cursor:null===(s=w.style)||void 0===s?void 0:s.cursor}),this._appendDataToShape(C,GA.item,t,C)):(C=nd.group(Object.assign({x:0,y:0},w.style)),this._appendDataToShape(C,GA.item,t,C,w.state)),C.id=`${null!=a?a:o}-${i}`,C.addState(e?VA.selected:VA.unSelected);const E=nd.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=nd.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,GA.itemShape,t,C,S.state),n.addState(e?VA.selected:VA.unSelected),E.add(n)}let P=0;if(d){const e=R(g,"size",10);M=nd.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},g),{visible:!0,pickMode:"imprecise",boundsPadding:T})),this._appendDataToShape(M,GA.focus,t,C),P=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=Xb(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,GA.itemLabel,t,C,A.state),D.addState(e?VA.selected:VA.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=Xb(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,GA.itemValue,t,C,k.state),r.addState(e?VA.selected:VA.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 FA(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 FA(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 Ib(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:12},t),{width:e})):new Ib(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=nd.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=jA,spaceRow:a=NA}=n,o=this._itemsContainer,{space:l=zA,defaultCurrent:h=1}=s,c=UA(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=nd.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(VA.selected)?this._setLegendItemState(t,VA.selectedHover,e):this._setLegendItemState(t,VA.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===GA.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(HA.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(VA.unSelectedHover)||t.hasState(VA.selectedHover))&&(i=!0),t.removeState(VA.unSelectedHover),t.removeState(VA.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(VA.unSelectedHover)&&!t.hasState(VA.selectedHover)||(i=!0),t.removeState(VA.unSelectedHover),t.removeState(VA.selectedHover)}));const n=t.getChildren()[0].find((t=>t.name===GA.focus),!1);n&&n.setAttribute("visible",!1),i&&this._dispatchLegendEvent(HA.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(HA.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!==GA.focus&&(n||t.hasState(e)||(n=!0),t.addState(e,!0))})),n&&this._dispatchLegendEvent(HA.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!==GA.focus&&e.forEach((e=>{!n&&t.hasState(e)&&(n=!0),t.removeState(e)}))})),n&&this._dispatchLegendEvent(HA.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(VA.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({},YA,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(VA.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}};KA.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:jA,spaceRow:NA,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:zA,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0};const XA=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)})},$A=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:U(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}},ZA={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:Eb,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:Eb,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:Eb,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},qA=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];lb(),mb(),Sb(),kb(),yb();let JA=class t extends Hf{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:Lb(u)&&Lb(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:Lb(u)&&Lb(u.value)},$A(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:Lb(u)&&Lb(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:Lb(u)&&Lb(u.value)},$A(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},Rb),u.value),visible:Lb(u)&&Lb(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=Lb(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=Lb(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(!Lb(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)+(Lb(s.key)?r+s.key.spacing:0)+(Lb(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&&($b(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:Lb(s.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),$b(c,f,t,u,a),f.setAttribute("y",0)}e+=s.height+s.spaceRow}))}}_createShape(t,e,i,n){var s;if(Lb(e.shape))return i.createOrUpdateChild(`${n}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(s=Ia(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(Lb(t.key)){let s;return s=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},$A(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},$A(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},Rb),t.key)},"richtext"),s}}_createValue(t,e,i){var n;if(Lb(t.value)){let s;return s=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},$A(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},$A(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=>qA.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)&&Lb(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=Lb(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",y=Wb(u),_=Wb(p);let b=0;if(Lb(u)){const{width:t,height:e}=y.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(Lb(p)){const{width:t,height:e}=_.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}m&&lc[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 XA({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return XA({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};function QA(t,e){const i=tk(t),n=tk(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 tk(t,e={x:0,y:0}){return Nt.distancePP(t,e)}function ek(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}JA.defaultAttributes=ZA;const ik=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var sk,rk;!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"}(sk||(sk={})),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.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(rk||(rk={}));const ak="__VCHART",ok=500,lk=500,hk=`${ak}_LABEL_LIMIT`,ck=`${ak}_LABEL_ALIGN`,dk=`${ak}_LABEL_TEXT`,uk=`${ak}_LABEL_VISIBLE`,pk=`${ak}_LABEL_X`,gk=`${ak}_LABEL_Y`,fk=`${ak}_ARC_TRANSFORM_VALUE`,mk=`${ak}_ARC_RATIO`,vk=`${ak}_ARC_START_ANGLE`,yk=`${ak}_ARC_END_ANGLE`,_k=`${ak}_ARC_K`,bk=`${ak}_ARC_MIDDLE_ANGLE`,xk=`${ak}_ARC_QUADRANT`,Sk=`${ak}_ARC_RADIAN`,Ak=-Math.PI/2,kk=3*Math.PI/2;var wk,Tk,Ck,Ek,Mk,Bk,Rk,Ok,Ik,Pk,Lk,Dk,Fk,jk,Nk;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(wk||(wk={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(Tk||(Tk={})),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"}(Ck||(Ck={})),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"}(Ek||(Ek={})),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"}(Mk||(Mk={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(Bk||(Bk={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(Rk||(Rk={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(Ok||(Ok={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(Ik||(Ik={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(Pk||(Pk={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(Lk||(Lk={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(Dk||(Dk={})),t.VGRAMMAR_HOOK_EVENT=void 0,(Fk=t.VGRAMMAR_HOOK_EVENT||(t.VGRAMMAR_HOOK_EVENT={})).BEFORE_EVALUATE_DATA="beforeEvaluateData",Fk.AFTER_EVALUATE_DATA="afterEvaluateData",Fk.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",Fk.AFTER_EVALUATE_SCALE="afterEvaluateScale",Fk.BEFORE_PARSE_VIEW="beforeParseView",Fk.AFTER_PARSE_VIEW="afterParseView",Fk.BEFORE_TRANSFORM="beforeTransform",Fk.AFTER_TRANSFORM="afterTransform",Fk.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",Fk.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",Fk.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",Fk.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",Fk.BEFORE_STAGE_RESIZE="beforeStageResize",Fk.AFTER_STAGE_RESIZE="afterStageResize",Fk.BEFORE_VRENDER_DRAW="beforeVRenderDraw",Fk.AFTER_VRENDER_DRAW="afterVRenderDraw",Fk.BEFORE_MARK_JOIN="beforeMarkJoin",Fk.AFTER_MARK_JOIN="afterMarkJoin",Fk.BEFORE_MARK_UPDATE="beforeMarkUpdate",Fk.AFTER_MARK_UPDATE="afterMarkUpdate",Fk.BEFORE_MARK_STATE="beforeMarkState",Fk.AFTER_MARK_STATE="afterMarkState",Fk.BEFORE_MARK_ENCODE="beforeMarkEncode",Fk.AFTER_MARK_ENCODE="afterMarkEncode",Fk.BEFORE_DO_LAYOUT="beforeDoLayout",Fk.AFTER_DO_LAYOUT="afterDoLayout",Fk.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",Fk.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",Fk.BEFORE_DO_RENDER="beforeDoRender",Fk.AFTER_DO_RENDER="afterDoRender",Fk.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",Fk.AFTER_MARK_RENDER_END="afterMarkRenderEnd",Fk.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",Fk.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",Fk.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",Fk.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",Fk.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",Fk.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",Fk.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",Fk.BEFORE_ELEMENT_STATE="beforeElementState",Fk.AFTER_ELEMENT_STATE="afterElementState",Fk.BEFORE_ELEMENT_ENCODE="beforeElementEncode",Fk.AFTER_ELEMENT_ENCODE="afterElementEncode",Fk.ANIMATION_START="animationStart",Fk.ANIMATION_END="animationEnd",Fk.ELEMENT_ANIMATION_START="elementAnimationStart",Fk.ELEMENT_ANIMATION_END="elementAnimationEnd",Fk.ALL_ANIMATION_START="allAnimationStart",Fk.ALL_ANIMATION_END="allAnimationEnd",function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(jk||(jk={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(Nk||(Nk={}));const zk="__vgrammar_scene_item__",Vk=[Ck.line,Ck.area],Hk=[Ck.arc3d,Ck.rect3d,Ck.pyramid3d],Gk="key",Wk=[{}],Uk=["key"],Yk=!0,Kk=!0,Xk=!1,$k=!0,Zk="VGRAMMAR_IMMEDIATE_ANIMATION",qk=0,Jk=1e3,Qk=0,tw=0,ew=!1,iw=!1,nw="quintInOut",sw={stopWhenStateChange:!1,immediatelyApply:!0};function rw(t,e){return U(t).reduce(((t,i)=>{const n=y(i)?e.getGrammarById(i):i;return n&&t.push(n),t}),[])}function aw(t,e){if(u(t))return[];if(!d(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(y(i))return U(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 rw(t.dependency,e);var i;return[]}function ow(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function lw(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 hw(t,e){return cw(t)?t.output():e[t]}const cw=t=>t&&!u(t.grammarType),dw=t=>d(t)?t:e=>e[t];function uw(t){return!!(null==t?void 0:t.scale)}function pw(t){return!!(null==t?void 0:t.field)}function gw(t,e){if(!t)return[];let i=[];return t.scale&&(i=cw(t.scale)?[t.scale]:U(e.getScaleById(t.scale))),i.concat(aw(t,e))}function fw(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 mw(t,e,i,n,s){i&&(ow(i)?e.forEach((e=>{const s=lw(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 Ck.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case Ck.group:case Ck.rect:case Ck.image:return["width","height","y1"].includes(e);case Ck.path:case Ck.shape:return["path","customPath"].includes(e);case Ck.line:return"defined"===e;case Ck.area:return["x1","y1","defined"].includes(e);case Ck.rule:return["x1","y1"].includes(e);case Ck.symbol:return"size"===e;case Ck.polygon:return"points"===e;case Ck.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(uw(l)){const t=hw(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?Ff(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(pw(l)){const t=Ff(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=lw(l,n,e.datum,t)}))})))}function vw(t,e,i,n){if(!t)return null;if(ow(t))return lw(t,n,e,i);const s={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(uw(h)){const t=hw(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?Ff(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(pw(h)){const t=Ff(h.field);s[r]=t(e)}else s[r]=lw(h,n,e,i)})),s}class yw{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=U(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}let _w=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]}};_w._plotMarks={},_w._marks={},_w._components={},_w._graphicComponents={},_w._transforms={},_w._grammars={},_w._glyphs={},_w._animations={},_w._interactions={},_w._graphics={},_w.registerGlyph=(t,e,i,n,s)=>(_w._glyphs[t]=new yw(e,i,n,s),_w._glyphs[t]),_w.registerAnimationType=(t,e)=>{_w._animations[t]=e},_w.getAnimationType=t=>_w._animations[t],_w.registerInteraction=(t,e)=>{_w._interactions[t]=e},_w.registerGraphic=(t,e)=>{_w._graphics[t]=e},_w.getGraphicType=t=>_w._graphics[t],_w.createGraphic=(t,e)=>{const i=_w._graphics[t];return i?i(e):null};const bw=t=>!!Ck[t];function xw(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var n;const s=_w.getGraphicType(e)?_w.createGraphic(e,i):_w.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 Sw=t=>{t&&(t[zk]=null,t.release(),t.parent&&t.parent.removeChild(t))},Aw=["fillOpacity"],kw=(t,e,i)=>{var n;return"fillOpacity"===e?(t.fillOpacity=null!==(n=i.fillOpacity)&&void 0!==n?n:1,["fillOpacity"]):[]};const ww={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"}],[Ck.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"}],[Ck.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"}],[Ck.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 Tw=(t,e,i,n)=>{const s={},r=e?Object.keys(e):[],a=y(t)?ww[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||(Aw.includes(r)?kw(s,r,e):s[r]=e[r])}))}else r.forEach((t=>{Aw.includes(t)?kw(s,t,e):s[t]=e[t]}));return s},Cw=(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),Ew=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],Mw=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(Ew);function Bw(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)?Mw:Ew,r=[];let a=null;return t.forEach(((t,e)=>{a&&s.every((e=>Cw(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=Rw(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function Rw(t){const e={};return t?(Object.keys(t).forEach((i=>{"x"!==i&&"y"!==i&&"x1"!==i&&"y1"!==i&&"defined"!==i&&"size"!==i&&"width"!==i&&"height"!==i&&"context"!==i&&(e[i]=t[i])})),e):e}let Ow=class{constructor(t){this.data=null,this.states=[],this.diffState=Tk.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:{}})));mw(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?Tw(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[zk]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?Tw(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t)))}updateGraphicItem(){if(!this.graphicItem)return;this.diffState===Tk.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&&(Sw(this.graphicItem),this.graphicItem[zk]=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=dw(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=U(lw(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===Tk.unChange&&(this.diffState=Tk.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&(this.mark.isCollectionMark()&&delete t.defined,Object.assign(e,t)),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==Tk.enter&&this.diffState!==Tk.update||!this.states.length||this.useStates(this.states),this.mark.markType===Ck.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 as))}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[wk.update],a=e[wk.enter],o=e[wk.exit],l=this.mark.isLargeMode()||s&&!this.mark.getSpec().enableSegments;this.diffState===Tk.enter?(a&&mw(this,t,a,n,l),r&&mw(this,t,r,n,l)):this.diffState===Tk.update?((s&&a||i)&&mw(this,t,a,n,l),r&&mw(this,t,r,n,l)):this.diffState===Tk.exit&&o&&(i&&mw(this,t,a,n,l),mw(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=U(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=U(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)Nf(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[Ck.line,Ck.area,Ck.largeRects,Ck.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(n=l.nextAttrs)||void 0===n?void 0:n.points)&&(!0===i||fw(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[wk.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=Rw(h),e===Ck.line||e===Ck.area){const i=function(t,e,i,n){return t&&t.length&&(1!==t.length||e)?t.some((t=>fw(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===Ck.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=Bw(e.items,e.points,i);if(n)return void n.forEach((e=>{t.push(e)}))}const s=Rw(e.items[0]);s.points=e.points,t.push(s)})),t}return n?Bw(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=vw(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=Bw(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t)}else h.points=i,h.segments=null}else e===Ck.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===Ck.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}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&&(Sw(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 Iw{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(),U(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 Pw=(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 Lw extends Iw{constructor(t,e){super(t,e),this.type=Lw.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({},Lw.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=Pw(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=U(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()}}Lw.type="element-select",Lw.defaultOptions={state:Nk.selected,trigger:"click"};class Dw extends Iw{constructor(t,e){super(t,e),this.type=Dw.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},Dw.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=Pw(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()}}Dw.type="element-highlight",Dw.defaultOptions={highlightState:Nk.highlight,blurState:Nk.blur,trigger:"pointerover",triggerOff:"pointerout"};class Fw{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 jw=()=>{W(Lw,Fw),_w.registerInteraction(Lw.type,Lw)},Nw=()=>{W(Dw,Fw),_w.registerInteraction(Dw.type,Dw)},zw=(t,e)=>cw(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,Vw=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,n)=>{const s=t[n];return i[n]=zw(s,e),i}),{}):t.map((t=>zw(t,e))):t;let Hw=-1;class Gw extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++Hw}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=U(this.spec.dependency).map((t=>y(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=U(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 U(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 U(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(aw(this.spec[e],this.view)),this.spec[e]=t,this.attach(aw(t,this.view)),this.commit(),this}}const Ww=(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=aw(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}},Uw=(t,e)=>{const i=_w.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(rw(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(_(e)){const n=e.map((e=>Ww(t,e,i)));return{references:n.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:n.map((t=>t.value))}}return Ww(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}},Yw=(t,e)=>{if(null==t?void 0:t.length){const i=[];let n=[];return t.forEach((t=>{var s;const r=Uw(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},Kw={csv:li,dsv:oi,tsv:hi,json:function(t){if(!y(t))return U(t);try{return U(JSON.parse(t))}catch(t){return[]}}};class Xw extends Gw{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||!Kw[e.type])return U(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return Kw[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?aw(t.format,this.view)[0]:null;if(n&&e.push(n),t.values){const n=aw(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=aw(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=[];U(t.source).forEach((t=>{const i=cw(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=U(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=Yw(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=Yw(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(U(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=U(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 $w="window",Zw="view",qw={trap:!1},Jw="width",Qw="height",tT="viewWidth",eT="viewHeight",iT="padding",nT="viewBox",sT="autoFit";function rT(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 aT(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,rT(t,e,s,n)}class oT{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 rT(this.nodes,e,0,this.compare),aT(this.nodes,e,null,this.compare)}return this.nodes.push(t),rT(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)),rT(this.nodes,e,0,this.compare),aT(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,aT(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class lT{constructor(t){this.list=[],this.ids={},this.idFunc=t||jf}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 hT{constructor(){this.grammars=[],this.logger=it.getInstance(),this._curRank=0,this._committed=new lT((t=>t.uid)),this._heap=new oT(((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 lT((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 cT=(t,e,i,n,s)=>{const r=t=>{if(s||!t||n&&!n(t)||i.call(null,t),t.markType===Ck.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}s&&(!t||n&&!n(t)||i.call(null,t))};r(t)};class dT{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 Go(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Rs.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 Og(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 pm(o)),null===(r=this._eventConfig)||void 0===r?void 0:r.gesture){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new mm(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 uT(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 pT(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 gT(t,e,i,n,s){if(s===$w){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{pT(t,uT(t),!1)}))}));const e=uT(t);pT(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e}class fT extends Gw{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?lw(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}},_T=(t,e)=>e&&e.debounce?gt(t,e.debounce):e&&e.throttle?ft(t,e.throttle):t;class bT extends Ow{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 mw(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[zk]=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?Tw(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);this.graphicItem||this.initGraphicItem(),this.diffState===Tk.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==Tk.enter&&this.diffState!==Tk.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.diffState===Tk.enter&&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=Tw(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=ww[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===Ck.shape&&(o.datum=d[0].datum)})),n}}_generateGlyphItems(t,e,i){const n=e.map((t=>Object.assign({},t,{nextAttrs:i})));return Vk.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)Nf(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[zk]=null})),this.glyphGraphicItems=null),super.release()}}const xT=t=>t.markType===Ck.glyph?new bT(t):new Ow(t);function ST(t,e,i){const n=new Map;if(!t||0===t.length)return{keys:[],data:n};if(!e)return n.set(Gk,i?t.slice().sort(i):t.slice()),{keys:Uk,data:n};const s=dw(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 AT{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?ST(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 kT=(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=fw(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=fw(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 wT=(t,e,i,n,s)=>d(i)?i(t.getDatum(),t,s):i;class TT extends da{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 CT extends da{getEndProps(){return this.to}onBind(){var t;const e=null!==(t=this.target.constructor.NOWORK_ANIMATE_ATTR)&&void 0!==t?t:Ro,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)}}pa.mode|=bn.SET_ATTR_IMMEDIATELY;let ET=0;const MT=t=>!u(t)&&(t.prototype instanceof da||"onBind"in t.prototype&&"onStart"in t.prototype&&"onEnd"in t.prototype&&"onUpdate"in t.prototype);class BT{constructor(t,e,i){this.id=ET++,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||!_w.getAnimationType(e.type))return null;const r=_w.getAnimationType(e.type)(t,s,i);return kT(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?wT(t,0,s[i].from,0,n):void 0,e.to[i]=l?wT(t,0,s[i].to,0,n):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),kT(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=MT(o);return u(o)||MT(o)?h?new o(r.from,r.to,a,t.easing,l):r.to?new CT(r.from,r.to,a,t.easing):void 0:new TT(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 ja(a,e))}r>0&&t.wait(r)}}function RT(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(OT(i,t[i]))})),e}function OT(t,e){const i=[];let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return U(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:qk,totalTime:h.totalTime,oneByOne:null!==(i=h.oneByOne)&&void 0!==i?i:iw,loop:null!==(n=h.loop)&&void 0!==n?n:ew,controlOptions:j({},sw,null!==(s=h.controlOptions)&&void 0!==s?s:{}),timeSlices:[{duration:null!==(r=h.duration)&&void 0!==r?r:Jk,delay:null!==(a=h.delay)&&void 0!==a?a:Qk,delayAfter:null!==(o=h.delayAfter)&&void 0!==o?o:tw,effects:[{type:h.type,channel:h.channel,custom:h.custom,easing:null!==(l=h.easing)&&void 0!==l?l:nw,customParameters:h.customParameters,options:h.options}]}]}}const g=U(t.timeSlices).filter((t=>t.effects&&U(t.effects).filter((t=>t.channel||t.type)).length));if(g.length)return{startTime:null!==(h=t.startTime)&&void 0!==h?h:qk,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:iw,loop:null!==(d=t.loop)&&void 0!==d?d:ew,controlOptions:j({},sw,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:Qk,delayAfter:null!==(i=t.delayAfter)&&void 0!==i?i:tw,effects:U(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:nw,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 IT(t,e,i){return d(t)?t.call(null,e.getDatum(),e,i):t}class PT{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 LT{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=RT(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=RT(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!==Tk.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 PT(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=OT(Zk,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 PT(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=U(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=U(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=U(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===Tk.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 BT(n,i,e);if(l.animate(s,r),!l.isAnimating)return;n.diffState===Tk.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=lw(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,n,s){const r=[],a=IT(t.startTime,e,s),o=IT(t.totalTime,e,s),l=IT(t.oneByOne,e,s),h=IT(t.loop,e,s);let c=0;t.timeSlices.forEach((t=>{var i;const a=IT(t.delay,e,s),l=IT(t.delayAfter,e,s),h=null!==(i=IT(t.duration,e,s))&&void 0!==i?i:o/n,d=U(t.effects).map((t=>Object.assign({},t,{customParameters:IT(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===Tk.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===Tk.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===Zk,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===Tk.exit&&0===o[Tk.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 DT extends Gw{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new LT(this,{}),this.differ=new AT([]),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===Tk.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(e,i){var n;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===Dk.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:Wk,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===Ck.group)return;const e=ST(null!=t?t:Wk,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(Tk.update,t,e,i)}encodeState(t,e,i,n){if(t===Tk.enter&&(this._isReentered=!0),this.spec.encode[t]){const s=this.spec.encode[t];if(ow(s))this.detach(gw(s,this.view));else{const r=y(e);r&&n||!r&&i?(Object.keys(s).forEach((t=>{this.detach(gw(s[t],this.view))})),this.spec.encode[t]={}):r?this.detach(gw(s[e],this.view)):Object.keys(e).forEach((t=>{this.detach(gw(s[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),y(e)?(this.spec.encode[t][e]=i,this.attach(gw(i,this.view))):ow(e)?(this.spec.encode[t]=e,this.attach(gw(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(gw(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=Yw(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=Yw(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 Vk.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!==Tk.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===jk.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&&!ow(s)&&Object.keys(s).forEach((t=>{uw(s[t])&&(e[t]=hw(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];ow(n)||Object.keys(n).forEach((t=>{pw(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[zk];if((null==n?void 0:n.mark)===this){const i=gT(this.view,t,n,0,Zw);this.emitGrammarEvent(e,i,n)}},this.initEvent()),this.animate||(this.animate=new LT(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=hw(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!==Ck.group){if(!this.graphicItem){const t=xw(this,Ck.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||Hk.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||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==Ck.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=dw(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:()=>Gk),a=dw(null!==(s=this.spec.groupBy)&&void 0!==s?s:()=>Gk),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===Tk.enter))),c=[];this.differ.setCallback(((t,e,i)=>{const n=t;let s;if(u(e))s=this.elementMap.get(n),s&&(s.diffState=Tk.exit);else if(u(i)){s=this.elementMap.has(n)?this.elementMap.get(n):xT(this),s.diffState===Tk.exit&&(s.diffState=Tk.enter,this.animate.getElementAnimators(s,Tk.exit).forEach((t=>t.stop("start")))),s.diffState=Tk.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=Tk.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:Wk;l||this.differ.setCurrentData(ST(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]=vw(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[wk.group],n);e.forEach((t=>{this.markType===Ck.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._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:xw(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!==Ck.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=dw(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:()=>Gk),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=xT(this);e.diffState=Tk.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=xT(this);i.diffState=Tk.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!==Ck.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=xw(this,Ck.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!==Tk.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:ww[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=Tk.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&&Sw(this.graphicItem),this.detachAll(),super.release()}}let FT=class extends DT{constructor(t,e){super(t,Ck.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===Ck.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 ww.rect}evaluateJoin(t){if(!this.elements.length){const t=xT(this);t.updateData(Gk,Wk,(()=>""),this.view),this.elements=[t],this.elementMap.set(Gk,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 mw(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[wk.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:xw(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 jT(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 NT(t,e){return Math.min(t<0?t+e:t-1,e)}function zT(t,e,i){let n=NT(t,i),s=NT(e,i);if(A(t)||A(e)?A(t)?A(e)||(n=NT(Math.max(0,s-1),i)):s=NT(n+1,i):(n=1,s=2),n>s){const t=s;s=n,n=t}return{start:n,end:s}}const VT=(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=>jT(t,i))),u=l.map((t=>jT(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}=zT(e,i,r),{start:h,end:c}=zT(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()}))},HT={[Ek.axis]:0,[Ek.legend]:1,[Ek.slider]:2,[Ek.player]:3,[Ek.datazoom]:4},GT=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=HT[t.componentType])&&void 0!==n?n:1/0},WT=(t,e,i,n)=>{const s=i.clone(),r=t.getSpec().layout,a=zf(r.maxChildWidth,s.width()),o=zf(r.maxChildHeight,s.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=yT(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&&dGT(t)-GT(e)));for(let t=0,e=m.length;t{null==t||t.forEach((t=>{var n;if(t.markType!==Ck.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=WT(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(tT,o),i.updateSignal(eT,l),i.updateSignal(iT,h)}else WT(t,s,a,e);else"grid"===r.display&&VT(t,s,a);UT(s,e,i)}}))};class YT extends DT{constructor(t,e,i){super(t,Ck.glyph,i),this.glyphType=e,this.glyphMeta=_w.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(!_w.getGraphicType(Ck.glyph))return;const n=_w.createGraphic(Ck.glyph,i),s=e.getMarks(),r=Object.keys(s).map((t=>{if(_w.getGraphicType(s[t])){const e=_w.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 KT=Symbol.for("key");class XT{diffGrammar(t,e){return function(t,e,i){const n={enter:[],exit:[],update:[]},s=new AT(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(ST(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!==Ck.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?s.push(t):n.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==Ck.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=ST(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=ST(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=dw(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 AT(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(ST(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:KT})),r=ST(e,(t=>{var e;return null!==(e=n(t))&&void 0!==e?e:KT}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==KT){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=lw(i.animation.delay,s,o,l),d=lw(i.animation.duration,s,o,l),u=lw(i.animation.oneByOne,s,o,l),p=lw(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)?bo:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:xo)(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);mo(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)?bo:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:xo)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>uo(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>go(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 fo({morphingData:h[n],saveOnEnd:!0,otherAttrs:c[n]},null!==(o=i.duration)&&void 0!==o?o:ya,null!==(l=i.easing)&&void 0!==l?l:_a))}))}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 vo({morphingData:h,otherAttrs:c},null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:ya,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:_a))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):mo(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 $T{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 ZT extends $T{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===Ck.group&&n.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===Ck.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=>{const n=t.mark;n.markType===Ck.group&&n.includesChild(e,!1)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===Ck.group&&e.includesChild(n,!1)&&(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 qT{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 JT extends DT{addGraphicItem(t,e){const i=t&&t.limitAttrs,n=xw(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?Ck.richtext:Ck.text,t);return super.addGraphicItem(t,e,n)}release(){super.release()}}JT.markType=Ck.text;const QT={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)"}}},tC={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},eC=Object.assign({},QT);eC.axis=Object.assign({},eC.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),eC.circleAxis=Object.assign({},eC.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),eC.grid=Object.assign({},eC.grid,{style:{stroke:"#404349"}}),eC.circleGrid=Object.assign({},eC.circleGrid,{style:{stroke:"#404349"}}),eC.rectLabel=Object.assign({},eC.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),eC.lineLabel=Object.assign({},eC.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),eC.symbolLabel=Object.assign({},eC.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),eC.title=Object.assign({},eC.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const iC={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:tC,components:eC},nC={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:tC,components:QT};let sC=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")}};sC._themes=new Map,sC.registerTheme("default",nC),sC.registerTheme("dark",iC);class rC extends DT{constructor(t,e,i,n){super(t,Ck.component,i),this._componentDatum={[Gk]: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:_w.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,Gk)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[Gk]+=1}evaluateJoin(t){return this.spec.key=Gk,t?(t[Gk]=this._componentDatum[Gk],this._componentDatum=t):this._componentDatum={[Gk]:this._componentDatum[Gk]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}class aC 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[zk],s=gT(0,t,n,0,Zw);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=U(t),i=[];return e.forEach((t=>{if(cw(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)):bw(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 fT(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 Xw(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=_w.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=_w.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 Ck.group:s=new FT(this,n);break;case Ck.glyph:s=new YT(this,null==i?void 0:i.glyphType,n);break;case Ck.component:s=_w.hasComponent(null==i?void 0:i.componentType)?_w.createComponent(null==i?void 0:i.componentType,this,n,null==i?void 0:i.mode):new rC(this,null==i?void 0:i.componentType,n,null==i?void 0:i.mode);break;case Ck.text:s=new JT(this,t,n);break;default:s=_w.hasMark(t)?_w.createMark(t,this,n):new DT(this,t,n)}return this.grammars.record(s),this._dataflow.add(s),s}group(t){return this.mark(Ck.group,t)}glyph(t,e){return this.mark(Ck.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(Ck.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(Ck.component,t,{componentType:Ek.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(Ck.component,t,{componentType:Ek.grid,mode:e})}legend(t){return this.mark(Ck.component,t,{componentType:Ek.legend})}slider(t){return this.mark(Ck.component,t,{componentType:Ek.slider})}label(t){return this.mark(Ck.component,t,{componentType:Ek.label})}datazoom(t){return this.mark(Ck.component,t,{componentType:Ek.datazoom})}player(t){return this.mark(Ck.component,t,{componentType:Ek.player})}title(t){return this.mark(Ck.component,t,{componentType:Ek.title})}scrollbar(t){return this.mark(Ck.component,t,{componentType:Ek.scrollbar})}customized(t,e){const i=_w.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&&vT.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&(Sw(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_"+ ++mT;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(sC.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(Jw,t.width),this.updateSignal(Qw,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=_w.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=Dk.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var n,s,r,a,o;return[{id:Jw,value:null!==(n=t[Jw])&&void 0!==n?n:0},{id:Qw,value:null!==(s=t[Qw])&&void 0!==s?s:0},{id:iT,value:yT(null!==(a=null!==(r=t[iT])&&void 0!==r?r:e[iT])&&void 0!==a?a:null==i?void 0:i.padding)},{id:tT,update:{callback:(t,e)=>{const i=yT(e[iT]);return e[Jw]-i.left-i.right},dependency:[Jw,iT]}},{id:eT,update:{callback:(t,e)=>{const i=yT(e[iT]);return e[Qw]-i.top-i.bottom},dependency:[Qw,iT]}},{id:nT,update:{callback:(t,e)=>{const i=yT(e[iT]);return(t||new Vt).setValue(i.left,i.top,i.left+e[tT],i.top+e[eT])},dependency:[tT,eT,iT]}},{id:sT,value:null!==(o=t[sT])&&void 0!==o?o:e[sT]}]})(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===Ck.glyph?{glyphType:t.glyphType}:t.type===Ck.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=sC.getTheme(t))&&void 0!==e?e:sC.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(Jw);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(Qw);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(tT);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(eT);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(iT);if(arguments.length){const i=yT(t);return this.updateSignal(e,i),i}return yT(e.output())}autoFit(t){const e=this.getSignalById(sT);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(nT);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=Dk.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===Ck.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var e;const i=this._options.doLayout||UT;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=>{cT(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),cT(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=Yk,morph:o=Kk,morphAll:l=Xk,animation:h={},enableExitAnimation:c=$k}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:nw,delay:null!==(i=h.delay)&&void 0!==i?i:Qk,duration:null!==(n=h.duration)&&void 0!==n?n:Jk,oneByOne:null!==(s=h.oneByOne)&&void 0!==s?s:iw,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=Dk.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=Dk.reevaluate,this._dataflow.evaluate()),this._layoutState=Dk.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=>!vT.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 cT(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(Jw,t)),e!==this.height()&&(n=!0,this.updateSignal(Qw,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]:Zw;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):bw(t)?(i.markType=t,i.source=e):i.source=t===$w?$w: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=rw(l,this),v=_T(((t,e)=>{const n=c===Zw&&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===$w&&(t=gT(0,t,e,0,$w));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===Zw){if(function(t,e,i){const n=null==t?void 0:t[e];return!(!1===n||g(n)&&!n[i])}(this._eventConfig,Zw,d))return this.addEventListener(d,v,qw),()=>{this.removeEventListener(d,v)}}else if(c===$w)return cg.addEventListener(d,v),this._eventListeners.push({type:d,source:cg,handler:v}),()=>{cg.removeEventListener(d,v);const t=this._eventListeners.findIndex((t=>t.type===d&&t.source===cg&&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=_w.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 dT(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e;this.grammars=new $T((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new ZT((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 hT,this.animate=new qT(this),this._morph=new XT,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,[Zw,$w]),e}(this._options.eventConfig),this._theme=this._options.disableTheme?null:sC.getDefaultTheme(),this.parseBuiltIn(),(e=this._options).mode&&cg.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=Dk.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!==Ck.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=cg.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&cg.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(),_w.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 oC extends rC{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 lC=(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 hC extends oC{constructor(t,e,i){super(t,Ek.axis,e),this.spec.componentType=Ek.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=_w.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=vw(s,e,i,n);const h=lw(this.spec.inside,n,e,i),c=lw(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(lC(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=lw(this.spec.tickCount,n,e,i);switch(this._getAxisComponentType()){case Bk.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 Bk.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?Bk.circleAxis:Bk.lineAxis,this._axisComponentType}}hC.componentType=Ek.axis;let cC=class extends rC{constructor(t,e){super(t,Ek.label,e),this.spec.componentType=Ek.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=U(this.spec.target).map((t=>y(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=U(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=U(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=lw(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=lw(n,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case Ck.line:case Ck.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case Ck.rect:case Ck.rect3d:case Ck.interval:g=p.rectLabel;break;case Ck.symbol:case Ck.circle:case Ck.cell:g=p.symbolLabel;break;case Ck.arc:case Ck.arc3d:g=p.arcLabel;break;case Ck.polygon:case Ck.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=vw(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=vw(i,t,e,d);f.push(j({},m,n))}));else{const t=vw(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}};cC.componentType=Ek.label;class dC extends oC{constructor(t,e,i){super(t,Ek.grid,e),this.spec.componentType=Ek.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=_w.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=vw(n,t,e,i);const d=lw(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 Rk.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 Rk.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=lw(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(lC(h,s,n,d,this.spec.layout,!0),c))}this._getGridComponentType()===Rk.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=lw(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case Rk.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 Rk.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=Rk.circleAxisGrid:this._gridComponentType=Rk.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case Bk.circleAxis:this._gridComponentType=Rk.circleAxisGrid;break;case Bk.lineAxis:default:this._gridComponentType=Rk.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()?Rk.lineAxisGrid:Rk.circleAxisGrid:Rk.lineAxisGrid}else this._gridComponentType=Rk.lineAxisGrid;return this._gridComponentType}}dC.componentType=Ek.grid;const uC=(t,e,i)=>e.filter((e=>t.callback(e,i))),pC=(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 gC(t){return t.reduce(((t,e)=>t+e),0)}const fC={min:X,max:K,average:function(t){return 0===t.length?0:gC(t)/t.length},sum:gC};function mC(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 vC(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 yC(t,e,i,n){return vC(t,e,i,"min",n)}function _C(t,e,i,n){return vC(t,e,i,"max",n)}function bC(t,e,i,n){return vC(t,e,i,"average",n)}function xC(t,e,i,n){return vC(t,e,i,"sum",n)}const SC=(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=mC;if("min"===s?l=yC:"max"===s?l=_C:"average"===s?l=bC:"sum"===s&&(l=xC),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[]},AC="_mo_hide_";const kC=(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(AC)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(AC,!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(AC,!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},wC=()=>{_w.registerTransform("filter",{transform:uC,markPhase:"beforeJoin"},!0)},TC=()=>{_w.registerTransform("map",{transform:pC,markPhase:"beforeJoin"},!0)},CC=()=>{_w.registerTransform("sampling",{transform:SC,markPhase:"afterEncode"},!0)},EC=()=>{_w.registerTransform("markoverlap",{transform:kC,markPhase:"afterEncode"},!0)},MC=(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}}},BC=(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}}},RC=(t,e,i)=>{var n,s,r,a;const o=null!==(n=t.getFinalGraphicAttributes())&&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}}},OC=(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}}},IC=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),n=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("y",!1),i=t.getGraphicAttribute("y1",!1),n=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),n=t.getGraphicAttribute("width",!1),s=t.getGraphicAttribute("y",!1),r=t.getGraphicAttribute("y1",!1),a=t.getGraphicAttribute("height",!1),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}}}}},PC=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),n=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("y",!1),i=t.getGraphicAttribute("y1",!1),n=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("y",!1),n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicAttribute("height",!1),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 LC=(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.getGraphicAttribute("x",!1),r=t.getGraphicAttribute("x1",!1),a=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);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 DC=(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.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);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 FC=(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.getGraphicAttribute("y",!1),r=t.getGraphicAttribute("y1",!1),a=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);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 jC=(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.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);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)},NC=(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.getFinalGraphicAttributes();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.getFinalGraphicAttributes();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)},zC=(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.getFinalGraphicAttributes();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)},VC=(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.getFinalGraphicAttributes(),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.getFinalGraphicAttributes();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)},HC=(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.getFinalGraphicAttributes();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)},GC=(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((()=>Object.assign(s)))},WC=(t,e,i)=>({from:{points:GC(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),UC=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:GC(t,e)}}),YC=(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),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}})),KC=(t,e,i)=>({from:{points:YC(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),XC=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:YC(t,e,i)}}),$C=(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),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined}})),ZC=(t,e,i)=>({from:{points:$C(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),qC=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:$C(t,e,i)}}),JC=(t,e,i)=>{var n,s;const{offset:r=0,orient:a,direction:o,point:l}=null!=e?e:{};let h=0,c=0;"negative"===a&&(i.group?(h=null!==(n=i.groupWidth)&&void 0!==n?n:i.group.getBounds().width(),c=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupWidth=h,i.groupHeight=c):(h=i.width,c=i.height)),h+=r,c+=r;const u=d(l)?l.call(null,t.getDatum(),t,i):l,p=u&&A(u.x)?u.x:h,g=u&&A(u.y)?u.y:c,f=t.getFinalGraphicAttributes();switch(o){case"x":return{from:{x:p},to:{x:null==f?void 0:f.x}};case"y":return{from:{y:g},to:{y:null==f?void 0:f.y}};default:return{from:{x:p,y:g},to:{x:null==f?void 0:f.x,y:null==f?void 0:f.y}}}},QC=(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}}}},tE=(t,e,i)=>{var n,s,r,a;const o=t.getFinalGraphicAttributes();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}}}},eE=(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}}}},iE={symbol:["_mo_hide_","visible"]},nE=(t,e,i)=>{const n=Object.assign({},t.getPrevGraphicAttributes()),s=Object.assign({},t.getNextGraphicAttributes());let r;e&&U(e.excludeChannels).forEach((t=>{delete n[t],delete s[t]})),t.mark&&t.mark.markType&&(r=iE[t.mark.markType])&&r.forEach((t=>{delete n[t],delete s[t]})),Object.keys(s).forEach((t=>{Nf(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}},sE=(t,e,i)=>{var n,s;const r=null!==(s=null===(n=t.getFinalGraphicAttributes())||void 0===n?void 0:n.angle)&&void 0!==s?s:0;let a=0;return a=at(r/(2*Math.PI),0)?Math.round(r/(2*Math.PI))*Math.PI*2:A(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(r/(2*Math.PI))*Math.PI*2:Math.floor(r/(2*Math.PI))*Math.PI*2,{from:{angle:a},to:{angle:r}}},rE=(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}}},aE=()=>{_w.registerAnimationType("clipIn",MC)},oE=()=>{_w.registerAnimationType("clipOut",BC)},lE=()=>{_w.registerAnimationType("fadeIn",RC)},hE=()=>{_w.registerAnimationType("fadeOut",OC)},cE=()=>{_w.registerAnimationType("growCenterIn",IC)},dE=()=>{_w.registerAnimationType("growCenterOut",PC)},uE=()=>{_w.registerAnimationType("growHeightIn",FC)},pE=()=>{_w.registerAnimationType("growHeightOut",jC)},gE=()=>{_w.registerAnimationType("growWidthIn",LC)},fE=()=>{_w.registerAnimationType("growWidthOut",DC)},mE=()=>{_w.registerAnimationType("growPointsIn",WC)},vE=()=>{_w.registerAnimationType("growPointsOut",UC)},yE=()=>{_w.registerAnimationType("growPointsXIn",KC)},_E=()=>{_w.registerAnimationType("growPointsXOut",XC)},bE=()=>{_w.registerAnimationType("growPointsYIn",ZC)},xE=()=>{_w.registerAnimationType("growPointsYOut",qC)},SE=()=>{_w.registerAnimationType("growAngleIn",NC)},AE=()=>{_w.registerAnimationType("growAngleOut",zC)},kE=()=>{_w.registerAnimationType("growRadiusIn",VC)},wE=()=>{_w.registerAnimationType("growRadiusOut",HC)},TE=()=>{_w.registerAnimationType("moveIn",JC)},CE=()=>{_w.registerAnimationType("moveOut",QC)},EE=()=>{_w.registerAnimationType("scaleIn",tE)},ME=()=>{_w.registerAnimationType("scaleOut",eE)},BE=()=>{_w.registerAnimationType("rotateIn",sE)},RE=()=>{_w.registerAnimationType("rotateOut",rE)},OE=()=>{_w.registerAnimationType("update",nE)},IE=["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 PE,LE,DE;t.ChartEvent=void 0,(PE=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",PE.rendered="rendered",PE.renderFinished="renderFinished",PE.animationFinished="animationFinished",PE.regionSeriesDataFilterOver="regionSeriesDataFilterOver",PE.afterInitData="afterInitData",PE.afterInitEvent="afterInitEvent",PE.afterInitMark="afterInitMark",PE.rawDataUpdate="rawDataUpdate",PE.viewDataFilterOver="viewDataFilterOver",PE.viewDataUpdate="viewDataUpdate",PE.viewDataStatisticsUpdate="viewDataStatisticsUpdate",PE.markDeltaYUpdate="markDeltaYUpdate",PE.viewDataLabelUpdate="viewDataLabelUpdate",PE.scaleDomainUpdate="scaleDomainUpdate",PE.scaleUpdate="scaleUpdate",PE.dataZoomChange="dataZoomChange",PE.drill="drill",PE.layoutStart="layoutStart",PE.layoutEnd="layoutEnd",PE.layoutRectUpdate="layoutRectUpdate",PE.playerPlay="playerPlay",PE.playerPause="playerPause",PE.playerEnd="playerEnd",PE.playerChange="playerChange",PE.playerForward="playerForward",PE.playerBackward="playerBackward",PE.scrollBarChange="scrollBarChange",PE.brushStart="brushStart",PE.brushChange="brushChange",PE.brushEnd="brushEnd",PE.brushClear="brushClear",PE.legendSelectedDataChange="legendSelectedDataChange",PE.legendFilter="legendFilter",PE.legendItemClick="legendItemClick",PE.legendItemHover="legendItemHover",PE.legendItemUnHover="legendItemUnHover",PE.tooltipShow="tooltipShow",PE.tooltipHide="tooltipHide",PE.tooltipRelease="tooltipRelease",PE.afterResize="afterResize",PE.afterRender="afterRender",PE.afterLayout="afterLayout",t.Event_Source_Type=void 0,(LE=t.Event_Source_Type||(t.Event_Source_Type={})).chart="chart",LE.window="window",LE.canvas="canvas",t.Event_Bubble_Level=void 0,(DE=t.Event_Bubble_Level||(t.Event_Bubble_Level={})).vchart="vchart",DE.chart="chart",DE.model="model",DE.mark="mark";const FE=`${ak}_waterfall_default_seriesField`,jE=`${ak}_CORRELATION_X`,NE=`${ak}_CORRELATION_Y`,zE=`${ak}_CORRELATION_SIZE`,VE=`${ak}_MEASURE_CANVAS_ID`,HE=`${ak}_DEFAULT_DATA_INDEX`,GE=`${ak}_DEFAULT_DATA_KEY`,WE=`${ak}_DEFAULT_DATA_SERIES_FIELD`,UE=`${ak}_DEFAULT_SERIES_STYLE_NAME`;var YE;t.AttributeLevel=void 0,(YE=t.AttributeLevel||(t.AttributeLevel={}))[YE.Default=0]="Default",YE[YE.Theme=1]="Theme",YE[YE.Chart=2]="Chart",YE[YE.Base_Series=3]="Base_Series",YE[YE.Series=4]="Series",YE[YE.Mark=5]="Mark",YE[YE.User_Chart=6]="User_Chart",YE[YE.User_Series=7]="User_Series",YE[YE.User_Mark=8]="User_Mark",YE[YE.Built_In=99]="Built_In";const KE=`${ak}_STACK_KEY`,XE=`${ak}_STACK_START`,$E=`${ak}_STACK_END`,ZE=`${ak}_STACK_START_PERCENT`,qE=`${ak}_STACK_END_PERCENT`,JE=`${ak}_STACK_START_OffsetSilhouette`,QE=`${ak}_STACK_END_OffsetSilhouette`,tM=`${ak}_STACK_TOTAL`,eM=`${ak}_STACK_TOTAL_PERCENT`,iM=`${ak}_STACK_TOTAL_TOP`,nM=`${ak}_SEGMENT_START`,sM=`${ak}_SEGMENT_END`;var rM,aM;t.LayoutZIndex=void 0,(rM=t.LayoutZIndex||(t.LayoutZIndex={}))[rM.Axis_Grid=50]="Axis_Grid",rM[rM.CrossHair_Grid=100]="CrossHair_Grid",rM[rM.Region=450]="Region",rM[rM.Mark=300]="Mark",rM[rM.Node=400]="Node",rM[rM.Axis=100]="Axis",rM[rM.MarkLine=500]="MarkLine",rM[rM.MarkArea=100]="MarkArea",rM[rM.MarkPoint=500]="MarkPoint",rM[rM.DataZoom=500]="DataZoom",rM[rM.ScrollBar=500]="ScrollBar",rM[rM.Player=500]="Player",rM[rM.Legend=500]="Legend",rM[rM.CrossHair=500]="CrossHair",rM[rM.Indicator=500]="Indicator",rM[rM.Title=500]="Title",rM[rM.Label=500]="Label",rM[rM.Brush=500]="Brush",rM[rM.CustomMark=500]="CustomMark",rM[rM.Interaction=700]="Interaction",t.LayoutLevel=void 0,(aM=t.LayoutLevel||(t.LayoutLevel={}))[aM.Indicator=10]="Indicator",aM[aM.Region=20]="Region",aM[aM.Axis=30]="Axis",aM[aM.DataZoom=40]="DataZoom",aM[aM.Player=40]="Player",aM[aM.ScrollBar=40]="ScrollBar",aM[aM.Legend=50]="Legend",aM[aM.Title=70]="Title",aM[aM.CustomMark=70]="CustomMark";const oM=["linear","radial","conical"],lM={x0:0,y0:0,x1:1,y1:1},hM={x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},cM={x:.5,y:.5,startAngle:0,endAngle:2*Math.PI},dM={linear:lM,radial:hM,conical:cM},uM={label:{name:"label",type:"text"}},pM=`${ak}_rect_x`,gM=`${ak}_rect_x1`,fM=`${ak}_rect_y`,mM=`${ak}_rect_y1`,vM=Object.assign(Object.assign({},uM),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),yM=Object.assign(Object.assign({},uM),{bar3d:{name:"bar3d",type:"rect3d"}}),_M={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},bM=Object.assign(Object.assign({},uM),_M),xM=Object.assign(Object.assign({},uM),{point:{name:"point",type:"symbol"}}),SM=Object.assign(Object.assign(Object.assign({},uM),_M),{area:{name:"area",type:"area"}}),AM=Object.assign(Object.assign(Object.assign({},uM),_M),{area:{name:"area",type:"area"}}),kM=Object.assign(Object.assign({},uM),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),wM=Object.assign(Object.assign({},uM),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}}),TM=Object.assign(Object.assign({},uM),{rose:{name:"rose",type:"arc"}}),CM=Object.assign(Object.assign({},uM),{area:{name:"area",type:"path"}}),EM=Object.assign(Object.assign({},uM),{group:{name:"group",type:"group"}}),MM=Object.assign(Object.assign({},EM),{track:{name:"track",type:"arc"},progress:{name:"progress",type:"arc"}}),BM=Object.assign(Object.assign({},uM),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),RM=Object.assign(Object.assign({},uM),{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"}}),OM=Object.assign(Object.assign({},uM),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"}}),IM=Object.assign(Object.assign({},uM),{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"}}),PM=Object.assign(Object.assign({},uM),{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"}}),LM=Object.assign(Object.assign({},uM),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),DM=Object.assign(Object.assign({},vM),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),FM=Object.assign(Object.assign({},uM),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),jM=Object.assign(Object.assign({},uM),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),NM=Object.assign(Object.assign({},uM),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}}),zM=Object.assign(Object.assign({},EM),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),VM=Object.assign(Object.assign({},uM),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),HM=Object.assign(Object.assign({},uM),{sunburst:{name:"sunburst",type:"arc"}}),GM=Object.assign(Object.assign({},vM),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),WM=Object.assign(Object.assign({},yM),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),UM=Object.assign(Object.assign({},uM),{circlePacking:{name:"circlePacking",type:"arc"}}),YM=Object.assign(Object.assign({},uM),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}}),KM=Object.assign(Object.assign({},uM),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),XM=Object.assign({},SM),$M=Object.assign(Object.assign({},uM),{liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"symbol"}}),ZM=Object.assign(Object.assign({},uM),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});var qM;!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"}(qM||(qM={}));const JM={[sk.bar]:vM,[sk.bar3d]:yM,[sk.line]:bM,[sk.scatter]:xM,[sk.area]:SM,[sk.radar]:AM,[sk.pie]:kM,[sk.pie3d]:wM,[sk.rose]:TM,[sk.geo]:uM,[sk.map]:CM,[sk.circularProgress]:MM,[sk.link]:BM,[sk.dot]:RM,[sk.wordCloud]:OM,[sk.wordCloud3d]:OM,[sk.funnel]:IM,[sk.funnel3d]:PM,[sk.linearProgress]:LM,[sk.waterfall]:DM,[sk.boxPlot]:FM,[sk.treemap]:jM,[sk.sankey]:NM,[sk.gauge]:zM,[sk.gaugePointer]:VM,[sk.sunburst]:HM,[sk.rangeColumn]:GM,[sk.rangeColumn3d]:WM,[sk.circlePacking]:UM,[sk.heatmap]:YM,[sk.correlation]:KM,[sk.rangeArea]:XM,[sk.liquid]:$M,[sk.venn]:ZM};function QM(t){var e,i;const{type:n}=t;return n===sk.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}const tB={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},eB={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function iB(t,e){var i;if(!t)return[];const n=hB(t,e);if(!n||_(n))return null!==(i=n)&&void 0!==i?i:[];if(g(n)){const{dataScheme:i}=n;return i?oB(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>aB(i)?sB(t,i,e):i)).filter(p)}))):i.map((i=>aB(i)?sB(t,i,e):i)).filter(p):[]}return[]}function nB(t,e){var i,n;return oB(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 sB(t,e,i){var n;const s=hB(t,i);if(!s)return;let r;const{palette:a}=s;if(g(a)&&(r=null!==(n=function(t,e){const i=tB[e];if(i&&t[i])return t[i];if(t[e])return t[e];const n=eB[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 rB=(t,e,i)=>{if(e&&aB(t)){const n=sB(e,t,i);if(n)return n}return t};function aB(t){return t&&"palette"===t.type&&!!t.key}function oB(t){return!(!_(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function lB(t){return _(t)?{dataScheme:t}:t}function hB(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=QM(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 cB extends NS{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(!oB(this._range))return void super.range(this._range);const t=nB(this._range,this._domain);super.range(t)}}const dB={linear:lA,band:VS,point:class extends VS{constructor(t){super(!1),this.type=uS.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:NS,threshold:pA,colorOrdinal:cB};function uB(t){const e=dB[t];return e?new e:null}function pB(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 gB(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function fB(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function mB(t){return!!y(t)&&(!!t.endsWith("%")&&Rf(t.substring(0,t.length-1)))}function vB(t,e,i,n=0){var s,r;return S(t)?t:mB(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 yB(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]=vB(t[n],e.size,i)}))})),o}function _B(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)||mB(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 bB(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const xB=(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},SB=[{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"]}],AB={default:{dataScheme:SB,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"}}},kB="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",wB={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:kB,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:kB,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"}}}}},TB={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}}},CB=Object.assign(Object.assign({},TB),{label:{space:0}}),EB={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}}}}},MB="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;",BB={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:MB,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:MB,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}}}},RB={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}},OB={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}},IB={horizontal:Object.assign(Object.assign({},RB),{rail:{width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:OB}),vertical:Object.assign(Object.assign({},RB),{rail:{width:8,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:OB})},PB={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}},LB={horizontal:Object.assign(Object.assign({},RB),{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:PB}),vertical:Object.assign(Object.assign({},RB),{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:PB})},DB={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"}}}}},FB={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"}}}}},jB={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 NB(t,e){return t&&e.key in t?t[e.key]:e.default}function zB(t){return t&&"token"===t.type&&!!t.key}const VB={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%"},HB={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:AB,token:VB,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:wB,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},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:IB,sizeLegend:LB,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:TB,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:CB,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:FB,markArea:DB,markPoint:jB,polarMarkLine:FB,polarMarkArea:DB,polarMarkPoint:jB,geoMarkPoint:jB,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",textAlign:"left",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"},textAlign:"left",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:BB,crosshair:EB,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},GB={name:"dark",colorScheme:{default:{dataScheme:SB,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"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},WB=(t,e)=>t===e||!d(t)&&!d(e)&&(_(t)&&_(e)?e.every((e=>t.some((t=>WB(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>WB(t[i],e[i])))),UB=(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]={}),UB(t[n],e.slice(1),i))};function YB(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]=YB(s,e)}return n}function KB(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])?XB(t,e,r,i):$B(t,r,n[r])}}}}function XB(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?ZB({},t[s][e.index],i):i):t[s]=n?ZB({},t[s],i):i);else if(_(t[s])){const r=t[s].findIndex((t=>t.id===e));r>=0&&(t[s][r]=n?ZB({},t[s][r],i):i)}else t.id===e&&(t[s]=n?ZB({},t[s],i):i)}))}function JB(t,...e){return ZB(QB(t),...e.map(QB))}function QB(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]=lB(n),e}),{}));return t}(t.colorScheme),{series:n}=t,{mark:s,markByName:r}=t;let a;return(s||r)&&(a=Object.keys(JM).reduce(((t,e)=>{var i;const a=null!==(i=null==n?void 0:n[e])&&void 0!==i?i:{};return t[e]=tR(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 tR(t,e,i,n){if(!JM[e])return t;const s={};return Object.values(JM[e]).forEach((({type:e,name:r})=>{s[r]=ZB({},null==i?void 0:i[U(e)[0]],null==n?void 0:n[r],null==t?void 0:t[r])})),Object.assign(Object.assign({},t),s)}const eR=["animationThreshold","colorScheme","name","padding"];function iR(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];eR.includes(r)?s[r]=a:m(a)?aB(a)?s[r]=rB(a,e,n):zB(a)?s[r]=NB(i,a):s[r]=iR(a,e,i,n):s[r]=a})),s}const nR={[HB.name]:HB},sR=HB.name,rR=new Map(Object.keys(nR).map((t=>[t,nR[t]]))),aR=new Map(Object.keys(nR).map((t=>[t,iR(nR[t])]))),oR=new Map(Object.keys(nR).map((t=>[t,t===sR]))),lR=(t,e)=>{if(!t)return;const i=uR(e);rR.set(t,i),aR.set(t,iR(i)),oR.set(t,!0)},hR=(t=sR,e=!1)=>(oR.has(t)&&!oR.get(t)&&lR(t,rR.get(t)),e?aR.get(t):rR.get(t)),cR=t=>rR.delete(t)&&aR.delete(t)&&oR.delete(t),dR=t=>!!y(t)&&rR.has(t),uR=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:sR;return JB({},hR(i),t)};class pR{static registerInstance(t){pR.instances.set(t.id,t)}static unregisterInstance(t){pR.instances.delete(t.id)}static getInstance(t){return pR.instances.get(t)}static instanceExist(t){return pR.instances.has(t)}static forEach(t,e=[],i){const n=U(e);return pR.instances.forEach(((e,i,s)=>{n.includes(i)||t(e,i,s)}),i)}}pR.instances=new Map;class gR{static registerTheme(t,e){lR(t,e)}static getTheme(t,e=!1){return hR(t,e)}static removeTheme(t){return cR(t)}static themeExist(t){return dR(t)}static getDefaultTheme(){return gR.themes.get(sR)}static setCurrentTheme(t){gR.themeExist(t)&&(gR._currentThemeName=t,pR.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return gR.getTheme(gR._currentThemeName,t)}static getCurrentThemeName(){return gR._currentThemeName}}function fR(t,e){return y(t)?gR.themeExist(t)?gR.getTheme(t,e):{}:g(t)?t:{}}function mR(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]=mR(t[n],e)}return i}return _(t)?t.map((t=>mR(t,e))):t}function vR(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]=vR(t[n],e)}return i}return _(t)?t.map((t=>vR(t,e))):t}gR.themes=rR,gR._currentThemeName=sR;function yR(t,e){for(let i=0;it.key===e))}function bR(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 xR(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:{}},TR(t,a,s[o],l,e,r))})),n?SR(s):s}function SR(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))):SR(t[e].nodes);return t}function AR(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,qE);t.values.forEach((t=>{t[tM]=i,t[eM]=n,delete t[iM]}));const s=t.values.reduce(((t,e)=>e[$E]>t[$E]?e:t));s[iM]=!0}else for(const i in t.nodes)AR(t.nodes[i],e)}function kR(t){if(!t.values.length)return;const e=t.values[t.values.length-1][$E]/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[XE]=n,n+=r[$E],r[$E]=n):(r[XE]=s,s+=r[$E],r[$E]=s),r[KE]=t.key}if(i)for(let i=0;i=0?n:s;r=a>=0?1:-1,l[ZE]=0===h?0:Math.min(1,l[XE]/h)*r,l[qE]=0===h?0:Math.min(1,l[$E]/h)*r}}for(const n in t.nodes)wR(t.nodes[n],e,i)}function TR(t,e,i,n,s,r,a){if("values"in e)if(s&&e.values.forEach((t=>t[$E]=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}),TR(t,e.nodes[o],i.nodes[o],n,s,r,l)}}function CR(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,n,s)=>MR(t.style(e,i,n,s)):B(t.style)||(e.style=MR(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,n,s,r)=>MR(t.state[e](i,n,s,r)):B(t.state[e])||(i[e]=MR(t.state[e]))})),e.state=i}return e}function ER(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,n,s,r)=>MR(t[i](e,n,s,r)):B(t[i])||(e[i]=MR(t[i]))})),e}function MR(t){return(null==t?void 0:t.angle)&&(t.angle=Gt(t.angle)),t}class BR{static registerChart(t,e){BR._charts[t]=e}static registerSeries(t,e){BR._series[t]=e}static registerComponent(t,e,i){BR._components[t]={cmp:e,alwaysCheck:i}}static registerMark(t,e){BR._marks[t]=e}static registerRegion(t,e){BR._regions[t]=e}static registerTransform(t,e){BR.transforms[t]=e}static registerLayout(t,e){BR._layout[t]=e}static registerAnimation(t,e){BR._animations[t]=e}static registerImplement(t,e){BR._implements[t]=e}static registerChartPlugin(t,e){BR._chartPlugin[t]=e}static registerComponentPlugin(t,e){BR._componentPlugin[t]=e}static createChart(t,e,i){if(!BR._charts[t])return null;return new(0,BR._charts[t])(e,i)}static createChartSpecTransformer(t,e){if(!BR._charts[t])return null;const i=BR._charts[t];return new(0,i.transformerConstructor)(Object.assign({seriesType:i.seriesType},e))}static createRegion(t,e,i){if(!BR._regions[t])return null;return new(0,BR._regions[t])(e,i)}static createRegionSpecTransformer(t,e){if(!BR._regions[t])return null;return new(0,BR._regions[t].transformerConstructor)(e)}static createSeries(t,e,i){if(!BR._series[t])return null;return new(0,BR._series[t])(e,i)}static createSeriesSpecTransformer(t,e){if(!BR._series[t])return null;return new(0,BR._series[t].transformerConstructor)(e)}static createMark(t,e,i){if(!BR._marks[t])return null;const n=new(0,BR._marks[t])(e,i);return"group"===n.type&&n.setInteractive(!1),n}static getComponents(){return Object.values(BR._components)}static getComponentInKey(t){return BR._components[t].cmp}static getLayout(){return Object.values(BR._layout)}static getLayoutInKey(t){return BR._layout[t]}static getSeries(){return Object.values(BR._series)}static getSeriesInType(t){return BR._series[t]}static getRegionInType(t){return BR._regions[t]}static getAnimationInKey(t){return BR._animations[t]}static getImplementInKey(t){return BR._implements[t]}static getSeriesMarkMap(t){return BR._series[t]?BR._series[t].mark:{}}static getChartPlugins(){return Object.values(BR._chartPlugin)}static getComponentPlugins(){return Object.values(BR._componentPlugin)}static getComponentPluginInType(t){return BR._componentPlugin[t]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}}BR._charts={},BR._series={},BR._components={},BR._marks={},BR._regions={},BR._animations={},BR._implements={},BR._chartPlugin={},BR._componentPlugin={},BR.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}},BR.dataParser={csv:li,dsv:oi,tsv:hi},BR._layout={};const RR=(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))},OR=(t,e,i,n)=>{var s;const r=bS(e.getScale().type),a=[],o=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const l of o)if(l.coordinate===i){const i=U(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:IR(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("_")}`,PR=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&e(n)&&((t,e,i)=>{const n=t.getRegionsInIds(U(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},LR=(t,e)=>{if(!t)return null;if(!ik(t.getRegionsInIndex(),"polar"))return null;const{x:i,y:n}=e,s=PR(t,(t=>"angle"===t.getOrient()),e),r=PR(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&&bS(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=QA({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=tk(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 _=OR(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&&bS(r.type)){const h=t.getCenter(),c={x:i-t.getLayoutStartPoint().x-h.x,y:n-t.getLayoutStartPoint().y-h.y};let d=QA({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=tk(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=OR(m,t,"polar",o);a.push({index:v,value:m,position:r.scale(m),axis:t,data:y})}})),a.length?a:null};function DR(t){return"bottom"===t||"top"===t}function FR(t){return"left"===t||"right"===t}function jR(t){return"z"===t}function NR(t,e){return fB(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function zR(t,e){var i;const n=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?DR(t)?"linear":"band":DR(t)?"band":"linear"}(t.orient,e);return{axisType:n,componentName:`${r.cartesianAxis}-${n}`}}const VR=t=>t.fieldX[0],HR=t=>t.fieldY[0],GR=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},WR=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},UR=(t,e)=>t?e?VR:GR:e?HR:WR,YR=(t,e,i)=>{var n,s;if(!t)return null;if(!ik(t.getRegionsInIndex(),"cartesian"))return null;const{x:r,y:a}=e,o=null!==(n=PR(t,(t=>DR(t.getOrient())),e))&&void 0!==n?n:[],l=null!==(s=PR(t,(t=>FR(t.getOrient())),e))&&void 0!==s?s:[],h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{bS(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=KR(n,i,t,UR(e,bS(n.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(n)){const r=KR(n,i,t,UR(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},KR=(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 XR(t,a,n)},XR=(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=OR(e,t,"cartesian",null!=i?i:DR(t.getOrient())?VR:HR);return{index:s,value:e,position:n.scale(e),axis:t,data:r}};class $R{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:Sf)("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:Sf)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,n;const s=null!==(i=YR(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(n=LR(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=>bS(t.getScale().type))),r=s.length?s:n.filter((t=>{const e=t.getOrient();return DR(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=XR(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var ZR;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(ZR||(ZR={}));const qR={[ZR.dimensionHover]:class extends $R{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)=>!RR(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}),Cf(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}),Cf(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[ZR.dimensionClick]:class extends $R{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 JR=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(qR[t]){const e=new qR[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(qR[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}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class QR{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}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const tO={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 eO{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 QR);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}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 tO[a]&&(a=tO[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.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 IE.includes(e)||Object.values(t.VGRAMMAR_HOOK_EVENT).includes(e)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&_w.hasInteraction(e)}}function iO(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function nO(t,e,i){t.getParser(e)||t.registerParser(e,i)}const sO=new Map;function rO(t,e=!1){let i=e;return t.latestData instanceof fi&&(i=!1),i?P(t.latestData):t.latestData.slice()}const aO=(t,e)=>0===t.length?[]:1===t.length?rO(t[0],null==e?void 0:e.deep):t.map((t=>rO(t,null==e?void 0:e.deep)));function oO(t,e,i){iO(e=e instanceof pi?e:t.dataSet,"copyDataView",aO);const n=new fi(e,i);return n.parse([t],{type:"dataview"}),n.transform({type:"copyDataView",level:cO.copyDataView}),n}function lO(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:Sf)(`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:Sf)(`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([]),xf("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 hO(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var cO;!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"}(cO||(cO={}));const dO=(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 aC(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:mO(this._option.mode),autoFit:!1,eventConfig:{gesture:Cf(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())}clear(t,e=!1){const{chart:i}=t;i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=cg.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this._nextRafId&&(cg.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null),this._isRunning||(this.initView(),this._view&&(this._isRunning=!0,null===(e=this._view)||void 0===e||e.run(t),this._isRunning=!1,this._nextRafId&&(cg.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,this._isRunning=!0,null===(i=this._view)||void 0===i||i.run(t),this._isRunning=!1))))}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.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 Tf(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function yO(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:Sf)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function _O(t){t.crosshair=U(t.crosshair||{}).map((e=>ZB({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function bO(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&&Tf(e.mode)){let t;t=y(h)?null===document||void 0===document?void 0:document.getElementById(h):h;const{width:e,height:n}=Ie(t,i.width,i.height);a=e,o=n}else if(Ef(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 xO(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")}),t}function SO(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"}(gO||(gO={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(fO||(fO={}));class AO{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({},AO.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=U(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]))))}}AO.defaultMarkInfo={};class kO{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new AO,this._markReverse=new AO,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement(gO.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement(gO.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement(gO.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement(gO.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement(gO.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(gO.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[gO.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[gO.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(ZR.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 wO={};Object.values(gO).forEach((t=>{wO[t]=!0}));const TO={[gO.STATE_HOVER]:gO.STATE_HOVER_REVERSE,[gO.STATE_SELECTED]:gO.STATE_SELECTED_REVERSE,[gO.STATE_DIMENSION_HOVER]:gO.STATE_DIMENSION_HOVER_REVERSE};function CO(t){return TO[t]}class EO{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=CO(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=CO(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=CO(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=CO(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 MO{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 BO extends MO{constructor(){super(...arguments),this.id=Bf(),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 RO extends BO{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,n){super(t),this.grammarType=pO.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 OO extends MO{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 RO(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 IO extends OO{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 PO extends IO{constructor(){super(...arguments),this.id=Bf(),this.stateKeyToSignalName=t=>`${ak}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===uO.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===uO.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?uO.none:uO.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?uO.exit:uO.appear}}}}class LO{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=>ZB({},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 DO extends MO{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=LO,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new AO,this._lastLayoutRect=null,this.id=Bf(),this.userId=t.id,this._spec=t,this.effect={},this.event=new JR(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=`${ak}_${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=BR.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 FO{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=yB(_B(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:vB(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(n=this._maxHeight)&&void 0!==n?n:null:vB(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(s=this._minWidth)&&void 0!==s?s:null:vB(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:vB(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:vB(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:vB(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=vB(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=vB(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]=vB(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 jO extends DO{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 FO(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 NO extends LO{_initTheme(t,e){return{spec:t,theme:this._theme}}}class zO extends jO{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=NO,this.modelType="region",this.specKey="region",this.type=zO.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.interaction=new EO,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 PO({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||U(t.userId).includes(e.userId))&&(!p(t.specIndex)||U(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 kO(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 fO)B(t.stateStyle[fO[e]])||this.interaction.registerMark(fO[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 VO(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 HO(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 GO(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 WO(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),GO(c,!0,u,o),n&&HO(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function UO(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),GO(c,!1,u,a),n&&HO(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function KO(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}=VO(t);n.length&&WO(n,e,i,!1,"left"),s.length&&WO(s,e,i,!0,"left"),r.length&&UO(r,e,0,"left")}(e,this,a),n.length&&function(t,e,i){const{startItems:n,middleItems:s,endItems:r}=VO(t);n.length&&YO(n,e,i,!1,"top"),s.length&&YO(s,e,i,!0,"top"),r.length&&KO(r,e,0,"top")}(n,this,r),i.length&&function(t,e,i){const{startItems:n,middleItems:s,endItems:r}=VO(t);n.length&&WO(n,e,i,!1,"right"),s.length&&WO(s,e,i,!0,"right"),r.length&&UO(r,e,0,"right")}(i,this,a),s.length&&function(t,e,i){const{startItems:n,middleItems:s,endItems:r}=VO(t);n.length&&YO(n,e,i,!1,"bottom"),s.length&&YO(s,e,i,!0,"bottom"),r.length&&KO(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:Sf)("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}}}XO.type="base";const $O=["line","area","trail"];function ZO(t){return $O.includes(t)}class qO extends IO{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(ZO)?n:!t.mark||ZO(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=>!!wO[t])).map((t=>[t,10])),n=!t.mark||ZO(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(ak)));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(ak)));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(yS(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 JO extends BO{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=pO.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 QO extends JO{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${ak}_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 tI extends BO{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=pO.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 qO(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 JR(n.getOption().eventDispatcher,n.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new QO(t)}stateKeyToSignalName(t){return`${ak}_${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=gO.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=gO.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===uO.appear&&this.runAnimationByState(uO.normal)})):this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,(()=>{this.runAnimationByState(uO.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),this._morph&&this._morphKey&&(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 eI extends tI{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].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))}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&&ZB(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(_S(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=uB(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()):oM.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):_S(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=nB(iB(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({},dM[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)oM.includes(null===(o=s.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(s.stroke)(t,e));else{const e=nB(iB(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 iI extends eI{constructor(){super(...arguments),this.type=iI.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)?(xf("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?(xf("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})}))}}iI.type="group";const nI=()=>{bb(),lb(),_w.registerGraphic(Ck.group,yl),BR.registerMark(iI.type,iI)},sI={type:"clipIn"},rI={type:"fadeIn"};function aI(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 rI;default:return sI}}const oI={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"}},lI={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},hI=()=>{BR.registerAnimation("scaleInOut",(()=>lI))},cI=(t,e)=>({appear:aI(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:Da,duration:oI.update.duration,easing:oI.update.easing}],disappear:{type:"clipOut"}}),dI=()=>{BR.registerAnimation("line",cI)},uI=()=>{aC.useRegisters([mE,vE,yE,_E,bE,xE,aE,oE])},pI={measureText:(t,e,i,n)=>((t,e,i)=>Wb(t,e,i,{fontFamily:VB.fontFamily,fontSize:VB.fontSize}))(e,i,n).measure(t)};class gI{static instance(){return gI.instance_||(gI.instance_=new gI),gI.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 fI{constructor(){this.id=Bf(),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))?xf("不要重复添加相同的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 mI extends fI{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 vI{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>BR.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>BR.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>BR.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return BR.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>BR.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){BR.registerTransform(t,e)}static registerFunction(t,e){t&&e&&gI.instance().registerFunction(t,e)}static unregisterFunction(t){t&&gI.instance().unregisterFunction(t)}static getFunction(t){return t?gI.instance().getFunction(t):null}static getFunctionList(){return gI.instance().getFunctionNameList()}static registerMap(t,e,i){const n=BR.getImplementInKey("registerMap");n&&n(t,e,i)}static unregisterMap(t){const e=BR.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,sO.get(e);var e}static hideTooltip(t=[]){pR.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,c;this.id=Bf(),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 d=this._option,{dom:u,renderCanvas:p,mode:g,stage:f,poptip:m}=d,v=e(d,["dom","renderCanvas","mode","stage","poptip"]),_=Tf(g);_&&u&&(this._container=y(u)?null===document||void 0===document?void 0:document.getElementById(u):u),p&&(this._canvas=p),f&&(this._stage=f),"node"===g||this._container||this._canvas||this._stage?(_?Ym(Ys):"node"===g&&Ty(Ys),this._viewBox=this._option.viewBox,this._currentThemeName=gR.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new vO({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:p},Object.assign(Object.assign({mode:this._option.mode,stage:f,pluginList:!1!==m?["poptipForText"]:[]},v),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new eO(this,this._compiler),this._event=new JR(this._eventDispatcher,g),this._compiler.initView(),null===(o=this.getStage())||void 0===o||o.setTheme({text:{fontFamily:null===(l=this._currentTheme)||void 0===l?void 0:l.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!_&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),pR.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=ZB({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=mR(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,n;vI.getFunctionList()&&vI.getFunctionList().length&&(t=vR(t,vI)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=BR.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=BR.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=BR.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 bO(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:ok,height:null!==(n=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==n?n:lk})}_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,nO(this._dataSet,"dataview",ci),nO(this._dataSet,"array",n),iO(this._dataSet,"stackSplit",dO),iO(this._dataSet,"copyDataView",aO);for(const t in BR.transforms)iO(this._dataSet,t,BR.transforms[t]);for(const t in BR.dataParser)nO(this._dataSet,t,BR.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),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;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,null===(n=this._compiler)||void 0===n||n.releaseGrammar(!1===(null===(s=this._option)||void 0===s?void 0:s.animation)||!1===(null===(r=this._spec)||void 0===r?void 0:r.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.reCompile&&(null===(a=this._compiler)||void 0===a||a.clear({chart:this._chart,vChart:this},!this._option.animation||!this._spec.animation),null===(o=this._compiler)||void 0===o||o.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(){var t,e;this._option.animation&&(null===(t=this._chart)||void 0===t||t.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(uO.update,!0)})),null===(e=this._chart)||void 0===e||e.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(uO.update,!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,pR.unregisterInstance(this)}updateData(t,e,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,n)}))}_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=U(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i){return u(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),this._compiler.render(),this):(this._spec.data=U(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0){if(this._chart)return this._chart.updateFullData(t),e&&this._compiler.render(),this;const i=U(this._spec.data);return U(t).forEach((t=>{var e;const{id:n,values:s,parser:r,fields:a}=t,o=i.find((t=>t.name===n));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 n=lO(t,this._dataSet,i,{onError:null===(e=this._option)||void 0===e?void 0:e.onError});_(this._spec.data)&&this._spec.data.push(n)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:n,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i){const n=this._updateSpec(t,e);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.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){var i,n;const s=this._spec;if(!this._setNewSpec(t,e))return;H(s.theme,this._spec.theme)||this._setCurrentTheme();const r=this._shouldChartResize(s);return null===(n=null===(i=this._compiler)||void 0===i?void 0:i.getVGrammarView())||void 0===n||n.updateLayoutTag(),this._spec.type!==s.type?{reTransformSpec:!0,change:!0,reMake:!0,reCompile:!1,reSize:r}:(this._initChartSpec(this._spec,"render"),xO(this._chart.updateSpec(this._spec),{reTransformSpec:!1,change:r,reMake:!1,reCompile:!1,reSize:r}))}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)||qB(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)||qB(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=ZB({},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=fR(this._currentThemeName,!0);else if(y(n)&&(!s||y(s))||y(s)&&(!n||y(n))){const t=JB({},fR(this._currentThemeName,!0),fR(n,!0),fR(s,!0));this._currentTheme=t}else{const t=JB({},fR(this._currentThemeName),fR(n),fR(s));this._currentTheme=iR(t)}var r;r=R(this._currentTheme,"component.poptip"),j(tx.poptip,Qb,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=!!Tf(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?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return fR(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){if(!gR.themeExist(t))return this;const e=this._setCurrentTheme(t);return yield this.updateCustomConfigAndRerender(e,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){if(!gR.themeExist(t))return this;const e=this._setCurrentTheme(t);return this.updateCustomConfigAndRerender(e,!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}}_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 yO(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(!Tf(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)?null===document||void 0===document?void 0:document.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?bB(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 xf("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?bB(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(xf("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return gI.instance().getFunction(t)}registerFunction(t,e){t&&e&&gI.instance().registerFunction(t,e)}unregisterFunction(t){t&&gI.instance().unregisterFunction(t)}getFunctionList(){return gI.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}_initChartPlugin(){const t=BR.getChartPlugins();t.length>0&&(this._chartPlugin=new mI(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}}}vI.InstanceManager=pR,vI.ThemeManager=gR,vI.globalConfig={uniqueTooltip:!0},vI.Utils=pI,vI.vglobal=cg;BR.registerRegion("region",zO),BR.registerLayout("base",XO),nI(),aC.useRegisters([wC,TC]),aC.useRegisters([EE,ME,lE,hE,TE,CE,BE,RE,OE]),Nw(),jw(),lR(GB.name,GB),it.getInstance(et.Error);const yI=(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(sk).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=BR.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:n}=f,s=U(null!==(h=null===(l=i.component)||void 0===l?void 0:l[n])&&void 0!==h?h:[]);null===(d=U(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=BR.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=U(null!==(p=null===(u=i.component)||void 0===u?void 0:u[s])&&void 0!==p?p:[]);U(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},_I=(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=yI(t,s,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!u(e)||U(e).some((e=>d(e)?e(t,i,n):WB(t.spec,e)))))})})(a,r,t,e,i,n);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const f=ZB({},i),m=d(s)?s(g,t,e):s;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:ZB(f,m),hasChanged:!0};const i=ZB({},t,m);UB(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 bI{constructor(t){this.id=Bf(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}const xI=t=>{BR.registerChartPlugin(t.type,t)};class SI extends bI{constructor(){super(SI.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[SI.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[SI.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=YB(this._option.globalInstance.getSpec(),["data",SI.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return n.length>0?(s=YB(this._baseChartSpec,["data",SI.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=_I(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=YB(i,["data",SI.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()}}SI.pluginType="chart",SI.specKey="media",SI.type="MediaQueryPlugin";const AI=/\{([^}]+)\}/,kI=/\{([^}]+)\}/g,wI=/:/;class TI extends bI{constructor(){super(TI.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=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[TI.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)),BR.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=AI.test(i),this._isNumericFormatterCache.set(i,n))),n){const t=i.replace(kI,((t,i)=>{if(!wI.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}}TI.pluginType="chart",TI.specKey="formatter",TI.type="formatterPlugin";const CI=()=>{xI(TI)};function EI(t){return 2===t.length&&A(t[0])&&A(t[1])&&t[1]>=t[0]}function MI(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 BI(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 RI(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 OI(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 II(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 PI=(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 gA(v)};class LI extends bI{constructor(){super(LI.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!yS(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&&EI(c)&&EI(d)))return;const u=MI(t,c),p=MI(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(!RI(u,p))return}else if(0===_&&0===b){if(!RI(p,u))return}else if(y||A)if(y&&!A){if(!BI(u,p))return}else if(A&&!y){if(!BI(p,u))return}else{if(f===b)return;if(f>b){if(!OI(u,p))return}else if(!OI(p,u))return}else{if(0===f&&0===_){if(!II(u,p))return}else if(0===b&&0===g&&!II(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){iO(e.getOption().dataSet,"tickAlign",PI);const t={targetAxis:()=>n,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}LI.pluginType="component",LI.type="AxisSyncPlugin";const DI=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,FI=(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},rd||(rd=nd.CreateGraphic("richtext",{})),rd.setAttributes(a),rd.AABBBounds);var a;return{width:r.width(),height:r.height(),text:n}},jI="vchart-tooltip-container",NI={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}};function zI(t,e){return R(e,`component.${t}`)}function VI(t,e,i,n){if(t)return{formatFunc:t,args:[i,n]};const s=BR.getFormatter();return e&&s?{formatFunc:s,args:[i,n,e]}:{}}const HI={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function GI(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 WI(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 UI(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const YI=(t,e,i)=>{var n;const s=null!==(n="band"===e?zI("axisBand",i):["linear","log","symlog"].includes(e)?zI("axisLinear",i):{})&&void 0!==n?n:{},r=DR(t)?zI("axisX",i):FR(t)?zI("axisY",i):zI("axisZ",i);return ZB({},zI("axis",i),s,r)},KI=(t,e,i)=>{var n;const s=null!==(n="band"===e?zI("axisBand",i):"linear"===e?zI("axisLinear",i):{})&&void 0!==n?n:{},r=zI("angle"===t?"axisAngle":"axisRadius",i);return ZB({},zI("axis",i),s,r)},XI=t=>"band"===t||"ordinal"===t||"point"===t;function $I(t,e){return{id:t,label:t,value:e,rawValue:t}}function ZI(t,e,i,n){let s=0,r=t.length-1;for(;s<=r;){const a=Math.floor((s+r)/2),o=t[a];if(o[i]<=e&&o[n||i]>=e)return o;o[i]>e?r=a-1:s=a+1}return null}const qI=(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(bS(a.type))A=a.bandwidth(),0===A&&a.step&&(w=a.step());else if(yS(a.type)){const n=e.fieldX[0],r=e.fieldX2,a=ZI(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=GI(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(bS(r.type))k=r.bandwidth(),0===k&&r.step&&(T=r.step());else if(yS(r.type)){const n=e.fieldY[0],r=e.fieldY2,a=ZI(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=GI(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(QI(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&&JI(t,"top",r.label),e.visible&&JI(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(QI(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&&JI(t,"left",a.label),e.visible&&JI(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}},JI=(t,e,i)=>{const{formatMethod:n,formatter:s}=i,{formatFunc:r,args:a}=VI(n,s,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},QI=(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)}))}))},tP=(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=iP(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},eP=(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=iP(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},iP=(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},nP=(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},sP={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"]},rP=(t,e)=>{var i,n;return null!==(n=null===(i=sP[t])||void 0===i?void 0:i[0])&&void 0!==n?n:e},aP=(t,e)=>{var i,n;return null!==(n=null===(i=sP[t])||void 0===i?void 0:i[1])&&void 0!==n?n:e},oP=(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}=qI(3,e,i,n,s,r,a);return o?tP(r,o,d,h):l?eP(a,l,u,c):void 0},lP={fontFamily:VB.fontFamily,spacing:10,wordBreak:"break-word"};function hP(t={},e,i){var n,s;return Object.assign(Object.assign({},null!=i?i:lP),{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 cP=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},dP=(t,e)=>p(e)?t.map((t=>e[t])):void 0,uP=(t,e)=>i=>t.every(((t,n)=>i[t]===(null==e?void 0:e[n]))),pP=t=>!u(t)&&(_(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function gP(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=fP(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=>uP(i,n)(t)&&uP(s,r)(t)&&(u(a)||uP([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 vI.globalConfig.uniqueTooltip&&vI.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 vI.globalConfig.uniqueTooltip&&vI.hideTooltip(u.id),d}return"none"}const fP=(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=dP(c,t);let y=dP(d,t);const _=pP(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(uP(c,v));if(!_&&(y=dP(d,i),!pP(y)))return;const s=e.type===sk.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=bS(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(uP(c,s));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=dP(d,o),!pP(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(uP(c,s));if(!_&&(y=dP(d,r),!pP(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===sk.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(uP(c,v))).find((t=>t[g]===f));m.forEach((s=>{if(y=dP(d,i),!pP(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},mP=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 vP=(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 yP{constructor(){this.activeTriggerSet={mark:new Set,dimension:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set,dimension:new Set,group:new Set}}}class _P extends yP{constructor(t){super(),this._getSeriesCacheInfo=()=>{var t,e,i;const{series:n}=this,s=n.getSeriesField();return{seriesFields:p(s)?U(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 U(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:xP(e.title,{seriesId:this.series.id},!0),content:SP(e.content,{seriesId:this.series.id},!0)}))})),this.spec=a,this.activeType=mP(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 bP=(t,e,i)=>{const n=d(e)?e(t):e;return i?Object.assign(Object.assign({},t),n):Object.assign(Object.assign({},n),t)},xP=(t,e,i)=>p(t)?d(t)?(...n)=>bP(t(...n),e,i):bP(t,e,i):void 0,SP=(t,e,i)=>{const n=p(t)?U(t).map((t=>d(t)?(...n)=>U(t(...n)).map((t=>bP(t,e,i))):bP(t,e,i))):void 0;return n},AP=(t,e,i)=>{var n;let s={};switch(t){case"mark":case"group":e&&(s=null!==(n=vP(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=vP(n,"dimension",s);r&&t.push(r)}))));const e=[];t.forEach((({content:t})=>{d(t)?e.push(t):e.push(...U(t))})),s=Object.assign(Object.assign({},t[0]),{content:e})}}return s},kP=(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=wP(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)&&mP(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(...U(t)))})),r=Object.assign(Object.assign({},t[0]),{content:e})}}}return r},wP=ht((t=>t.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(p))),[]))),TP=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},CP=(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}=VI(void 0,n,t,e);i&&r&&(s=i(...r))}return s},MP=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;class BP{}BP.dom=`${ak}_TOOLTIP_HANDLER_DOM`,BP.canvas=`${ak}_TOOLTIP_HANDLER_CANVAS`;const RP=20,OP={key:"其他",value:"..."},IP=(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)},PP=(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=MP(t.title,e,i),{visible:h,value:c,valueTimeFormat:p,valueTimeFormatMode:g,valueStyle:f,hasShape:m,valueFormatter:v}=null!=l?l:{},y=!1!==EP(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:IP(EP(c,t,i,v),p,g),valueStyle:EP(f,t,i),hasShape:m}}else o.title={hasShape:!1,visible:!1};const _=((t,e,i)=>{if(u(t))return t;let n=[];return U(t).forEach((t=>{d(t)?n=n.concat(U(t(e,i))):n.push(t)})),n})(t.content,e,i),{maxLineCount:b=RP}=t,x=t.othersLine?Object.assign(Object.assign({},OP),t.othersLine):OP,S=t=>{if(null==t?void 0:t.length)for(const e of t)for(const t of null!=_?_:[]){const n=LP(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=LP(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},LP=(t,e,i)=>{const n=IP(EP(e.key,t,i,e.keyFormatter),e.keyTimeFormat,e.keyTimeFormatMode),s=IP(EP(e.value,t,i,e.valueFormatter),e.valueTimeFormat,e.valueTimeFormatMode),r=!1!==EP(e.visible,t,i)&&(p(n)||p(s)),a=EP(e.isKeyAdaptive,t,i),o=EP(e.spaceRow,t,i),l=EP(e.shapeType,t,i),h=EP(e.shapeColor,t,i),c=EP(e.shapeFill,t,i),d=EP(e.shapeStroke,t,i),u=EP(e.shapeLineWidth,t,i),g=EP(e.shapeHollow,t,i),f=EP(e.keyStyle,t,i),m=EP(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 DP extends bI{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=MP(x.position,b,e),w=null!==(s=MP(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:ok,O=null!==(o=null==B?void 0:B.height)&&void 0!==o?o:lk;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(Tf(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=DI(t,e),j=DI(T,D)}}else P.width=R,P.height=O;const N=j/F;let z,V,H,G,W=k,U=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=oP(e.dimensionInfo,ik(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.x,a=t.end.x)}else W=t;if(I)switch(rP(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=oP(e.dimensionInfo,ik(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.y,a=t.end.y)}else U=t;if(I)switch(aP(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=nP(t,c),V=nP(i,c),H=nP(e,c),G=nP(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=nP(t,c):Y(t),S(e)||d(e)?V=nP(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(rP(W,"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(aP(U,"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,Tf(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"===rP(k,"right")?$+=v+C/2:$+=2*v+C)},at=()=>{et()&&($=-D.x/j)},ot=()=>{it()&&(I?$=(Q-D.x)/j-C:"center"===rP(k,"right")?$-=v+C/2:$-=2*v+C)},lt=()=>{it()&&($=(Q-D.x)/j-C)},ht=()=>{nt()&&(I?Z=-D.y/j:"center"===aP(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"===aP(k,"bottom")?Z-=y+E/2:Z-=2*y+E)},ut=()=>{st()&&(Z=(tt-D.y)/j-E)};switch(rP(k,"right")){case"center":case"centerLeft":case"centerRight":et()?(rt(),lt()):(ot(),at());break;case"left":rt(),lt();break;case"right":ot(),at()}switch(aP(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({},NI),{offsetX:null!==(t=null==i?void 0:i.x)&&void 0!==t?t:NI.offsetX,offsetY:null!==(e=null==i?void 0:i.y)&&void 0!==e?e:NI.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}=l,_=Oe(d.padding),b=_B(d.padding),x=hP(u,i),S=hP(f,i),A=hP(m,i),k={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},w={panel:cP(d),padding:_,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,maxContentHeight:y,enterable:h,transitionDuration:c},{title:T={},content:C=[]}=t;let E=b.left+b.right,M=b.top+b.bottom,B=b.top+b.bottom,R=0;const O=C.filter((t=>(t.key||t.value)&&!1!==t.visible)),I=!!O.length;let P=0,L=0,D=0,F=0;if(I){const t=[],e=[],i=[],n=[];let s=0;w.content=O.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:w,shapeColor:T}=r,C={height:0,spaceRow:null!=_?_:v};if(p(h)){const i=ZB({},S,hP(b,void 0,{})),{width:n,height:s,text:r}=FI(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=ZB({},A,hP(x,void 0,{})),{width:e,height:n,text:s}=FI(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;w?t.stroke=e:t.fill=e,t.stroke=null!=u?u:e,t.lineWidth=g,C.shape=t;const i=null!=f?f:k.size;o=Math.max(i,o),n.push(i)}else C.shape={visible:!1};return C.height=o,s+=o,aU.autoWidth&&!1!==U.multiLine;if(V){U=ZB({},x,hP(G,void 0,{})),Y()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:I?Math.ceil(R):void 0);const{text:t,width:e,height:i}=FI(H,U);w.title.value=Object.assign(Object.assign({width:Y()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),j=w.title.value.width,N=w.title.value.height,z=N+(I?w.title.spaceRow:0)}return M+=z,B+=z,w.title.width=j,w.title.height=N,Y()?E+=R||j:E+=Math.max(j,R),I&&w.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=E-b.left-b.right-F-P-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),w.valueWidth=Math.max(w.valueWidth,i.width))})),w.panel.width=E,w.panel.height=M,w.panelDomHeight=B,w})(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(Tf(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=DI(t,n),u=DI(l,c)}return n*=d,s*=d,Tf(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()}}DP.specKey="tooltip";const FP=(t,e)=>p(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",jP=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 NP;const zP=(t=document.body)=>{if(u(NP)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),NP=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return NP};function VP(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}=null!=t?t:{},{fill:f,shadow:m,shadowBlur:v,shadowColor:y,shadowOffsetX:_,shadowOffsetY:b,shadowSpread:x,cornerRadius:S,stroke:A,lineWidth:k=0,width:w=0}=s,{value:T={}}=o,{shape:C={},key:E={},value:M={}}=l,B=function(t,e){if(!t)return;const{size:i}=ZB({},e,t),n={};return n.width=FP(i),n}(C),R=HP(E),O=HP(M),{bottom:I,left:P,right:L,top:D}=_B(h);return{panel:{width:FP(w+2*k),minHeight:FP(g+2*k),paddingBottom:FP(I),paddingLeft:FP(P),paddingRight:FP(L),paddingTop:FP(D),borderColor:A,borderWidth:FP(k),borderRadius:FP(S),backgroundColor:f?`${f}`:"transparent",boxShadow:m?`${_}px ${b}px ${v}px ${x}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)?FP(null==r?void 0:r.spaceRow):"0px"},HP(ZB({},T,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 GP.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=GP.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==wf?void 0:wf.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(GP.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}}GP.type="tooltipModel";const WP={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},UP={boxSizing:"border-box"},YP={display:"inline-block",verticalAlign:"top"},KP={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},XP={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},$P={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},ZP={lineHeight:"normal",boxSizing:"border-box"};class qP extends GP{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,l;if(!(null==t?void 0:t.hasShape)||!t.symbolType)return"";const{symbolType:h,fill:c,stroke:d,hollow:u=!1}=t,p=t.size?e(t.size):"8px",f=t.lineWidth?e(t.lineWidth)+"px":"0px";let m="currentColor";const v=()=>d?e(d):m,_=jP(p),b=t=>new uc({symbolType:t,size:_,fill:!0});let x=b(null!==(i=JP[h])&&void 0!==i?i:h);const S=x.getParsedPath();S.path||(x=b(S.pathStr));const A=x.getParsedPath().path,k=A.toString(),w=A.bounds;let T=`${w.x1} ${w.y1} ${w.width()} ${w.height()}`;if("0px"!==f){const[t,e,i,n]=T.split(" ").map((t=>Number(t))),s=Number(f.slice(0,-2));T=`${t-s/2} ${e-s/2} ${i+s} ${n+s}`}if(!c||y(c)||u)return m=u?"none":c?e(c):"currentColor",`\n \n \n \n `;if(g(c)){m=null!==(n="gradientColor"+t.index)&&void 0!==n?n:"";let i="";const h=(null!==(s=c.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===c.gradient?i=`\n ${h}\n `:"linear"===c.gradient&&(i=`\n ${h}\n `),`\n \n ${i}\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=""}}const JP={star:"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"};class QP extends GP{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 tL={overflowWrap:"normal",wordWrap:"normal"};class eL extends GP{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(ZB({},YP,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=ZB({},o?XP:KP,Object.assign(Object.assign(Object.assign({height:FP(l)},tL),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 ZB({},$P,Object.assign(Object.assign(Object.assign({height:FP(n)},tL),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 ZB({},ZP,Object.assign(Object.assign({height:FP(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 iL extends GP{init(){this.product||(this.product=this.createElement("div",["container-box"])),this.shapeBox||this._initShapeBox(),this.keyBox||this._initKeyBox(),this.valueBox||this._initValueBox()}_initShapeBox(){const t=new eL(this.product,this._option,"shape-box",0);t.init(),this.shapeBox=t,this.children[t.childIndex]=t}_initKeyBox(){const t=new eL(this.product,this._option,"key-box",1);t.init(),this.keyBox=t,this.children[t.childIndex]=t}_initValueBox(){const t=new eL(this.product,this._option,"value-box",2);t.init(),this.valueBox=t,this.children[t.childIndex]=t}setStyle(t){super.setStyle(ZB(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+jP(e)),0);return Object.assign(Object.assign({},t),{width:`${a+zP(this._option.getContainer())}px`,maxHeight:FP(n),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class nL extends GP{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{title:e}=t;(null==e?void 0:e.hasShape)&&(null==e?void 0:e.shapeType)?this.shape||this._initShape():this.shape&&this._releaseShape(),this.textSpan||this._initTextSpan()}_initShape(){const t=new qP(this.product,this._option,0);t.init(),this.shape=t,this.children[t.childIndex]=t}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(){const t=new QP(this.product,this._option,1);t.init(),this.textSpan=t,this.children[t.childIndex]=t}setStyle(t){var e,i,n,s;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),{title:o}=a;super.setStyle(ZB({},WP,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 sL="99999999999999";class rL extends GP{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:sL,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 nL(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 iL(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(ZB({},UP,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 aL=t=>{BR.registerComponentPlugin(t.type,t)};class oL extends DP{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(oL.type),this.type=BP.dom,this._tooltipContainer=null==wf?void 0:wf.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(wf&&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=VP(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()}))}}oL.type=BP.dom;class lL extends DP{constructor(){super(lL.type),this.type=BP.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 JA({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()}}lL.type=BP.canvas;const hL=()=>{aL(lL)},cL=(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},dL={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}},uL=(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=yR([],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 pL(a,s,o)},pL=(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)=>{Rf(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=>{Rf(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]=dL[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},gL=(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=>{Rf(t[e])||(t[e]=0)}))})),t};class fL extends JO{_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 mL(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function vL(t,e,i){t&&(i.needDefaultSeriesField&&(t[WE]=i.defaultSeriesField),t[HE]=e,t[GE]=i.getKey(t,e,i))}const yL=["appear","enter","update","exit","disappear","normal"];function _L(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 kL(s)&&delete s.type,s.oneByOne&&(s=xL(s,null!==(n=null==i?void 0:i.dataIndex)&&void 0!==n?n:SL,null==i?void 0:i.dataCount)),s})):o.map(((t,e)=>{var n;let s=ZB({},o[e],a);return kL(s)&&delete s.type,s.oneByOne&&(s=xL(s,null!==(n=null==i?void 0:i.dataIndex)&&void 0!==n?n:SL,null==i?void 0:i.dataCount)),s})),n[r]=l):n[r]=o}return n.state=n.update,n}function bL(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),wL(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 xL(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 SL(t,e){var i,n;return null!==(i=null==t?void 0:t[HE])&&void 0!==i?i:null===(n=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===n?void 0:n.elementIndex}function AL(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 kL(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function wL(t,e){if(_(t))t.forEach(((i,n)=>{t[n]=e(t[n],n),wL(t[n],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),wL(t[i],e)}class TL extends LO{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=U(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=QM(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=tR(R(a,`series.${h}`),h,l,o),d=R(a,`series.${h}_${r}`);return ZB({},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),c(t.stackOffsetSilhouette)&&(this.stack=t.stackOffsetSilhouette||this.stack),p(t.stackValue)&&(this.stack=!0),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",n="initLabelMarkStyle",s,r){if(!t)return;U(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=ZB({},i,n,t),s=i.label;return s&&g(s)&&_(e.label)&&(e.label=e.label.map((t=>ZB({},s,t)))),e};return _(t)?{spec:t.map((t=>s(t))),theme:i}:{spec:s(t),theme:i}}return{spec:t,theme:i}}}class CL extends DO{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:`${ak}_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=TL,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=function(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)}(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)&&(iO(this._rawData.dataSet,"invalidTravel",gL),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=lO(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=oO(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=oO(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new fL(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;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){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];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):this._rawStatisticsCache[t]=pL(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t]}}return e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))&&(this._rawStatisticsCache[t].min=X(this._rawStatisticsCache[t].values),this._rawStatisticsCache[t].max=K(this._rawStatisticsCache[t].values)),this._rawStatisticsCache[t]}_statisticViewData(){iO(this._dataSet,"dimensionStatistics",uL);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&&yR(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){iO(this._dataSet,"dimensionStatistics",uL);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=yR(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&yR(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)&&(iO(this._rawData.dataSet,"addVChartProperty",cL),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:mL.bind(this),call:vL}},!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=_L({},bL(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"}}:Cf(n)||Ef(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=ZB(s,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=ZB(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:gO.STATE_HOVER_REVERSE,highlightState:gO.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:gO.STATE_SELECTED_REVERSE,state:gO.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 t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:WE;this.getMarksWithoutRoot().forEach((t=>{const n={},s={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(n[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{s[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:UE,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][i]]:!0===n[t[i]]});const a={};Object.keys(s).forEach((e=>{a[e]=n=>{var s,a;let o;if(Array.isArray(n)){if(0===n.length)return;o=null===(s=r[n[0][i]])||void 0===s?void 0:s[e]}return o=null===(a=r[n[i]])||void 0===a?void 0:a[e],o||t.getAttribute(e,n)}})),this.setMarkStyle(t,a,UE)}))}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 _P(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=null!=i?i:{data:!0}).invalidType=!0,t.invalidType!==e.invalidType&&(r.reCompile=!0),i.extensionMark=!0,(U(t.extensionMark).length!==U(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((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||hO(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()}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:WE,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),n=this._getDataScheme();return null===(e=(t=(new cB).domain(i)).range)||void 0===e?void 0:e.call(t,n)}_getDataScheme(){return iB(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:WE}}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(...U(y));const a=this.getSpec()||{};T.setMorph(x),T.setMorphKey((null===(n=a.morph)||void 0===n?void 0:n.morphKey)||`${this.getSpecIndex()}`),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,ZB({},h,d||a[T.name]))}return T}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:GE}_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!==$E&&t!==qE&&t!==XE&&t!==ZE||(t=this.getStackValueField()),null!==(e=bR(this.getRawData(),t))&&void 0!==e?e:t}getMarkInfoList(){var t;const e=super.getMarkInfoList();return e.length?e:Object.values(null!==(t=JM[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=>Rf(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:WE]}}function EL(t,e,i){const n=t.getScale(0),s="isInverse"in t&&t.isInverse();yS(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 ML(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}}}CL.mark=uM,CL.transformerConstructor=TL;class BL extends CL{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=U(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=U(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&U(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);yS(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:`${ak}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?U(this._spec.xField)[0]:U(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX($E),this.setFieldX2(XE)):(this.setFieldY($E),this.setFieldY2(XE))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(qE),this.setFieldX2(ZE)):(this.setFieldY(qE),this.setFieldY2(ZE))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(QE),this.setFieldX2(JE)):(this.setFieldY(QE),this.setFieldY2(JE))}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=U(this._spec.xField),this._specYField=U(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(U(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(U(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)&&(EL("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 RL="monotone";class OL{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(_M.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===RL?"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(_M.point,{morph:AL(this._spec,_M.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:`${ak}_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(ZR.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:gO.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[_M.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(ZR.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,ZB({},this._spec[_M.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:gO.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 IL extends eI{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)&&(_S(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);let c=this._styleConvert(h);a&&"angle"===l&&(c=this.convertAngleToRadian(c)),this.setAttribute(l,c,e,i,n)})),o&&this.setEnableSegments(o)}}class PL extends IL{constructor(){super(...arguments),this.type=PL.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)===sk.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}PL.type="line";const LL=()=>{BR.registerMark(PL.type,PL),bb(),cb(),_w.registerGraphic(Ck.line,mc),uI()};class DL extends eI{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class FL extends DL{constructor(){super(...arguments),this.type=FL.type}}FL.type="symbol";const jL=()=>{BR.registerMark(FL.type,FL),bb(),Sb(),_w.registerGraphic(Ck.symbol,pc)};class NL extends TL{_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 zL extends fI{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function VL(t,e,i,n){switch(t){case r.cartesianBandAxis:return YI(NR(i,["z"]),"band",e);case r.cartesianLinearAxis:return YI(NR(i,["z"]),"linear",e);case r.cartesianLogAxis:return YI(NR(i,["z"]),"log",e);case r.cartesianSymlogAxis:return YI(NR(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return YI(NR(i),void 0,e);case r.polarBandAxis:return KI(i.orient,"band",e);case r.polarLinearAxis:return KI(i.orient,"linear",e);case r.polarAxis:return KI(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,n;const s=U(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h}=null!==(n=zI(r.crosshair,t))&&void 0!==n?n:{},c=s.find((t=>DR(t.orient)));let d;d=p(c)?ZB({},XI(c.type)?a:o,l):l;const u=s.find((t=>FR(t.orient)));let g;return g=p(u)?ZB({},bS(u.type)?a:o,h):h,{xField:d,yField:g}})(e,n);case r.polarCrosshair:return((t,e)=>{var i,n;const s=U(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h}=null!==(n=zI(r.crosshair,t))&&void 0!==n?n:{},c=s.find((t=>"angle"===t.orient));let d;d=p(c)?ZB({},XI(c.type)?a:o,l):l;const u=s.find((t=>"radius"===t.orient));let g;return g=p(u)?ZB({},bS(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 HL(i,zI(t,e));default:return zI(t,e)}}const HL=(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=ZB({},e,n);return delete s.horizontal,delete s.vertical,s};class GL extends LO{getTheme(t,e){return VL(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({},_B(e)),{[n]:0}))}}class WL extends jO{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 zL(this)}constructor(e,i){super(e,i),this.name="component",this.modelType="component",this.transformerConstructor=GL,this._delegateEvent=(e,i,n,s=null,r=null)=>{var a,o;i instanceof qr||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 PO({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}}}WL.transformerConstructor=GL;class UL extends eI{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(Ck.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}UL.type="component";const YL=()=>{BR.registerMark(UL.type,UL)},KL=t=>t;class XL extends WL{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 U(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()?Rk.circleAxisGrid:Rk.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=_L(null===(o=BR.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 JO(this._option,t)]}collectData(t,e){const i=[];return ek(this._regions,(n=>{var s;let r=this.collectSeriesField(t,n);if(r=_(r)?yS(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 ek(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=U(t)),p(i)&&(this._regionUserId=U(i)),p(e)&&(this._seriesIndex=U(e)),p(n)&&(this._regionIndex=U(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()})),ek(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(ek(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;tthis._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=CR(n=t.domainLine)).startSymbol=CR(n.startSymbol),n.endSymbol=CR(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 MR(ZB({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:MR(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)=>MR(t[i](e.rawValue,n,e,s,r)):B(t[i])||(e[i]=MR(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 MR(ZB({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:MR(t.tick.style)),t.tick.state&&(i.tick.state=ER(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 MR(ZB({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:MR(t.subTick.style)),t.subTick.state&&(i.subTick.state=ER(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=HI[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?Gt(p):null,textStyle:ZB({},d,MR(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:MR(h.style)}),h.state&&(i.title.state.shape=ER(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:MR(o.style)}),o.state&&(i.title.state.background=ER(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=ER(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=MR(t.background.style)),t.background.state&&(i.panel.state=ER(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 MR(ZB({},null===(s=this._theme.grid)||void 0===s?void 0:s.style,r))}:MR(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:MR(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=VI(t,e);return i?(t,n,s)=>i(n.rawValue,n,e):null}_initTickDataSet(t,e=0){nO(this._option.dataSet,"scale",KL),iO(this._option.dataSet,"ticks",CA);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)}}XL.specKey="axes";const $L=()=>{_w.registerGraphicComponent(Bk.lineAxis,((t,e)=>new cS(t,e))),_w.registerGraphicComponent(Bk.circleAxis,(t=>new gS(t))),_w.registerComponent(Ek.axis,hC),_w.registerGraphicComponent(Rk.lineAxisGrid,((t,e)=>new OA(t,e))),_w.registerGraphicComponent(Rk.circleAxisGrid,((t,e)=>new PA(t,e))),_w.registerComponent(Ek.grid,dC),YL(),BR.registerAnimation("axis",(()=>({appear:{custom:mS},update:{custom:fS},exit:{custom:Fa}})))},ZL=[LI];class qL extends XL{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),ek(this._regions,(t=>{const e=this.getOrient();DR(e)?t.setXAxisHelper(this.axisHelper()):FR(e)?t.setYAxisHelper(this.axisHelper()):jR(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=ZB({x:t.x,y:t.y},this._axisStyle,s);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(ZB({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=DR(this.getOrient()),s=t=>{var e;return(n?!DR(t.getOrient()):DR(t.getOrient()))&&yS(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=NR(i,["z"]),jR(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(!UI(e))return null;const{axisType:t,componentName:n}=zR(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=>FR(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(!UI(t))return;const{axisType:n,componentName:s}=zR(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=BR.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=[];DR(this.getOrient())?A(e)&&(o=this._inverse?[e-s,n]:[n,e-s]):jR(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(ZL.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){DR(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&&!DR(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),!jR(this.getOrient())&&this._spec.innerOffset){const t=this._spec;FR(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=vB(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=vB(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=DR(this.getOrient())?t.fieldX:jR(this.getOrient())?t.fieldZ:t.fieldY,yS(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:yS(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&&(DR(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=DR(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 ek(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]:DR(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:jR(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,s}updateSeriesScale(){const t=this.getOrient();ek(this._regions,(e=>{DR(t)?(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):FR(t)?(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):jR(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=DR(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=DR(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=ZB(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 $I(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}=WI(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>=JL?10:s>=QL?5:s>=tD?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 iD extends qL{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new lA}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}}iD.type=r.cartesianLinearAxis,iD.specKey="axes",W(iD,eD);const nD=()=>{$L(),BR.registerComponent(iD.type,iD)};class sD extends qL{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new VS}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=OS(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=U(e).concat(i);if(s.push(r),o){const e=$I(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=>$I(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 rD=()=>{$L(),BR.registerComponent(sD.type,sD)};class aD extends iD{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),ek(this._regions,(t=>{DR(this.getOrient())?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=ZB({},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 JO(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=>$I(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=>$I(e.value,this._getNormalizedValue([e.value],t))))),n}transformScaleDomain(){}}aD.type=r.cartesianTimeAxis,aD.specKey="axes";class oD extends iD{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new dA}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(){}}oD.type=r.cartesianLogAxis,oD.specKey="axes",W(oD,eD);class lD extends iD{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new uA}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}transformScaleDomain(){}}lD.type=r.cartesianSymlogAxis,lD.specKey="axes",W(lD,eD);class hD extends BL{constructor(){super(...arguments),this.type=sk.line,this.transformerConstructor=NL,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(_L(null===(i=BR.getAnimationInKey("line"))||void 0===i?void 0:i(s,r),bL("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=ML(this);this._symbolMark.setAnimationConfig(_L(null===(n=BR.getAnimationInKey("scaleInOut"))||void 0===n?void 0:n(),bL("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]}}hD.type=sk.line,hD.mark=bM,hD.transformerConstructor=NL,W(hD,OL);class cD{get dataList(){return this._dataArr}constructor(t,e){this._dataArr=[],this._onError=e,this._dataSet=t}parseData(t){this._dataArr=[];const e=U(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(n,((t,e)=>{hO(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 dD{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)=>{Of(i.domain)&&i.domain.forEach((n=>{n.dataId===t&&n.fields.forEach((t=>{yR(e,[{key:t,operations:yS(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&&yR(e,[{key:i.field,operations:yS(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?uB("colorOrdinal"):uB(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(Of(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),Of(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(!Of(e.domain))return e.domain&&0!==e.domain.length||n.domain(t),void this._updateMarkScale(i,n,n.domain().slice());let s;s=yS(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const n=yS(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;yS(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(yS(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const n=this._getSeriesBySeriesId(t.seriesId),s=yS(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)));yS(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 uD{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=xR(t,!0);for(const e in a)for(const i in a[e].nodes)wR(a[e].nodes[i],t.getStackInverse(),s);if(r)for(const t in a)for(const e in a[t].nodes)kR(a[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),n=t.getStackValueField();e&&n&&AR(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 pD extends MO{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=Bf(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:ok,height:lk},this._viewRect={width:ok,height:lk},this._viewBox={x1:0,y1:0,x2:ok,y2:lk},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)=>U(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=_B(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new JR(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new cD(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._spec.background&&"object"==typeof this._spec.background&&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 uD(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=function(t){if(!t)return null;if("string"==typeof t)return{fill:t,fillOpacity:1};if("object"!=typeof t)return null;const e=N(t,["x","y","width","height","x1","y1","image"]);return e.background=t.image,e}(this._spec.background);t&&(this._backgroundMark=BR.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({},t),{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=BR.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 DO)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 eI))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof eI)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){U(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),U(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&hO(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=bO(this._spec,this._option,{width:ok,height:lk})),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=iB(n),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new dD(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){xO(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=iB(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{xO(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{var n,s;const r=i.specKey||i.type,a=null!==(n=this._spec[r])&&void 0!==n?n:{};_(a)?(e[r]=e[r]||{specCount:a.length,componentCount:0},e[r].componentCount++,xO(t,i.updateSpec(null!==(s=a[i.getSpecIndex()])&&void 0!==s?s:{},a))):xO(t,i.updateSpec(a))}));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()];xO(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=yB(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(gO.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(gO.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(gO.STATE_SELECTED)}clearHovered(){this.clearState(gO.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?U(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===ZR.dimensionHover||n===ZR.dimensionClick){const i=s.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>bS(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=>{r?i[t.series.fieldY[0]]=n:i[t.series.fieldX[0]]=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 gD=(t,e)=>{var i;const n=t.spec,{regionId:s,regionIndex:r}=n;if(p(s)){const t=U(s);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return U(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class fD{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);UB(t,r,l.spec),UB(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}));UB(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=gD(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=gD(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=U(s);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return U(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(BR.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(BR.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=BR.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,n.forEach((t=>{const n=BR.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=BR.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(U(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(U(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 mD extends fD{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")&&ZB(i,SO(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 vD extends mD{_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),_O(t)}}class yD extends pD{constructor(){super(...arguments),this.transformerConstructor=vD,this.type="line",this.seriesType=sk.line,this._canStack=!0}}yD.type="line",yD.seriesType=sk.line,yD.transformerConstructor=vD;function _D(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 bD=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:_D(t,e)}),xD=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:_D(t,e)}),SD={type:"fadeIn"},AD={type:"growCenterIn"};function kD(t,e){if(!1===e)return{};switch(e){case"fadeIn":return SD;case"scaleIn":return AD;default:return bD(t)}}class wD extends eI{constructor(){super(...arguments),this.type=wD.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}wD.type="rect";const TD=()=>{BR.registerMark(wD.type,wD),bb(),mb(),_w.registerGraphic(Ck.rect,_c),aC.useRegisters([uE,pE,gE,fE,cE,dE])};function CD(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[pM]):this._spec.barMinHeight?this._calculateRectPosition(t,!1):pB(this._dataToPosX(t),e),this._getBarXEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[gM]):pB(this._dataToPosX1(t),e),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[fM]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):pB(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[mM]):pB(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({},BD.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{morph:AL(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(BD.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(iO(this._option.dataSet,"addVChartProperty",cL),n){const t=([t],{scaleDepth:e})=>{var i;let n=[{}];const s=this.getDimensionField(),r=u(e)?s.length:Math.min(s.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};iO(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:mL.bind(this),call:vL}},!1),null==e||e.target.addListener("change",s.reRunAllTransform)}this._barBackgroundViewData=new fL(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=mM,n=fM,s="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=gM,n=pM,s="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=xR(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)CD(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=pB(this[s](t),o),d=pB(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[XE],s=t[$E],r=t[ZE],h=t[qE];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]),{[XE]:i,[$E]:n}),a?{[ZE]:o,[qE]:l}:void 0);t.push(_c(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=>pB(this._dataToPosY(t),a),y1:t=>pB(this._dataToPosY1(t),a)}:{y:t=>pB(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=>pB(this._dataToPosX(t),r),x1:t=>pB(this._dataToPosX1(t),r)}:{x:t=>pB(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=ML(this);this._barMark.setAnimationConfig(_L(null===(e=BR.getAnimationInKey("bar"))||void 0===e?void 0:e(i,n),bL(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;if(void 0!==this._spec.barWidth&&r===s)return xB(this._spec.barWidth,a);const o=void 0!==this._spec.barMinWidth,l=void 0!==this._spec.barMaxWidth;let h=a;return o&&(h=Math.max(h,xB(this._spec.barMinWidth,a))),l&&(h=Math.min(h,xB(this._spec.barMaxWidth,a))),h}_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=U(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=xB(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 _=yS(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}}BD.type=sk.bar,BD.mark=vM,BD.transformerConstructor=MD;const RD=()=>{CC(),TD(),BR.registerAnimation("bar",((t,e)=>({appear:kD(t,e),enter:bD(t,!1),exit:xD(t,!1),disappear:xD(t)}))),rD(),nD(),BR.registerSeries(BD.type,BD)};class OD extends mD{_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),_O(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 ID extends pD{constructor(){super(...arguments),this.transformerConstructor=OD,this.type="bar",this.seriesType=sk.bar,this._canStack=!0}}ID.type="bar",ID.seriesType=sk.bar,ID.transformerConstructor=OD;class PD extends IL{constructor(){super(...arguments),this.type=PD.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}PD.type="area";const LD=()=>{BR.registerMark(PD.type,PD),bb(),sb(),_w.registerGraphic(Ck.area,Lc),uI()};class DD extends _P{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var n,s,r,a;for(const i of U(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 FD=()=>{BR.registerAnimation("area",cI),dI(),hI()};class jD extends NL{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=ZB({},f.style,g.style),l.state=ZB({},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 ND extends BL{constructor(){super(...arguments),this.type=sk.area,this.transformerConstructor=jD,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(ND.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===RL?"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 pB(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 pB(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(_L(null===(e=BR.getAnimationInKey("line"))||void 0===e?void 0:e(s,r),bL("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(_L(null===(i=BR.getAnimationInKey("area"))||void 0===i?void 0:i(s,r),bL("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=ML(this);this._symbolMark.setAnimationConfig(_L(null===(n=BR.getAnimationInKey("scaleInOut"))||void 0===n?void 0:n(),bL("point",this._spec,this._markAttributeContext),t))}}initTooltip(){this._tooltipHelper=new DD(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}}}ND.type=sk.area,ND.mark=SM,ND.transformerConstructor=jD,W(ND,OL);class zD extends mD{_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),_O(t)}}class VD extends pD{constructor(){super(...arguments),this.transformerConstructor=zD,this.type="area",this.seriesType=sk.area,this._canStack=!0}}VD.type="area",VD.seriesType=sk.area,VD.transformerConstructor=zD;class HD extends CL{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)?U(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?U(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=U(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(U(t)),n=this.radiusAxisHelper.dataToPosition(U(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:[]};yS(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:[]};yS(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)&&EL(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 GD=(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[fk],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[fk]*t;g(e,b,i),b+=i}))}return 0!==f&&(i[i.length-1][l]=r),i};function WD(t,e,i){return(n,s,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(n,s,i)}:{overall:!1}}const UD=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:WD(t,!0,uO.appear)}),YD={type:"fadeIn"},KD=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:WD(t,!0,uO.enter)}),XD=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:WD(t,!0,uO.exit)}),$D=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:WD(t,!0,uO.exit)});function ZD(t,e){if(!1===e)return{};switch(e){case"fadeIn":return YD;case"growRadius":return UD(Object.assign(Object.assign({},t),{growField:"radius"}));default:return UD(Object.assign(Object.assign({},t),{growField:"angle"}))}}class qD extends eI{constructor(t,e){super(t,e),this.type=JD.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)=>Ut({x:0,y:0},this.getAttribute("centerOffset",e,i,n),e[bk])[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 JD extends qD{constructor(){super(...arguments),this.type=JD.type}}JD.type="arc";const QD=()=>{bb(),ib(),_w.registerGraphic(Ck.arc,jc),aC.useRegisters([kE,wE,SE,AE]),BR.registerMark(JD.type,JD)};class tF extends TL{_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=ZB({},this._theme,i,t);const s=(t,e)=>ZB({},"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 eF extends HD{constructor(){super(...arguments),this.transformerConstructor=tF,this._pieMarkName="pie",this._pieMarkType="arc",this._startAngle=Ak,this._endAngle=kk,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this.dataToCentralPosition=t=>{const e=t[bk];if(u(e))return null;const i=this.computeDatumRadius(t),n=this.computeDatumInnerRadius(t);return Ut(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;iO(this._dataSet,"pie",GD),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:vk,asEndAngle:yk,asRatio:mk,asMiddleAngle:bk,asRadian:Sk,asQuadrant:xk,asK:_k}},!1);const e=new fi(this._dataSet,{name:`${ak}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new fL(this._option,e)}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},eF.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{morph:AL(this._spec,this._pieMarkName),defaultMorphElementKey:this._seriesField,key:GE,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 nk(vk)(t)}endAngleScale(t){return nk(yk)(t)}initMarkStyle(){const e=this._pieMark;e&&this.setMarkStyle(e,{x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:gB(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:gB(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:nk(uk).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[bk];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const n=this.computeDatumRadius(t);return Ut(this.computeCenter(t),n,i)}initAnimation(){var t,e;const i={growFrom:(t,e,i)=>{var n;if(i===uO.appear)return this._startAngle;if(i===uO.disappear)return this._endAngle;const s=[uO.disappear,uO.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[HE];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[HE]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[HE])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[HE])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+Ut({x:0,y:0},a,e[bk]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+Ut({x:0,y:0},a,e[bk]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+Ut({x:0,y:0},a,e[bk]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+Ut({x:0,y:0},a,e[bk]).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]}}eF.transformerConstructor=tF,eF.mark=kM;class iF extends eF{constructor(){super(...arguments),this.type=sk.pie}}iF.type=sk.pie;const nF=()=>{QD(),BR.registerAnimation("pie",((t,e)=>({appear:ZD(t,e),enter:KD(t),exit:XD(t),disappear:$D(t)}))),BR.registerSeries(iF.type,iF)};class sF extends fD{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,n;const s=U(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 rF extends sF{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 aF extends pD{constructor(){super(...arguments),this.transformerConstructor=rF}}aF.transformerConstructor=rF;class oF extends aF{constructor(){super(...arguments),this.transformerConstructor=rF,this.type="pie",this.seriesType=sk.pie}}oF.type="pie",oF.seriesType=sk.pie,oF.transformerConstructor=rF;class lF extends fD{_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")&&ZB(e,SO(this.type,t))})),this._transformAxisSpec(t)}}class hF extends pD{constructor(){super(...arguments),this.transformerConstructor=lF,this.type="common",this._canStack=!0}}hF.type="common",hF.transformerConstructor=lF;const cF={rect:fF,symbol:pF,arc:vF,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=pF(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=dF(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),lh(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:yF,area:yF,rect3d:fF,arc3d:vF,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function dF(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}=VI(i,n,o.text,e);return h&&(o.text=h(...c,{series:a})),o}function uF(t){return d(t)?e=>t(e.data):t}function pF(t){var e,i,n;const{series:s,labelSpec:r}=t,a="horizontal"===s.direction?"right":"top",o=null!==(e=uF(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:gF(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function gF(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function fF(t){var e,i,n,s,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=uF(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:mF(o)};let g=!1;return y(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function mF(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 vF(t){var e;const{labelSpec:i}=t,n=null!==(e=uF(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 yF(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 _F extends WL{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)))}}_F.type=r.label;class bF extends eI{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=bF.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})}}bF.type="text";class xF extends bF{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}}xF.type="text",xF.constructorType="label";const SF=()=>{BR.registerMark(xF.constructorType,xF),bb(),kb(),yb(),_w.registerGraphic(Ck.text,lh)};class AF extends GL{_initTheme(t,e){return{spec:t,theme:this._theme}}}class kF extends _F{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=AF,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),ek(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=ZB({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=cF[t])&&void 0!==i?i:cF.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}:dF(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}}kF.type=r.label,kF.specKey="label",kF.transformerConstructor=AF;var wF;!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(wF||(wF={}));const TF={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class CF extends WL{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=>{this._handleIn(t),this._clickLock=this._hasActive&&this._spec.lockAfterClick,this._clickLock&&S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._clickLock=!1,this._handleOutEvent()}),this.triggerOff))},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"}:Cf(e)||Ef(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=this.trigger||"hover",e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;if(_(t)){const n=[];return t.forEach((t=>{n.push({click:"click"===t,in:i[t],out:e(t)})})),n}return[{click:"click"===t,in:i[t],out:e(t)}]}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)=>{TF[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||t.yField)&&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){DR(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=>{bS(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[0],n=e.series.dataToPosition(e.datum[0]);(p(t.dimType)?"y"===t.dimType:FR(null===(s=null==t?void 0:t.axis)||void 0===s?void 0:s.getOrient()))?a=n.y:r=n.x}else if("mark"===n){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=e.x,a=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=ik(this._regions,"cartesian");if(!e)return;const{x:i,y:n,offsetWidth:s,offsetHeight:r,bandWidth:a,bandHeight:o}=qI(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=tP(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=eP(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 ix(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(s=new nx(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 Jb(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]}}EF.specKey="crosshair",EF.type=r.cartesianCrosshair;class MF{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=YR(s,a,!0))&&void 0!==e?e:[],...null!==(i=LR(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(!bS(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=mP(n).includes(t):p(e.visible)||p(e.activeType)?d.visible=mP(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)&&(wP(n).every((t=>{var e;return!mP(null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec).includes("dimension")}))?d.visible=!1:p(e.visible)||p(e.activeType)?d.visible=mP(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=AP(t,i,n),f=kP(t,i,n),m=ZB({},P(e[t]),f),v=g.title,y=CP(void 0,m,u.shape,void 0,v);p(m.title)?m.title=xP(m.title,Object.assign(Object.assign({},v),y)):m.title=xP(v,y,!0);const _=U(g.content);if(p(m.content)){const t=TP(_);m.content=SP(m.content,(e=>CP(e,m,u.shape,t)))}else m.content=SP(_,(t=>CP(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=PP(a,t,e),l=!!p(o)&&!1!==MP(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 BF extends MF{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 RF extends MF{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 OF extends MF{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:n,series:s,dimensionInfo:r}=t,a=[{datum:U(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)?U(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 U(n);const r=s.getViewData().latestData,a=s.getSeriesField();if(!a)return r;const o=U(n)[0][a];return r.filter((t=>t[a]===o))}}const IF=t=>p(t)&&!_(t),PF=t=>p(t)&&_(t);class LF extends GL{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:n}=super._initTheme(t,e);return i.style=ZB({},this._theme,i.style),{spec:i,theme:n}}_transformSpecAfterMergingTheme(t,e,i){var n,s,r,a,o,l,h,c,d;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(n=t.visible)||void 0===n||n,t.activeType=mP(t),t.renderMode=null!==(s=t.renderMode)&&void 0!==s?s:Ef(this._option.mode)||!Tf(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=null===(d=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===d?void 0:d.getElementById(t.parentElement)):Tf(this._option.mode)&&(t.parentElement=null==wf?void 0:wf.body)}}class DF extends WL{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=LF,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._getMouseOutHandler=t=>e=>{var i,n,s;if(this._alwaysShow)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=Tf(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(!t&&this._clickLock)return;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&&IF(this._cacheInfo)?a.mark=this._showTooltipByMouseEvent("mark",i,e,t,!0):r&&PF(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),t&&this._clickLock&&(this._clickLock=!1))},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(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));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&vI.globalConfig.uniqueTooltip&&l&&vI.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._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?BP.canvas:BP.dom,s=BR.getComponentPluginInType(t);s||Sf("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 RF(this),dimension:new BF(this),group:new OF(this)}}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=U(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)),(Cf(i)||Ef(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)))}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=gP(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(PF(t)){if(IF(this._cacheInfo))return!1;const e=this._cacheInfo;if(!(e.length===t.length&&t.every(((t,i)=>RR(t,e[i])))))return!1}else{if(PF(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}}DF.type=r.tooltip,DF.transformerConstructor=LF,DF.specKey="tooltip";function FF(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=MR(t.style)),B(t.textStyle)||ZB(n.textStyle,MR(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&MR(n.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&MR(n.background.style),n}(n)),B(s.focusIconStyle)||MR(s.focusIconStyle),s.shape&&(s.shape=CR(s.shape)),s.label&&(s.label=CR(s.label)),s.value&&(s.value=CR(s.value)),s.background&&(s.background=CR(s.background)),mB(s.maxWidth)&&(s.maxWidth=Number(s.maxWidth.substring(0,s.maxWidth.length-1))*i.width/100),mB(s.width)&&(s.width=Number(s.width.substring(0,s.width.length-1))*i.width/100),mB(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)||MR(r.railStyle),B(r.sliderStyle)||MR(r.sliderStyle)):(B(r.textStyle)||MR(r.textStyle),r.handler&&CR(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(ZB(b,a.style),p(a.padding)&&(b.padding=a.padding)),b}const jF=(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},NF=(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:WE;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 zF extends WL{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:()=>{ek(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),ek(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=fB(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=U(n)),p(e)&&(this._regionUserId=U(e)),p(s)&&(this._seriesIndex=U(s)),p(i)&&(this._regionUserIndex=U(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 JO(this._option,e),this._initSelectedData(),ek(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)||(ek(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(ZB({},n,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(ZB({},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(ZB({},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}}zF.specKey="legends";class VF extends zF{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),ek(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:cO.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){iO(this._option.dataSet,"discreteLegendFilter",NF),iO(this._option.dataSet,"discreteLegendDataMake",jF);const t=new fi(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return ek(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(!Of(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=bR(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},FF(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(i),this._addLegendItemFormatMethods(i),i}_getLegendConstructor(){return KA}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(HA.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(HA.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(HA.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}=VI(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=VI(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}VF.specKey="legends",VF.type=r.discreteLegend;vI.useRegisters([()=>{CC(),EC(),LL(),jL(),dI(),hI(),rD(),nD(),BR.registerSeries(hD.type,hD),BR.registerChart(yD.type,yD)},()=>{CC(),EC(),LL(),LD(),jL(),FD(),rD(),nD(),BR.registerSeries(ND.type,ND),BR.registerChart(VD.type,VD)},()=>{RD(),BR.registerChart(ID.type,ID)},()=>{nF(),BR.registerChart(oF.type,oF)},()=>{BR.registerChart(hF.type,hF)},nD,rD,()=>{BR.registerComponent(VF.type,VF)},()=>{BR.registerComponent(DF.type,DF)},()=>{BR.registerComponent(EF.type,EF)},()=>{_w.registerGraphicComponent(Ek.label,(t=>new Fx(t))),_w.registerComponent(Ek.label,cC),SF(),YL(),BR.registerComponent(kF.type,kF,!0)},hL,CI,Nw,jw]),vI.useRegisters([()=>{Wy(Ys)}]),t.ARC_END_ANGLE=yk,t.ARC_K=_k,t.ARC_MIDDLE_ANGLE=bk,t.ARC_QUADRANT=xk,t.ARC_RADIAN=Sk,t.ARC_RATIO=mk,t.ARC_START_ANGLE=vk,t.ARC_TRANSFORM_VALUE=fk,t.AxisSyncPlugin=LI,t.BASE_EVENTS=IE,t.CORRELATION_SIZE=zE,t.CORRELATION_X=jE,t.CORRELATION_Y=NE,t.CanvasTooltipHandler=lL,t.DEFAULT_CHART_HEIGHT=lk,t.DEFAULT_CHART_WIDTH=ok,t.DEFAULT_CONICAL_GRADIENT_CONFIG=cM,t.DEFAULT_DATA_INDEX=HE,t.DEFAULT_DATA_KEY=GE,t.DEFAULT_DATA_SERIES_FIELD=WE,t.DEFAULT_GRADIENT_CONFIG=dM,t.DEFAULT_LABEL_ALIGN=ck,t.DEFAULT_LABEL_LIMIT=hk,t.DEFAULT_LABEL_TEXT=dk,t.DEFAULT_LABEL_VISIBLE=uk,t.DEFAULT_LABEL_X=pk,t.DEFAULT_LABEL_Y=gk,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_GRADIENT_CONFIG=lM,t.DEFAULT_MEASURE_CANVAS_ID=VE,t.DEFAULT_RADIAL_GRADIENT_CONFIG=hM,t.DEFAULT_SERIES_STYLE_NAME=UE,t.DomTooltipHandler=oL,t.Factory=BR,t.FormatterPlugin=TI,t.GradientType=oM,t.MediaQuery=SI,t.POLAR_DEFAULT_RADIUS=.6,t.POLAR_END_ANGLE=270,t.POLAR_END_RADIAN=kk,t.POLAR_START_ANGLE=-90,t.POLAR_START_RADIAN=Ak,t.PREFIX=ak,t.SEGMENT_FIELD_END=sM,t.SEGMENT_FIELD_START=nM,t.STACK_FIELD_END=$E,t.STACK_FIELD_END_OffsetSilhouette=QE,t.STACK_FIELD_END_PERCENT=qE,t.STACK_FIELD_KEY=KE,t.STACK_FIELD_START=XE,t.STACK_FIELD_START_OffsetSilhouette=JE,t.STACK_FIELD_START_PERCENT=ZE,t.STACK_FIELD_TOTAL=tM,t.STACK_FIELD_TOTAL_PERCENT=eM,t.STACK_FIELD_TOTAL_TOP=iM,t.ThemeManager=gR,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=vI,t.WaterfallDefaultSeriesField=FE,t.builtinThemes=nR,t.computeActualDataScheme=nB,t.darkTheme=GB,t.dataScheme=SB,t.default=vI,t.defaultThemeName=sR,t.getActualColor=rB,t.getColorSchemeBySeries=hB,t.getDataScheme=iB,t.getMergedTheme=uR,t.getTheme=hR,t.hasThemeMerged=oR,t.isColorKey=aB,t.isProgressiveDataColorScheme=oB,t.isTokenKey=zB,t.lightTheme=HB,t.queryColorFromColorScheme=sB,t.queryToken=NB,t.registerCanvasTooltipHandler=hL,t.registerChartPlugin=xI,t.registerDomTooltipHandler=()=>{aL(oL)},t.registerFormatPlugin=CI,t.registerMediaQuery=()=>{xI(SI)},t.registerTheme=lR,t.removeTheme=cR,t.themeExist=dR,t.themes=rR,t.token=VB,t.transformColorSchemeToStandardStruct=lB,t.version="1.11.4",t.vglobal=cg,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,a;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 Wt=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 Ut(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 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=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"):Ue[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=Ue[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 Ue={"%":(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 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 Un{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 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 Un(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){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"linearClosed":return ss(t,i)}}class as 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 os=["l",0,0,0,0,0,0,0];function ls(t,e,i){const n=os[0]=t[0];if("a"===n||"A"===n)os[1]=e*t[1],os[2]=i*t[2],os[3]=t[3],os[4]=t[4],os[5]=t[5],os[6]=e*t[6],os[7]=i*t[7];else if("h"===n||"H"===n)os[1]=e*t[1];else if("v"===n||"V"===n)os[1]=i*t[1];else for(let n=1,s=t.length;n{it.getInstance().warn("空函数")}}),ks=Object.assign(Object.assign({},ms),{points:[],cornerRadius:0,closePath:!0}),ws=Object.assign(Object.assign({},ms),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},ms),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const Ts=Object.assign(Object.assign({},ms),{symbolType:"circle",size:10,keepDirIn3d:!0}),Cs=Object.assign(Object.assign(Object.assign({},ms),ps),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Es=Object.assign(Object.assign(Object.assign({},ms),ps),{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}),Ms=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},ms),{fill:!0,cornerRadius:0}),Bs=Object.assign(Object.assign({},Ms),{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 Rs=new class{},Os={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"}},Is=!0,Ps=!1,Ls=/\w|\(|\)|-/,Ds=/[.?!,;:/,。?!、;:]/,Fs=/\S/;function js(t,e,i,n,s){if(!e||e<=0)return 0;const r=Rs.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=Ns(t,a)),a}function Ns(t,e){let i=e;for(;Ls.test(t[i-1])&&Ls.test(t[i])||Ds.test(t[i]);)if(i--,i<=0)return e;return i}function zs(t,e){const i=Rs.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 Vs=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 Hs=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=Cs.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=Ns(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=Ns(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}};Hs=Vs([Bi()],Hs);var Gs=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 Ws=Symbol.for("TextMeasureContribution");let Us=class extends Hs{};Us=Gs([Bi()],Us);const Ys=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 Ui(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)}},Ks=Symbol.for("CanvasFactory"),Xs=Symbol.for("Context2dFactory");function $s(t){return Ys.getNamed(Ks,Rs.global.env)(t)}const Zs=1e-4,qs=Math.sqrt(3),Js=1/3;function Qs(t){return t>-pr&&tpr||t<-pr}const er=[0,0],ir=[0,0],nr=[0,0];function sr(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function rr(t,e,i,n){const s=1-n;return s*(s*t+2*n*e)+n*n*i}function ar(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 or(t){return(t%=kt)<0&&(t+=kt),t}function lr(t,e,i,n,s,r){if(r>e&&r>n||rs?o:0}function hr(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 ur(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(Qs(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 fr=[-1,-1,-1],mr=[-1,-1];function vr(){const t=mr[0];mr[0]=mr[1],mr[1]=t}function yr(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(Qs(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,Js):Math.pow(i,Js),n=n<0?-Math.pow(-n,Js):Math.pow(n,Js);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+qs*Math.sin(e)))/(3*a),h=(-o+i*(n-qs*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,fr);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&vr(),p=ar(e,n,r,o,mr[0]),u>1&&(g=ar(e,n,r,o,mr[1]))),2===u?ce&&o>n&&o>r||o=0&&t<=1&&(s[l++]=t)}}else{const t=a*a-4*r*o;if(Qs(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,fr);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=rr(e,n,r,h);for(let n=0;ni||o<-i)return 0;const l=Math.sqrt(i*i-o*o);fr[0]=-l,fr[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>=fr[0]+t&&a<=fr[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=fr[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 xr(t){return Math.round(t/xt*1e8)/1e8%2*xt}function Sr(t,e){let i=xr(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-xr(i-s)):e&&i1&&(i||(h+=lr(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;Ar[0]=S,Ar[1]=A,Sr(Ar,Boolean(a[6])),S=Ar[0],A=Ar[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(ur(c,d,m,v,e,n,s))return!0}else h+=lr(c,d,m,v,n,s)||0;c=m,d=v;break;case hn.C:if(i){if(cr(c,d,m,v,y,_,b,x,e,n,s))return!0}else h+=yr(c,d,m,v,y,_,b,x,n,s)||0;c=b,d=x;break;case hn.Q:if(i){if(hr(c,d,m,v,y,_,e,n,s))return!0}else h+=_r(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+=lr(c,d,o,l,n,s),i){if(dr(m,v,y,k,k+w,T,e,C,s))return!0}else h+=br(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(ur(u,p,o,p,e,n,s)||ur(o,p,o,l,e,n,s)||ur(o,l,u,l,e,n,s)||ur(u,l,u,p,e,n,s))return!0}else h+=lr(o,p,o,l,n,s),h+=lr(u,l,u,p,n,s);break;case hn.Z:if(i){if(ur(c,d,u,p,e,n,s))return!0}else h+=lr(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},Cr=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Er=Symbol.for("VWindow"),Mr=Symbol.for("WindowHandlerContribution");let Br=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&&(Ys.getNamed(Mr,t.env).configure(this,t),this.actived=!0)},this._uid=mi.GenAutoIncrementId(),this.global=Rs.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)}};Br=Tr([Bi(),Cr("design:paramtypes",[])],Br);var Rr=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},Or=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ir=function(t,e){return function(i,n){e(i,n,t)}};let Pr=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=Rs.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=wr.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:ps.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:ps.fontFamily,fontSize:ps.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=Ys.get(Er),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 Lr;Pr=Rr([Bi(),Ir(0,Ei(Yi)),Ir(0,Ri(Ws)),Or("design:paramtypes",[Object])],Pr),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Lr||(Lr={}));const Dr=new Xt;let Fr=class{constructor(){this.matrix=new Xt}init(t){return this.mode=Lr.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Lr.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(Dr.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(Dr.a,Dr.b,Dr.c,Dr.d,Dr.e,Dr.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Dr.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(Dr.a,Dr.b,Dr.c,Dr.d,Dr.e,Dr.f),this}scale(t,e,i){return this.mode===Lr.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Lr.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Dr.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Dr.a,Dr.b,Dr.c,Dr.d,Dr.e,Dr.f),this}translate(t,e){return this.mode===Lr.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Lr.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Fr=Rr([Bi(),Or("design:paramtypes",[])],Fr);const jr={arc:vs,area:ys,circle:_s,line:Ss,path:As,symbol:Ts,text:Cs,rect:ws,polygon:ks,richtext:Es,richtextIcon:Bs,image:Ms,group:bs,glyph:xs},Nr=Object.keys(jr);function zr(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Vr={arc:Object.assign({},jr.arc),area:Object.assign({},jr.area),circle:Object.assign({},jr.circle),line:Object.assign({},jr.line),path:Object.assign({},jr.path),symbol:Object.assign({},jr.symbol),text:Object.assign({},jr.text),rect:Object.assign({},jr.rect),polygon:Object.assign({},jr.polygon),richtext:Object.assign({},jr.richtext),richtextIcon:Object.assign({},jr.richtextIcon),image:Object.assign({},jr.image),group:Object.assign({},jr.group),glyph:Object.assign({},jr.glyph)};class Hr{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Nr.forEach((t=>{this._defaultTheme[t]=Object.create(Vr[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;Nr.forEach((n=>{const s=Object.create(Vr[n]);t&&t[n]&&zr(s,t[n]),i[n]&&zr(s,i[n]),e[n]&&zr(s,e[n]),this.combinedTheme[n]=s})),e.common&&Nr.forEach((t=>{zr(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 Gr=new Hr;function Wr(t,e){return t.glyphHost?Wr(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)):Gr.getTheme()}return null}(t)||t.attachedThemeGraphic&&Wr(t.attachedThemeGraphic)||Gr.getTheme()}var Ur=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 Yr 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 Ur(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 $r))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(Qr(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 $r))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=Qr(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 $r))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=Qr(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 $r))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=Qr(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 $r))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=Jr.now(),s=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(s,"pointerup"),"touch"===s.pointerType)this.dispatchEvent(s,"touchend");else if(Qr(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(Qr(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,Qr(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 $r))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"):Qr(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 Zr))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=Jr.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 ta(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 $r,this.rootWheelEvent=new Zr,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 sa{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return sa.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 ra{static Avaliable(){return!0}avaliable(){return ra.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 aa{static Avaliable(){return!!Rs.global.getRequestAnimationFrame()}avaliable(){return aa.Avaliable()}tick(t,e){Rs.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var oa;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(oa||(oa={}));class la{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-la.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*la.bounceIn(2*t):.5*la.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}}}la.quadIn=la.getPowIn(2),la.quadOut=la.getPowOut(2),la.quadInOut=la.getPowInOut(2),la.cubicIn=la.getPowIn(3),la.cubicOut=la.getPowOut(3),la.cubicInOut=la.getPowInOut(3),la.quartIn=la.getPowIn(4),la.quartOut=la.getPowOut(4),la.quartInOut=la.getPowInOut(4),la.quintIn=la.getPowIn(5),la.quintOut=la.getPowOut(5),la.quintInOut=la.getPowInOut(5),la.backIn=la.getBackIn(1.7),la.backOut=la.getBackOut(1.7),la.backInOut=la.getBackInOut(1.7),la.elasticIn=la.getElasticIn(1,.3),la.elasticOut=la.getElasticOut(1,.3),la.elasticInOut=la.getElasticInOut(1,.3*1.5);class ha{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 ca=new ha;class da{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(){}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 ua extends da{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let pa=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]:ca;this.id=t,this.timeline=e,this.status=_n.INITIAL,this.tailAnimate=new ga(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.duration===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 ua((()=>{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 ga(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()}};pa.mode=bn.NORMAL,pa.interpolateMap=new Map;class ga{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 fa(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?la[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?la[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 fa(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 fa{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 ma=200,va="cubicOut",ya=1e3,_a="quadInOut";var ba;!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"}(ba||(ba={}));const xa=[!1,!1,!1,!1],Sa=[0,0,0,0],Aa=t=>t?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Sa[0]=t[0],Sa[2]=t[0],Sa[1]=t[1],Sa[3]=t[1],Sa):t:t:0,ka=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],wa=[1,2,3,0,1,2,3,0];function Ta(t,e,i,n){for(;t>=kt;)t-=kt;for(;t<0;)t+=kt;for(;t>e;)e+=kt;ka[0].x=i,ka[1].y=i,ka[2].x=-i,ka[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]:Ra.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)}}Ra.TimeOut=1e3/60;const Oa=new Ra,Ia=(t,e)=>y(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class Pa extends da{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 La;!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"}(La||(La={}));class Da extends da{constructor(t,e,i,n,s){super(t,e,i,n,s),this.newPointAnimateType="appear"===(null==s?void 0:s.newPointAnimateType)?"appear":"grow"}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}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?[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=Ca(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}}class Fa extends da{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 ja extends da{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?la[s]:s;e=r(e),n.onUpdate(t,e,i)})),this.updating=!1)}}function Na(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 za(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 Ya(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 Ka(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 Za(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}))),Qa=(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]},to=(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 Qa(t,{x:n,y:e.y1},{x:n,y:e.y2})}const s=e.y1+n/2;return Qa(t,{x:e.x1,y:s},{x:e.x2,y:s})})(t);to(s[0],n,i),to(s[1],e-n,i)}};var eo;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(eo||(eo={}));class io{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eo.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===eo.Color1){const e=io.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];io.store1[t]=e,io.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=io.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&&(io.store1[t]=[s.r/255,s.g/255,s.b/255,s.opacity],io.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===eo.Color1){if(io.store1[t])return;io.store1[t]=i,io.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(io.store255[t])return;io.store255[t]=i,io.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function no(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 so(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)=>ro(_(t)?t[r]:t,_(e)?e[r]:e,i,n))):ro(t,e,i,n,s)}function ro(t,e,i,n,s){if(!t||!e)return t&&no(t)||e&&no(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=io.Get(t,eo.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=io.Get(e,eo.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:no(a)})))});return o?so(r,l,i,n,s):so(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:lo(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:lo(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:lo(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),no(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)}io.store255={},io.store1={};const ao=[0,0,0,0],oo=[0,0,0,0];function lo(t,e,i){return io.Get(t,eo.Color255,ao),io.Get(e,eo.Color255,oo),`rgba(${Math.round(ao[0]+(oo[0]-ao[0])*i)},${Math.round(ao[1]+(oo[1]-ao[1])*i)},${Math.round(ao[2]+(oo[2]-ao[2])*i)},${ao[3]+(oo[3]-ao[3])*i})`}const ho=(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=so(t.from,t.to,i,!1);n&&(e[t.key]=n)}}))},co=(t,e,i)=>{const n=[],s=[];e.clear();for(let r=0;r{const n=t?Ya(t):[],s=Ya(e);i&&n&&(i.fromTransform&&Ka(n,i.fromTransform.clone().getInverse()),Ka(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})))},po=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],go=(t,e)=>{if(!t||!e)return null;const i=[];let n=!1;return Object.keys(t).forEach((s=>{if(!po.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]?io.Get(t[s],eo.Color255):t[s],to:"string"==typeof r?io.Get(r,eo.Color255):r,key:s}):i.push({from:t[s],to:r,key:s}),n=!0)})),n?i:null};class fo extends da{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;co(this.morphingData,s,e),this.otherAttrs&&this.otherAttrs.length&&ho(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const mo=(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=uo(null===(s=null==t?void 0:t.toCustomPath)||void 0===s?void 0:s.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=go(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 fo({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:ya,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:_a)),c};class vo extends da{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;co(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&&ho(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const yo=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Ma.includes(t))(i)||(e[i]=t[i])})),e},_o=(t,e,i)=>{const n=yo(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=Rs.graphicService.creator.rect({x:0,y:0,width:a,height:o});s.appendChild(i),e.push(i)}))}},bo=(t,e,i)=>{const n=[],s=i?null:yo(t.attribute),r=t.toCustomPath();for(let t=0;t{const n=[],s=i?null:yo(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:n}=$a(t.attribute),s=Za(i,n,e),r=[],a=n/s.length;for(let t=0,e=s.length;t{n.push(Rs.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=Za(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(Rs.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=Za(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(Rs.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 qa(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 qa(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{n.push(Rs.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:Ja(i)}];const n=[];return to(i,e,n),n})(t,e).forEach((t=>{n.push(Rs.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 to(r,e,h),h})(t,e).forEach((t=>{n.push(Rs.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"path"===t.type&&((t,e)=>{const i=Ya(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(Rs.graphicService.creator.path(i?t:Object.assign({},s,t))):n.push(Rs.graphicService.creator.polygon(i?t:Object.assign({},s,t)))}));return i&&_o(t,n,e),n};class So{static GetImage(t,e){var i;const n=So.cache.get(t);n?"fail"===n.loadState?Rs.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):So.loadImage(t,e)}static GetSvg(t,e){var i;let n=So.cache.get(t);n?"fail"===n.loadState?Rs.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"},So.cache.set(t,n),n.dataPromise=Rs.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=So.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"},So.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Rs.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Rs.global.loadBlob(t):"json"===e&&(i.dataPromise=Rs.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!So.isLoading&&So.toLoadAueue.length){So.isLoading=!0;const t=So.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:n}=t,s={type:"image",loadState:"init"};if(So.cache.set(i,s),s.dataPromise=Rs.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((()=>{So.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),So.loading()})).catch((t=>{console.error(t),So.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),So.loading()}))}}),0)}static loadImage(t,e){const i=Ao(t,So.toLoadAueue);if(-1!==i)return So.toLoadAueue[i].marks.push(e),void So.loading();So.toLoadAueue.push({url:t,marks:[e]}),So.loading()}static improveImageLoading(t){const e=Ao(t,So.toLoadAueue);if(-1!==e){const t=So.toLoadAueue.splice(e,1);So.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Ao(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;Bo.x=s+(null!==(i=t.scrollX)&&void 0!==i?i:0),Bo.y=r+(null!==(n=t.scrollY)&&void 0!==n?n:0)}else Bo.x=s,Bo.y=r;return Bo}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Rs.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Rs.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]:To;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:To;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(Rs.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:ma,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:va),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 wo.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(wo),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=hs.x,y:e=hs.y,scaleX:i=hs.scaleX,scaleY:n=hs.scaleY,angle:s=hs.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),Rs.transformUtil.fromMatrix(a,a).scale(i,n,{x:l[0],y:l[1]})}const c=this.getOffsetXY(hs);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=ko.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),Rs.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=so(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=so(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=so(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 Wr(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:Rs.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 as).fromString(t):this.pathProxy=new as,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",Rs.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const s=new qr(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)}}}Oo.mixin(ea);class Io{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 Po(t,e,i,n){const s=t.indexOf(e,i);if(-1===s)throw new Error(n);return s+e.length-1}function Lo(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 Do=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class Fo{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=Lo(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Po(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Lo(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 Io(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 Io(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 jo(t,e){return No(t)}function No(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 Uo=0;function Yo(){return Uo++}var Ko;function Xo(t){const e=[];let i=0,n="";for(let s=0;s$o.set(t,!0)));const Zo=new Map;function qo(t){if($o.has(t))return!0;if(Zo.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Zo.set(t,!0)));const Jo=Yo(),Qo=Yo(),tl=Yo(),el=Yo(),il=Yo(),nl=Yo(),sl=Yo(),rl=Yo(),al=Yo(),ol=Yo();Yo();const ll=Yo();Yo();const hl=Yo(),cl=Yo(),dl=Yo(),ul=Symbol.for("GraphicService"),pl=Symbol.for("GraphicCreator"),gl={"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"},fl=Object.keys(gl);var ml;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(ml||(ml={}));class vl extends Oo{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=nl,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 Hr),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Hr)}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;Rs.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),Rs.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=hs.x,y:e=hs.y,dx:i=hs.dx,dy:n=hs.dy,scaleX:s=hs.scaleX,scaleY:r=hs.scaleY,angle:a=hs.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=Wr(this).group;this._AABBBounds.clear();const i=Rs.graphicService.updateGroupAABBBounds(t,e,this._AABBBounds,this),{boundsPadding:n=e.boundsPadding}=t,s=Aa(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(),Rs.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Rs.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,Rs.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{Rs.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),Rs.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=Rs.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new vl(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return vl.NOWORK_ANIMATE_ATTR}}function yl(t){return new vl(t)}vl.NOWORK_ANIMATE_ATTR=Ro;class _l extends vl{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 Hr,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=>{Rs.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=>{Rs.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 bl=Symbol.for("TransformUtil"),xl=Symbol.for("GraphicUtil"),Sl=Symbol.for("LayerService"),Al=Symbol.for("StaticLayerHandlerContribution"),kl=Symbol.for("DynamicLayerHandlerContribution"),wl=Symbol.for("VirtualLayerHandlerContribution");var Tl,Cl=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},El=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ml=Tl=class{static GenerateLayerId(){return`${Tl.idprefix}_${Tl.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Rs.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?Ys.get(Al):"dynamic"===t?Ys.get(kl):Ys.get(wl),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 _l(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:n,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Tl.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)}};Ml.idprefix="visactor_layer",Ml.prefix_count=0,Ml=Tl=Cl([Bi(),El("design:paramtypes",[])],Ml);var Bl=new vi((t=>{t(Ji).to(nn).inSingletonScope(),t(Er).to(Br),t(xl).to(Pr).inSingletonScope(),t(bl).to(Fr).inSingletonScope(),t(Sl).to(Ml).inSingletonScope()}));function Rl(t,e){return!(!t&&!e)}function Ol(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Il(t,e,i){return i&&t*e>0}function Pl(t,e,i,n,s){return s&&t*e>0&&0!==i&&0!==n}function Ll(t,e){return t*e>0}function Dl(t,e,i,n){return t*e>0&&0!==i&&0!==n}function Fl(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 Nl(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(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:f,outerEndAngle:m,innerEndAngle:v,innerStartAngle:y}=t.getParsePadAngle(o,l),_=u,b=u,x=u,S=u,A=Math.max(b,_),k=Math.max(x,S);let w=A,T=k;const C=s*Ct(f),E=s*Bt(f),M=r*Ct(v),B=r*Bt(v);let R,O,I,P;if((k>bt||A>bt)&&(R=s*Ct(m),O=s*Bt(m),I=r*Ct(y),P=r*Bt(y),hbt){const t=Mt(_,w),r=Mt(b,w),o=jl(I,P,C,E,s,t,Number(c)),l=jl(R,O,M,B,s,r,Number(c));w0&&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+R,n+s*Bt(m))}else!a||a[0]?(e.moveTo(i+C,n+E),e.arc(i,n,s,f,m,!c)):e.moveTo(i+s*Ct(m),n+s*Bt(m));if(!(r>bt)||g<.001)!a||a[1]?e.lineTo(i+M,n+B):e.moveTo(i+M,n+B),d=!0;else if(T>bt){const t=Mt(S,T),s=Mt(x,T),o=jl(M,B,R,O,r,-s,Number(c)),l=jl(C,E,I,P,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),T0&&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+I,n+P)}else!a||a[1]?e.lineTo(i+M,n+B):e.moveTo(i+M,n+B),!a||a[2]?e.arc(i,n,r,v,y,c):e.moveTo(i+r*Ct(y),n+r*Bt(y))}return a?a[3]&&e.lineTo(i+s*Ct(o),n+s*Bt(o)):e.closePath(),d}class zl{static GetCanvas(){try{return zl.canvas||(zl.canvas=Rs.global.createCanvas({})),zl.canvas}catch(t){return null}}static GetCtx(){if(!zl.ctx){const t=zl.GetCanvas();zl.ctx=t.getContext("2d")}return zl.ctx}}class Vl extends $t{static getInstance(){return Vl._instance||(Vl._instance=new Vl),Vl._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=zl.GetCanvas(),n=zl.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 Vl(s,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Hl{static GetSize(t){for(let e=0;e=t)return Hl.ImageSize[e];return t}static Get(t,e,i,n,s,r,a){const o=Hl.GenKey(t,e,i,n,s),l=Hl.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=Hl.GenKey(t,e,i,n,s);Hl.cache[l]?Hl.cache[l].push({width:a,height:o,pattern:r}):Hl.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,n,s){return`${e},${i},${n},${s},${t.join()}`}}Hl.cache={},Hl.ImageSize=[20,40,80,160,320,640,1280,2560];const Gl=Symbol.for("ArcRenderContribution"),Wl=Symbol.for("AreaRenderContribution"),Ul=Symbol.for("CircleRenderContribution"),Yl=Symbol.for("GroupRenderContribution"),Kl=Symbol.for("PathRenderContribution"),Xl=Symbol.for("PolygonRenderContribution"),$l=Symbol.for("RectRenderContribution"),Zl=Symbol.for("SymbolRenderContribution"),ql=Symbol.for("TextRenderContribution"),Jl=Symbol.for("InteractiveSubRenderContribution"),Ql=["radius","startAngle","endAngle",...To];class th extends Oo{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=el}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=Wr(this).circle;this._AABBBounds.clear();const i=this.attribute,n=Rs.graphicService.updateCircleAABBBounds(i,Wr(this).circle,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=Aa(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Wr(this).circle[t]}needUpdateTags(t){return super.needUpdateTags(t,Ql)}needUpdateTag(t){return super.needUpdateTag(t,Ql)}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 as;return o.arc(0,0,s,r,a),o}clone(){return new th(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return th.NOWORK_ANIMATE_ATTR}}function eh(t){return new th(t)}function ih(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 nh(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function sh(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)}th.NOWORK_ANIMATE_ATTR=Ro;class rh{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=dl,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=Wr(this).text;this._AABBBounds.clear();const e=this.attribute,i=Rs.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=this.attribute,s=Aa(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}updateWrapAABBBounds(t){var e,i,n,s;const r=Wr(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=Ia(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=Rs.graphicUtil.textMeasure,k=new rh(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===Ko.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=nh(x,o),w=sh(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=Wr(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=Ia(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=Rs.graphicUtil.textMeasure,_=new rh(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=Wr(this).text,a=Rs.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=Ia(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=nh(x,o),e=this.cache.verticalList.length*b,i=sh(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=>Xo(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===Ko.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=nh(x,o),w=this.cache.verticalList.length*b,T=sh(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 Wr(this).text[t]}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ah;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ah;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function lh(t){return new oh(t)}oh.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Ro),oh.baselineMapAlign={top:"left",bottom:"right",middle:"center"},oh.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class hh{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 ch(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 dh=new class extends hh{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 ch(t,e/2,i,n,s)}drawOffset(t,e,i,n,s,r){return ch(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 uh=new class extends hh{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 ph(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 gh=new class extends hh{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 ph(t,e/2,i,n,s)}drawFitDir(t,e,i,n,s){return ph(t,e/2,i,n,s)}drawOffset(t,e,i,n,s,r){return ph(t,e/2+s,i,n,r)}};function fh(t,e,i,n){const s=2*e;return t.rect(i-e,n-e,s,s),!1}var mh=new class extends hh{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,n){return fh(t,e/2,i,n)}drawOffset(t,e,i,n,s){return fh(t,e/2+s,i,n)}};class vh extends hh{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 yh=new vh;var _h=new class extends vh{constructor(){super(...arguments),this.type="triangle"}};const bh=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),xh=Math.sin(At/10)*bh,Sh=-Math.cos(At/10)*bh;function Ah(t,e,i,n){const s=xh*e,r=Sh*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 kh=new class extends hh{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 Ah(t,e/2,i,n)}drawOffset(t,e,i,n,s){return Ah(t,e/2+s,i,n)}};const wh=Rt(3);function Th(t,e,i,n){const s=e,r=s/wh,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 Ch=new class extends hh{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 Th(t,e/2,i,n)}drawOffset(t,e,i,n,s){return Th(t,e/2+s,i,n)}};function Eh(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 Mh=new class extends hh{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}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)}};function Bh(t,e,i,n){return t.moveTo(-e+i,n),t.lineTo(i,e+n),!1}var Rh=new class extends hh{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}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)}};const Oh=-.5,Ih=Rt(3)/2,Ph=1/Rt(12);function Lh(t,e,i,n){const s=e/2,r=e*Ph,a=s,o=e*Ph+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(Oh*s-Ih*r+i,Ih*s+Oh*r+n),t.lineTo(Oh*a-Ih*o+i,Ih*a+Oh*o+n),t.lineTo(Oh*l-Ih*h+i,Ih*l+Oh*h+n),t.lineTo(Oh*s+Ih*r+i,Oh*r-Ih*s+n),t.lineTo(Oh*a+Ih*o+i,Oh*o-Ih*a+n),t.lineTo(Oh*l+Ih*h+i,Oh*h-Ih*l+n),t.closePath(),!1}var Dh=new class extends hh{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 Lh(t,e/2,i,n)}drawOffset(t,e,i,n,s){return Lh(t,e/2+s,i,n)}};var Fh=new class extends hh{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 jh=new class extends hh{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 Nh=new class extends hh{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 zh=Rt(3);function Vh(t,e,i,n){const s=e*zh;return t.moveTo(i,n+-s/3*2),t.lineTo(e+i,n+s),t.lineTo(i-e,n+s),t.closePath(),!0}var Hh=new class extends vh{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,n){return Vh(t,e/2/zh,i,n)}drawOffset(t,e,i,n,s){return Vh(t,e/2/zh+s,i,n)}};function Gh(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 Wh=new class extends hh{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 Gh(t,e/4,i,n)}drawOffset(t,e,i,n,s){return Gh(t,e/4+s,i,n)}};function Uh(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 Yh=new class extends hh{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 Uh(t,e/4,i,n)}drawOffset(t,e,i,n,s){return Uh(t,e/4+s,i,n)}};function Kh(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 Xh=new class extends hh{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 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-s,n-e),t.lineTo(i,n+e),t.lineTo(i+s,n-e),!0}var Zh=new class extends hh{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 $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,s){return t.moveTo(i,n-e),t.lineTo(i,n+e),!0}var Jh=new class extends hh{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,n,s){return qh(t,e/2,i,n)}drawOffset(t,e,i,n,s,r){return qh(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 Qh(t,e,i,n,s){return t.moveTo(i-e,n),t.lineTo(i+e,n),!0}var tc=new class extends hh{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,n,s){return Qh(t,e/2,i,n)}drawOffset(t,e,i,n,s,r){return Qh(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 ec(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 ic=new class extends hh{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 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-s}, ${i-s} L ${e+s},${i+s} M ${e+s}, ${i-s} L ${e-s},${i+s}`}};function nc(t,e,i,n){return t.rect(i-e[0]/2,n-e[1]/2,e[0],e[1]),!1}function sc(t,e,i,n){const s=e,r=e/2;return t.rect(i-s/2,n-r/2,s,r),!1}var rc=new class extends hh{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)?sc(t,e,i,n):nc(t,e,i,n)}drawOffset(t,e,i,n,s){return S(e)?sc(t,e+2*s,i,n):nc(t,[e[0]+2*s,e[1]+2*s],i,n)}};const ac=new Ht;class oc{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;ac.x1=n.bounds.x1*t,ac.y1=n.bounds.y1*t,ac.x2=n.bounds.x2*t,ac.y2=n.bounds.y2*t,e.union(ac)}))}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 lc={};[dh,uh,gh,mh,Hh,_h,kh,Ch,Mh,Rh,Dh,Fh,jh,yh,Nh,Wh,Yh,Xh,Zh,rc,Jh,tc,ic].forEach((t=>{lc[t.type]=t}));const hc={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"},cc=new Ht,dc=["symbolType","size",...To];let uc=class t extends Oo{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=cl}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=Wr(this).symbol;let{symbolType:i=e.symbolType}=this.attribute,n=lc[i];if(n)return this._parsedPath=n,n;if(n=t.userSymbolMap[i],n)return this._parsedPath=n,n;if(i=hc[i]||i,!0===((s=i).startsWith("{const e=(new as).fromString(t.d),i={};fl.forEach((e=>{t[e]&&(i[gl[e]]=t[e])})),r.push({path:e,attribute:i}),cc.union(e.bounds)}));const a=cc.width(),o=cc.height(),l=1/Et(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new oc(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var s;const r=(new as).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 oc(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=Wr(this).symbol;this._AABBBounds.clear();const i=this.attribute,n=Rs.graphicService.updateSymbolAABBBounds(i,Wr(this).symbol,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=Aa(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Wr(this).symbol[t]}needUpdateTags(t){return super.needUpdateTags(t,dc)}needUpdateTag(t){return super.needUpdateTag(t,dc)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new as).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new as).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function pc(t){return new uc(t)}uc.userSymbolMap={},uc.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Ro);const gc=["segments","points","curveType",...To];let fc=class t extends Oo{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",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||t.length<=1)}_interpolate(t,e,i,n,s){"points"===t&&(s.points=Ea(i,n,e))}doUpdateAABBBounds(){const t=Wr(this).line;this._AABBBounds.clear();const e=this.attribute,i=Rs.graphicService.updateLineAABBBounds(e,Wr(this).line,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=Aa(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Wr(this).line[t]}needUpdateTags(t){return super.needUpdateTags(t,gc)}needUpdateTag(t){return super.needUpdateTag(t,gc)}toCustomPath(){const t=this.attribute,e=new as,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 mc(t){return new fc(t)}fc.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ro);const vc=["width","x1","y1","height","cornerRadius",...To];class yc extends Oo{constructor(t){super(t),this.type="rect",this.numberType=ll}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}doUpdateAABBBounds(){const t=Wr(this).rect;this._AABBBounds.clear();const e=this.attribute,i=Rs.graphicService.updateRectAABBBounds(e,Wr(this).rect,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=Aa(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Wr(this).rect[t]}needUpdateTags(t){return super.needUpdateTags(t,vc)}needUpdateTag(t){return super.needUpdateTag(t,vc)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:n,height:s}=$a(t),r=new as;return r.moveTo(e,i),r.rect(e,i,n,s),r}clone(){return new yc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return yc.NOWORK_ANIMATE_ATTR}}function _c(t){return new yc(t)}yc.NOWORK_ANIMATE_ATTR=Ro;class bc{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=Os[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 xc{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const n=Ia(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}=zs(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}=zs(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=js(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}=zs(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||Ps;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||Is;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=js(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:n}=zs(this.text.slice(t),this.character);return i+this.ellipsisWidth-n}return i}}const Sc=["width","height","image",...To];class Ac extends Oo{constructor(t){super(t),this.type="image",this.numberType=sl,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=Wr(this).image;this._AABBBounds.clear();const e=this.attribute,i=Rs.graphicService.updateImageAABBBounds(e,Wr(this).image,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=Aa(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Ms[t]}needUpdateTags(t){return super.needUpdateTags(t,Sc)}needUpdateTag(t){return super.needUpdateTag(t,Sc)}clone(){return new Ac(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ac.NOWORK_ANIMATE_ATTR}}Ac.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Ro);class kc extends Ac{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=Aa(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=Aa(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=Ms.width,height:e=Ms.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 wc{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 kc?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=Os[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof xc){const e=Fs.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 kc)break;if("vertical"===this.direction&&"vertical"!==n.direction){n.verticalEllipsis=!0;break}const r=!0===s?"...":s||"";n.ellipsisStr=r;const{width:a}=zs(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 kc)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 kc)break;const{width:s}=zs(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 kc?t.width:t.getWidthWithEllips(this.direction)})),i}}class Tc{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=Os[this.direction]}store(t){if(t instanceof kc){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 wc(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 kc?"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=js(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 xc(i,t.newLine,t.character),new xc(n,!0,t.character)]}(t,n);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const Cc=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...To];class Ec extends Oo{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=hl}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Es.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:Es.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:Es.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:Es.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:Es.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:Es.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:Es.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:Es.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=Wr(this).richtext;this._AABBBounds.clear();const e=this.attribute,i=Rs.graphicService.updateRichTextAABBBounds(e,Wr(this).richtext,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=Aa(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Es[t]}needUpdateTags(t){return super.needUpdateTags(t,Cc)}needUpdateTag(t){return super.needUpdateTag(t,Cc)}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(){var t;const{textConfig:e=[],maxWidth:i,maxHeight:n,width:s,height:r,ellipsis:a,wordBreak:o,verticalDirection:l,textAlign:h,textBaseline:c,layoutDirection:d,singleLine:u,disableAutoWrapLine:p}=this.attribute,g=[];for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,g.push(t)}}else{const i=this.combinedStyleToCharacter(e[t]);if(S(i.text)&&(i.text=`${i.text}`),i.text&&i.text.includes("\n")){const t=i.text.split("\n");for(let e=0;e0,m="number"==typeof n&&Number.isFinite(n)&&n>0,v="number"==typeof s&&Number.isFinite(s)&&s>0&&(!f||s<=i),y="number"==typeof r&&Number.isFinite(r)&&r>0&&(!m||r<=n),_=new bc(0,0,(v?s:f?i:0)||0,(y?r:m?n:0)||0,a,o,l,h,c,d||"horizontal",!v&&f,!y&&m,u||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),b=new Tc(_);if(p){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 Ec.NOWORK_ANIMATE_ATTR}}function Mc(t){return new Ec(t)}Ec.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Ro);const Bc=["path","customPath",...To];class Rc extends Oo{constructor(t){super(t),this.type="path",this.numberType=al}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=Wr(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof as?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof as?this.cache:t.path)}doUpdateAABBBounds(){const t=Wr(this).path;this.doUpdatePathShape(),this._AABBBounds.clear();const e=this.attribute,i=Rs.graphicService.updatePathAABBBounds(e,Wr(this).path,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=Aa(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;y(t.path,!0)?this.cache=(new as).fromString(t.path):t.customPath&&(this.cache=new as,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Wr(this).path[t]}needUpdateTags(t){return super.needUpdateTags(t,Bc)}needUpdateTag(t){return super.needUpdateTag(t,Bc)}toCustomPath(){return(new as).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Rc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Rc.NOWORK_ANIMATE_ATTR}}function Oc(t){return new Rc(t)}Rc.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Ro);const Ic=["segments","points","curveType",...To];class Pc extends Oo{constructor(t){super(t),this.type="area",this.numberType=tl}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=Wr(this).area;this._AABBBounds.clear();const e=this.attribute,i=Rs.graphicService.updateAreaAABBBounds(e,Wr(this).area,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=Aa(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,s){"points"===t&&(s.points=Ea(i,n,e))}getDefaultAttribute(t){return Wr(this).area[t]}needUpdateTags(t){return super.needUpdateTags(t,Ic)}needUpdateTag(t){return super.needUpdateTag(t,Ic)}toCustomPath(){const t=new as,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 Pc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Pc.NOWORK_ANIMATE_ATTR}}function Lc(t){return new Pc(t)}Pc.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ro);const Dc=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...To];class Fc extends Oo{constructor(t){super(t),this.type="arc",this.numberType=Jo}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=Wr(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);return Math.min(S(e,!0)?e:a*parseFloat(e)/100,a/2)}getParsedAngle(){const t=Wr(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=Wt(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=Wr(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=Wr(this).arc;this._AABBBounds.clear();const i=this.attribute,n=Rs.graphicService.updateArcAABBBounds(i,Wr(this).arc,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=Aa(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return super.needUpdateTags(t,Dc)}needUpdateTag(t){return super.needUpdateTag(t,Dc)}getDefaultAttribute(t){return Wr(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 Fc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Fc.NOWORK_ANIMATE_ATTR}}function jc(t){return new Fc(t)}Fc.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Ro);const Nc=["points","cornerRadius",...To];class zc extends Oo{constructor(t){super(t),this.type="polygon",this.numberType=ol}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=Wr(this).polygon;this._AABBBounds.clear();const e=this.attribute,i=Rs.graphicService.updatePolygonAABBBounds(e,Wr(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=Aa(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,s){"points"===t&&(s.points=Ea(i,n,e))}getDefaultAttribute(t){return Wr(this).polygon[t]}needUpdateTags(t){return super.needUpdateTags(t,Nc)}needUpdateTag(t){return super.needUpdateTag(t,Nc)}toCustomPath(){const t=this.attribute.points,e=new as;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 zc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return zc.NOWORK_ANIMATE_ATTR}}function Vc(t){return new zc(t)}zc.NOWORK_ANIMATE_ATTR=Ro;class Hc extends vl{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 Gc(t){return new Hc(t)}class Wc{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 Uc extends Wc{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;Wo(i,n+(r+o)/2,!0,a)}return i}}class Yc{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 Yc.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},Zc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qc=function(t,e){return function(i,n){e(i,n,t)}};function Jc(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 Qc(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 td(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 ed(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),Jc(t,t,[s+o,r+l,a+h]),Jc(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),Jc(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=Xc.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]}Jc(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),Jc(i,i,[-n[0],-n[1],0]),td(t,t,i)}}let id=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 Wc],this._symbolBoundsContribitions=[new Uc],this._imageBoundsContribitions=[new Wc],this._circleBoundsContribitions=[new Wc],this._arcBoundsContribitions=[new Wc],this._pathBoundsContribitions=[new Wc]}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,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}=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 h=this.tempAABBBounds1,c=this.tempAABBBounds2;return h.setValue(i.x1,i.y1,i.x2,i.y2),c.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=sh(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=nh(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){Wo(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}=t,r=i;return s.forEach((t=>{r.add(t.x,t.y)})),r}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{r.add(t.x,t.y)}))})),r}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):Ta(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):(Ta(h,l,s,i),Ta(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){Wo(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;Wo(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)}};id=$c([Bi(),qc(0,Ei(pl)),Zc("design:paramtypes",[Object])],id);const nd=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 sd,rd;function ad(t){return sd||(sd=nd.CreateGraphic("text",{})),sd.initAttributes(t),sd.AABBBounds}const od={x:0,y:0,z:0,lastModelMatrix:null};class ld{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=Il(o,l,s),p=Ll(o,c),g=Rl(s,r),f=Ol(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;od.x=s,od.y=r,od.z=a,od.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=Xc.allocate(),s=Xc.allocate();ed(s,t,e),td(n,d||n,s),od.x=0,od.y=0,od.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),Xc.free(s)}if(g&&!d){const n=t.getOffsetXY(e);od.x+=n.x,od.y+=n.y,od.z=a,i.setTransformForCurrent()}else if(p)od.x=0,od.y=0,od.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const n=t.getOffsetXY(e);od.x+=n.x,od.y+=n.y,this.transformWithoutTranslate(i,od.x,od.y,od.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),od.x=0,od.y=0,od.z=0;return od}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=Wr(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=Il(d,u,h),_=Ll(d,g),b=Rl(h),x=Ol(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&&Xc.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}const hd=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 cd{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(cd.IsGradientStr(t))try{const e=hd(t)[0];if(e){if("linear"===e.type)return cd.ParseLinear(e);if("radial"===e.type)return cd.ParseRadial(e);if("conic"===e.type)return cd.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 dd(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 ud(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 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},gd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fd=function(t,e){return function(i,n){e(i,n,t)}};class md{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=Wr(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=wr.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),wr.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 vd=new md;let yd=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)}))}};yd=pd([Bi(),fd(0,Ei(Yi)),fd(0,Ri(Jl)),gd("design:paramtypes",[Object])],yd);class _d{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=wr.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])),wr.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 bd=new _d;const xd=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=dd(e,s,e.dpr),a=s/T;if(t.setAttributes({outerRadius:T+r,innerRadius:w-r,startAngle:y-a,endAngle:_+a}),e.beginPath(),Nl(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=dd(e,s,e.dpr),a=s/T;if(t.setAttributes({outerRadius:T-r,innerRadius:w+r,startAngle:y+a,endAngle:_-a}),e.beginPath(),Nl(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:_})}},Sd=bd,Ad=vd;const kd=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=dd(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=dd(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()}}}},wd=bd,Td=vd;const Cd=new class extends md{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()}},Ed=xt/2;function Md(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],-Ed,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,Ed,!1)}if(t.lineTo(_[0],_[1]),!$(_,b)){const e=_[0],i=_[1]-u[3];t.arc(e,i,u[3],Ed,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+Ed,!1)}return t.closePath(),t}var Bd=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 Rd=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)}};Rd=Bd([Bi()],Rd);let Od=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()}}};Od=Bd([Bi()],Od);const Id=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=dd(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(),Md(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=dd(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(),Md(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()}}}},Pd=bd,Ld=vd;const Dd=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=dd(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=dd(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()}}}},Fd=bd,jd=vd;var Nd=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},zd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vd=function(t,e){return function(i,n){e(i,n,t)}};let Hd=class extends ld{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=Jo,this.builtinContributions=[xd,Ad,Sd],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||T>bt)&&(P=s*Ct(_),L=s*Bt(_),D=r*Ct(x),F=r*Bt(x),ubt){const t=Mt(S,E),r=Mt(A,E),a=jl(D,F,B,R,s,t,Number(p)),o=jl(P,L,O,I,s,r,Number(p));if(E0&&e.arc(i+o.cx,n+o.cy,r,Tt(o.y11,o.x11),Tt(o.y01,o.x01),!p)}}else e.moveTo(i+B,n+R);if(!(r>bt)||v<.001)e.lineTo(i+O,n+I),g=!0;else if(M>bt){const t=Mt(w,M),s=Mt(k,M),a=jl(O,I,P,L,r,-s,Number(p)),o=jl(B,R,D,F,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,n+a.cy+a.y01),M0&&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(x),n+r*Bt(x));return g}drawShape(t,e,i,n,s,r,a,o){const l=Wr(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++)xa[n]=t,i&&(i=!(null!==(e=xa[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)xa[e]=!!t[e],i&&(i=!!xa[e]);else xa[0]=!1,xa[1]=!1,xa[2]=!1,xa[3]=!1;return{isFullStroke:i,stroke:xa}})(d);if((v||E)&&(e.beginPath(),Nl(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(),Nl(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),so(o.color,l.color,h,!1)}(0,0,h,s);a||Il&&(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=Wr(t,null==n?void 0:n.theme).arc;this._draw(t,s,!1,i,n)}};Hd=Nd([Bi(),Vd(0,Ei(Yi)),Vd(0,Ri(Gl)),zd("design:paramtypes",[Object])],Hd);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},Wd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ud=function(t,e){return function(i,n){e(i,n,t)}};let Yd=class extends ld{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=el,this.builtinContributions=[kd,Td,wd],this.init(t)}drawShape(t,e,i,n,s,r,a,o){const l=Wr(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=Wr(t,null==n?void 0:n.theme).circle;this._draw(t,s,!1,i,n)}};function Kd(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 Xd(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),Kd(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 Zd=class extends ld{constructor(){super(...arguments),this.numberType=rl}draw(t,e,i,n){const s=Wr(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;Xd(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(),Xd(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"===m)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=rs(t.points,m,{startPoint:e});return n=s,s})).filter((t=>!!t)),"linearClosed"===m){let e;for(let i=0;it.points.length));if(1===s[0].points.length&&s.shift(),1===v){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,s[g],[l,t.attribute],v,y,i,n,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=v*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,s[m],[l,t.attribute],Mt(_,1),y,i,n,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,v,y,i,n,t,a,o)}};function qd(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 Jd(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),Kd(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),Kd(t,l,1,n),o=!1):o=!0}t.closePath()}Zd=$d([Bi()],Zd);const Qd=new class extends _d{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:Ba(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Ba(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:Ba(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:Ba(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,n,l,_,b,x)}},tu=vd;var eu=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},iu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nu=function(t,e){return function(i,n){e(i,n,t)}};function su(t,e,i){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"linearClosed":return ss(t,i)}}let ru=class extends ld{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=tl,this.builtinContributions=[Qd,tu],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=Wr(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}=t.attribute,b=this.valid(t,g,a,o);if(!b)return;const{doFill:x,doStroke:S}=b,{clipRange:A=g.clipRange,closePath:k,points:w,segments:T}=t.attribute;let{curveType:C=g.curveType}=t.attribute;if(k&&"linear"===C&&(C="linearClosed"),1===A&&!T&&!w.some((t=>!1===t.defined))&&"linear"===C)return this.drawLinearAreaHighPerformance(t,e,!!f,S,v,_,i,n,g,s,r,a,o);if(t.shouldUpdateShape()){if(T&&T.length){let e,i;const n=T.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=su(t.points,C,{startPoint:e});return i=s,s})).filter((t=>!!t));let s;const r=[];for(let t=T.length-1;t>=0;t--){const e=T[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=T[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=su(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C),r.unshift(s))}t.cacheArea=r.map(((t,e)=>({top:n[e],bottom:t})))}else{if(!w||!w.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=w,i=[];for(let t=w.length-1;t>=0;t--)i.push({x:null!==(u=w[t].x1)&&void 0!==u?u:w[t].x,y:null!==(p=w[t].y1)&&void 0!==p?p:w[t].y});const n=su(e,C),s=su(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C);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===A){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,x,v,S,_,r[c],[g,t.attribute],A,i,n,y,t,s,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=A*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,x,v,S,_,r[u],[g,t.attribute],Mt(f,1),i,n,y,t,s,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,x,v,S,_,t.attribute,g,A,i,n,y,t,s,a,o)}draw(t,e,i,n){const s=Wr(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=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),qd(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),qd(t,e,i,n),e.length=0,i.length=0)}s=o})),qd(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},hu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cu=function(t,e){return function(i,n){e(i,n,t)}};let du=class extends ld{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=al,this.builtinContributions=[ou,au],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:Wr(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=Wr(t,null==n?void 0:n.theme).path;this.tempTheme=s,this._draw(t,s,!1,i,n),this.tempTheme=null}};du=lu([Bi(),cu(0,Ei(Yi)),cu(0,Ri(Kl)),hu("design:paramtypes",[Object])],du);var uu=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},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 ld{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=ll,this.builtinContributions=[Id,Ld,Pd],this.init(t)}drawShape(t,e,i,n,s,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Wr(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=Pl(g,f,k,w,c),C=Dl(g,v,k,w),E=Rl(c,d),M=Ol(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(),Md(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=Wr(t,null==n?void 0:n.theme).rect;this.tempTheme=s,this._draw(t,s,!1,i,n),this.tempTheme=null}};fu=uu([Bi(),gu(0,Ei(Yi)),gu(0,Ri($l)),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 ld{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=cl,this.builtinContributions=[Dd,jd,Fd],this.init(t)}drawShape(t,e,i,n,s,r,a,o){var l;const h=Wr(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=Wr(t,null==n?void 0:n.theme).symbol;this._draw(t,s,!1,i,n)}};_u=mu([Bi(),yu(0,Ei(Yi)),yu(0,Ri(Zl)),vu("design:paramtypes",[Object])],_u);const bu=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 xu=new class extends md{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=bu.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=ad(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?(Md(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&&bu.free(E),C()}};var Su=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)},ku=function(t,e){return function(i,n){e(i,n,t)}};let wu=class extends ld{constructor(t){super(),this.textRenderContribitions=t,this.numberType=dl,this.builtinContributions=[xu],this.init(t)}drawShape(t,e,i,n,s,r,a,o){var l,h,c;const d=Wr(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=Ia(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=Kc.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Kc.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=Wr(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=nh(l,m),y=sh(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=sh("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 Tu(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},Ou=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Iu=function(t,e){return function(i,n){e(i,n,t)}};let Pu=class extends ld{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=ol,this.builtinContributions=[Bu,Mu],this.init(t)}drawShape(t,e,i,n,s,r,a,o){const l=Wr(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))?Tu(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 Tu(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 _=Cu(d,u),b=Cu(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=Eu(h,y,_,d,u),A=Eu(h,y,b,p,g),k=2*h.x-S.x-A.x,w=2*h.y-S.y-A.y,T=Cu(k,w),C=Eu(h,Cu(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=Wr(t,null==n?void 0:n.theme).polygon;this._draw(t,s,!1,i,n)}};Pu=Ru([Bi(),Iu(0,Ei(Yi)),Iu(0,Ri(Xl)),Ou("design:paramtypes",[Object])],Pu);const Lu=Symbol.for("IncrementalDrawContribution"),Du=Symbol.for("ArcRender"),Fu=Symbol.for("AreaRender"),ju=Symbol.for("CircleRender"),Nu=Symbol.for("GraphicRender"),zu=Symbol.for("GroupRender"),Vu=Symbol.for("LineRender"),Hu=Symbol.for("PathRender"),Gu=Symbol.for("PolygonRender"),Wu=Symbol.for("RectRender"),Uu=Symbol.for("SymbolRender"),Yu=Symbol.for("TextRender"),Ku=Symbol.for("RichTextRender"),Xu=Symbol.for("GlyphRender"),$u=Symbol.for("DrawContribution");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},qu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Ju=Symbol.for("DrawItemInterceptor"),Qu=new Ht,tp=new Ht;class ep{constructor(){this.order=1}afterDrawItem(t,e,i,n,s){return(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx)&&this.drawItem(t,e,i,n,s),!1}beforeDrawItem(t,e,i,n,s){return t.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){Qu.copy(n.dirtyBounds),tp.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(Qu),n.backupDirtyBounds.copy(tp)),!0}}class ip{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 np=class{constructor(){this.order=1,this.interceptors=[new ep,new rp,new sp,new ip]}afterDrawItem(t,e,i,n,s){for(let r=0;r(e=t.numberType===Qo,!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&&Xc.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}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},op=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lp=function(t,e){return function(i,n){e(i,n,t)}};const hp=Symbol.for("RenderService");let cp=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}};cp=ap([Bi(),lp(0,Ei($u)),op("design:paramtypes",[Object])],cp);var dp=new vi((t=>{t(hp).to(cp)}));const up=Symbol.for("PickerService"),pp=Symbol.for("GlobalPickerService");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};const fp=Symbol.for("PickItemInterceptor");let mp=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){if(!t.shadowRoot)return null;const{parentMatrix:r}=s||{};if(!r)return null;const a=e.pickContext;a.highPerformanceSave();const o=t.shadowRoot,l=Kc.allocateByObj(r),h=new jt(l.a*i.x+l.c*i.y+l.e,l.b*i.x+l.d*i.y+l.f),c=e.pickGroup(o,h,l,n);return a.highPerformanceRestore(),c}};mp=gp([Bi()],mp);let vp=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}};vp=gp([Bi()],vp);let yp=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===Qo,!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()}};yp=gp([Bi()],yp);var _p=new vi(((t,e,i)=>{i(up)||(t(pp).toSelf(),t(up).toService(pp)),t(yp).toSelf().inSingletonScope(),t(fp).toService(yp),t(mp).toSelf().inSingletonScope(),t(fp).toService(mp),t(vp).toSelf().inSingletonScope(),t(fp).toService(vp),Xi(t,fp)})),bp=new vi((t=>{t(ul).to(id).inSingletonScope(),t(pl).toConstantValue(nd)}));const xp=Symbol.for("AutoEnablePlugins"),Sp=Symbol.for("PluginService");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},kp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wp=function(t,e){return function(i,n){e(i,n,t)}};let Tp=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&&Ys.isBound(xp)&&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=[]}};Tp=Ap([Bi(),wp(0,Ei(Yi)),wp(0,Ri(xp)),kp("design:paramtypes",[Object])],Tp);var Cp=new vi((t=>{t(Sp).to(Tp),function(t,e){t(Yi).toDynamicValue((t=>{let{container:i}=t;return new Ki(e,i)})).whenTargetNamed(e)}(t,xp)})),Ep=new vi((t=>{Xi(t,qi)})),Mp=new vi((t=>{t(Ws).to(Us).inSingletonScope(),Xi(t,Ws)})),Bp=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)};let Op=class{constructor(){this.type="static",this.offscreen=!1,this.global=Rs.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=$s({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()}};Op=Bp([Bi(),Rp("design:paramtypes",[])],Op);var Ip=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},Pp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Lp=class{constructor(){this.offscreen=!1,this.type="virtual",this.global=Rs.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(){}};Lp=Ip([Bi(),Pp("design:paramtypes",[])],Lp);var Dp=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)};let jp=class{constructor(){this.offscreen=!0,this.type="dynamic",this.global=Rs.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;const n=$s({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){}};jp=Dp([Bi(),Fp("design:paramtypes",[])],jp);var Np=new vi((t=>{t(Op).toSelf(),t(jp).toSelf(),t(Lp).toSelf(),t(Al).toService(Op),t(kl).toService(jp),t(wl).toService(Lp)}));var zp=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 Vp(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 zp(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,n)}))}function Gp(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 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},Up=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Yp=function(t,e){return function(i,n){e(i,n,t)}};let Kp=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=Rs.global,this.layerService=Rs.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:ms.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:ms.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Kc.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=Gp(e,i,ms.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=bu.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Kc.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))})):Vp(t,ms.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),bu.free(s),Kc.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||Ys.get(Lu);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},$p=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zp=function(t,e){return function(i,n){e(i,n,t)}};let qp=class{constructor(t){this.groupRenderContribitions=t,this.numberType=nl}drawShape(t,e,i,n,s,r,a,o){const l=Wr(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=Pl(u,m,p,g,h),k=Dl(u,v,p,g),w=Rl(h,c),T=Ol(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(),Md(e,i,n,p,g,y));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Cd));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=Wr(t,null==n?void 0:n.theme).group,l=s.modelMatrix;if(s.camera){const e=Xc.allocate(),i=Xc.allocate();ed(i,t,o),td(e,l||e,i),s.modelMatrix=e,Xc.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&&Xc.free(s.modelMatrix),s.modelMatrix=l,s.baseGlobalAlpha/=a,d&&d.then?d.then((()=>{r?s.restore():s.highPerformanceRestore()})):r?s.restore():s.highPerformanceRestore()}};qp=Xp([Bi(),Zp(0,Ei(Yi)),Zp(0,Ri(Yl)),$p("design:paramtypes",[Object])],qp);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};let Qp=class extends Zd{constructor(){super(...arguments),this.numberType=rl}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=Wr(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=Il(u,p,c),y=Ll(u,g),_=Rl(c),b=Ol(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())}};Qp=Jp([Bi()],Qp);var tg=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 eg=class extends ru{constructor(){super(...arguments),this.numberType=tl}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=Wr(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Il(u,d,c),f=Rl(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())}};eg=tg([Bi()],eg);var ig,ng=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},sg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rg=function(t,e){return function(i,n){e(i,n,t)}},ag=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"}(ig||(ig={}));let og=class extends Kp{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=ig.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 ag(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:ms.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:ms.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 ag(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return ag(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>ag(this,void 0,void 0,(function*(){if(2!==t.count)yield Hp(t,ms.zIndex,((i,n)=>{if(this.status===ig.STOP)return!0;if(i.isContainer)return!1;if(n{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return ag(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return ag(this,void 0,void 0,(function*(){this.rendering&&(this.status=ig.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=ig.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 ag(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:()=>ag(this,void 0,void 0,(function*(){yield Hp(t,ms.zIndex,(t=>ag(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};og=ng([Bi(),rg(0,Mi(Nu)),rg(1,Ei(Qp)),rg(2,Ei(eg)),rg(3,Ei(Yi)),rg(3,Ri(Ju)),sg("design:paramtypes",[Array,Object,Object,Object])],og);var lg=new vi((t=>{t(md).toSelf().inSingletonScope(),t(_d).toSelf().inSingletonScope(),t($u).to(Kp),t(Lu).to(og),t(zu).to(qp).inSingletonScope(),t(Nu).toService(zu),Xi(t,Yl),t(yd).toSelf().inSingletonScope(),Xi(t,Jl),Xi(t,Nu),t(np).toSelf().inSingletonScope(),t(Ju).toService(np),Xi(t,Ju)}));function hg(){hg.__loaded||(hg.__loaded=!0,Ys.load(Bl),Ys.load(bp),Ys.load(dp),Ys.load(_p),Ys.load(Cp),function(t){t.load(Ep),t.load(Mp),t.load(Np)}(Ys),function(t){t.load(lg)}(Ys))}hg.__loaded=!1,hg();const cg=Ys.get(Ji);Rs.global=cg;const dg=Ys.get(xl);Rs.graphicUtil=dg;const ug=Ys.get(bl);Rs.transformUtil=ug;const pg=Ys.get(ul);Rs.graphicService=pg;const gg=Ys.get(Sl);Rs.layerService=gg;class fg{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=mi.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Rs.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),Rs.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){Rs.graphicService.hooks.onAttributeUpdate.taps=Rs.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Rs.graphicService.hooks.onSetStage.taps=Rs.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class mg{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 vg{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,Rs.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))})),Rs.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){Rs.graphicService.hooks.onAddIncremental.taps=Rs.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Rs.graphicService.hooks.onClearIncremental.taps=Rs.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Rs.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 yg{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)),Rs.graphicService.hooks.onRemove.unTap(this.key),Rs.graphicService.hooks.onRelease.unTap(this.key),this.release()}getWrapContainer(t,e,i){let n;return n=e?"string"==typeof e?Rs.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:Rs.global.createDom(Object.assign({tagName:"div",parent:n},i)),nativeContainer:n}}parseDefaultStyleFromGraphic(t){return function(t){const e={};return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[Le(i)]=t[i])})),["fontSize","lineHeight"].forEach((i=>{const n=Le(i);u(t[i])||(e[n]=/^[0-9]*$/.test(`${t[i]}`)?`${t[i]}px`:`${t[i]}`)})),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:Wr(t).text)}getTransformOfText(t){const e=Wr(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=Rs.global.getElementTopLeft(n,!1),f=e.window.getTopLeft(!1),m=o+f.left-p.left,v=l+f.top-p.top;if(a.left=`${m}px`,a.top=`${v}px`,"text"===t.type&&"position"===c&&(a=Object.assign(Object.assign({},a),this.getTransformOfText(t))),d(s.style)){const e=s.style({top:v,left:m,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)));Rs.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"===Rs.global.env&&(t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:ms.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:ms.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&&Rs.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"===Rs.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 Ht;class bg{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()})),Rs.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&&(_g.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(_g,t.parent&&t.parent.globalTransMatrix)))})),Rs.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))})),Rs.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){Rs.graphicService.hooks.beforeUpdateAABBBounds.taps=Rs.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Rs.graphicService.hooks.afterUpdateAABBBounds.taps=Rs.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)),Rs.graphicService.hooks.onRemove.taps=Rs.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const xg=new Ht;class Sg{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=Wr(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,Rs.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),Rs.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&xg.copy(n)})),Rs.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,s)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(xg.equals(i)||this.tryLayout(t,!1))})),Rs.graphicService.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1)}))}deactivate(t){Rs.graphicService.hooks.onAttributeUpdate.taps=Rs.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Rs.graphicService.hooks.beforeUpdateAABBBounds.taps=Rs.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Rs.graphicService.hooks.afterUpdateAABBBounds.taps=Rs.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Rs.graphicService.hooks.onSetStage.taps=Rs.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const Ag=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===oa.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=oa.INITIAL,Rs.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),Rs.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:aa},{mode:"timeout",cons:ra},{mode:"manual",cons:sa}];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!==oa.INITIAL&&(this.status=oa.PAUSE,!0)}resume(){return this.status!==oa.INITIAL&&(this.status=oa.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===oa.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===oa.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=oa.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=oa.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};Ag.addTimeline(ca),Ag.setFPS(60);class kg{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=io.Get(e,eo.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)?io.Get(e,eo.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*s[0]*n}, ${r[1]*s[1]*n}, ${r[2]*s[2]*n})`}}function wg(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 Tg(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 Cg{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=Xc.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=Xc.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()})),i&&Rs.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))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])this.htmlMap[o].root.render(r);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(n,a);if(t){const i=s.createRoot(t);i.render(r),this.htmlMap||(this.htmlMap={}),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}}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 Rg="white";class Og extends vl{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:Rg}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 Hr,this.hooks={beforeRender:new Zi(["stage"]),afterRender:new Zi(["stage"])},this.global=Rs.global,!this.global.env&&Mg()&&this.global.setEnv("browser"),this.window=Ys.get(Er),this.renderService=Ys.get(hp),this.pluginService=Ys.get(Sp),this.layerService=Ys.get(Sl),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:Rg,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||Ag,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new ha,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 na(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 kg(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 Cg(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 mg))}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 fg))}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 vg))}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 bg,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 Sg))}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 yg))}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 Bg))}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){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(){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){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(){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];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];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){this.pickerService||(this.pickerService=Ys.get(up));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){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){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;const e=Ys.get(Er),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;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 Ig=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},Pg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Lg=new Xt(1,0,0,1,0,0),Dg={x:0,y:0};let Fg=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 as,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 Kc.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(Kc.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Kc.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},Dg),function(t,e,i){return kr(t,0,!1,e,i)}(this.path.commandList,Dg.x,Dg.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},Dg);const i=dd(this,this.lineWidth,this.dpr);return function(t,e,i,n){return kr(t,e,!0,i,n)}(this.path.commandList,i,Dg.x,Dg.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(Lg,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=>Kc.free(t))),this.stack.length=0}};Fg=Ig([Bi(),Pg("design:paramtypes",[Object,Number])],Fg);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={WIDTH:500,HEIGHT:500,DPR:1};let Vg=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=zg.WIDTH,height:s=zg.HEIGHT,dpr:r=zg.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)}};Vg.env="browser",Vg=jg([Bi(),Ng("design:paramtypes",[Object])],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};let Gg=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}}};Gg=Hg([Bi()],Gg);var Wg=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)};let Yg=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}};Yg=Wg([Bi(),Ug("design:paramtypes",[])],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},Xg=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 Zg=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=Rs.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=Xc.allocate();if(Qc(i,e),a){if(i){const t=Xc.allocate();r.modelMatrix=td(t,a,i),Xc.free(i)}}else Qc(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=Wr(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=Wr(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&&Xc.free(r.modelMatrix),r.modelMatrix=a,s.graphic||s.group||!u||t.stage.camera||(s.group=t),Kc.free(l),s}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};Zg=Kg([Bi(),$g(0,Ei(Yi)),$g(0,Ri(fp)),Xg("design:paramtypes",[Object])],Zg);let qg=!1;const Jg=new vi((t=>{qg||(qg=!0,t(Hd).toSelf().inSingletonScope(),t(Du).to(Hd).inSingletonScope(),t(Nu).toService(Du),t(Gl).toService(yd),Xi(t,Gl))}));let Qg=!1;const tf=new vi((t=>{Qg||(Qg=!0,t(fu).toSelf().inSingletonScope(),t(Wu).to(fu).inSingletonScope(),t(Nu).toService(Wu),t(Od).toSelf(),t(Rd).toSelf(),t($l).toService(Od),t($l).toService(Rd),t($l).toService(yd),Xi(t,$l))}));let ef=!1;const nf=new vi((t=>{ef||(ef=!0,t(Zd).toSelf().inSingletonScope(),t(Qp).toSelf().inSingletonScope(),t(Vu).to(Zd).inSingletonScope(),t(Nu).toService(Vu))}));let sf=!1;const rf=new vi((t=>{sf||(sf=!0,t(ru).toSelf().inSingletonScope(),t(Fu).to(ru).inSingletonScope(),t(Nu).toService(Fu),t(Wl).toService(yd),Xi(t,Wl),t(eg).toSelf().inSingletonScope())}));let af=!1;const of=new vi((t=>{af||(af=!0,t(_u).toSelf().inSingletonScope(),t(Uu).to(_u).inSingletonScope(),t(Nu).toService(Uu),t(Zl).toService(yd),Xi(t,Zl))}));let lf=!1;const hf=new vi((t=>{lf||(lf=!0,t(Yd).toSelf().inSingletonScope(),t(ju).to(Yd).inSingletonScope(),t(Nu).toService(ju),t(Ul).toService(yd),Xi(t,Ul))}));let cf=!1;const df=new vi((t=>{cf||(cf=!0,t(Yu).to(wu).inSingletonScope(),t(Nu).toService(Yu),t(ql).toService(yd),Xi(t,ql))}));let uf=!1;const pf=new vi((t=>{uf||(uf=!0,t(du).toSelf().inSingletonScope(),t(Hu).to(du).inSingletonScope(),t(Nu).toService(Hu),t(Kl).toService(yd),Xi(t,Kl))}));let gf=!1;const ff=new vi((t=>{gf||(gf=!0,t(Gu).to(Pu).inSingletonScope(),t(Nu).toService(Gu),t(Xl).toService(yd),Xi(t,Xl))}));var mf=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},vf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let yf=class extends ld{constructor(){super(),this.numberType=hl,this.builtinContributions=[xu],this.init()}drawShape(t,e,i,n,s){const r=Wr(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=Il(o,l,!0),d=Il(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=Wr(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(),Md(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=Wr(t).richtext;this._draw(t,n,!1,i)}};yf=mf([Bi(),vf("design:paramtypes",[])],yf);let _f=!1;const bf=new vi((t=>{_f||(_f=!0,t(Ku).to(yf).inSingletonScope(),t(Nu).toService(Ku))}));const xf=(t,e)=>(d(Af.warnHandler)&&Af.warnHandler.call(null,t,e),e?it.getInstance().warn(`[VChart warn]: ${t}`,e):it.getInstance().warn(`[VChart warn]: ${t}`)),Sf=(t,e,i)=>{if(!d(Af.errorHandler))throw new Error(t);Af.errorHandler.call(null,t,e)},Af={silent:!1,warnHandler:!1,errorHandler:!1},kf=Mg(),wf=kf&&globalThis?globalThis.document:void 0;function Tf(t){return("desktop-browser"===t||"mobile-browser"===t)&&kf}function Cf(t){return Ef(t)||"mobile-browser"===t}function Ef(t){return t.includes("miniApp")||"lynx"===t||"wx"===t}let Mf=0;function Bf(){return Mf>=9999999&&(Mf=0),Mf++}function Rf(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function Of(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&_(t[0].fields))}const If=(t,e,i)=>(t.fields=e||[],t.fname=i,t),Pf=t=>e=>R(e,t),Lf=t=>{it.getInstance().error(t)},Df=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||Lf("Access path missing open bracket: "+t),o>0&&h(),o=0,n=s+1):s>n?h():n=s+1}return o&&Lf("Access path missing closing bracket: "+t),a&&Lf("Access path missing closing quote: "+t),s>n&&(s+=1,h()),e})(t),s=1===n.length?n[0]:t;return If((i&&i.get||Pf)(n),[s],e||s)},Ff=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(_(t)){const n=t.map((t=>Df(t,e,i)));return t=>n.map((e=>e(t)))}return Df(t,e,i)};Ff("id");const jf=If((function(t){return t}),[],"identity");If((function(){return 0}),[],"zero"),If((function(){return 1}),[],"one"),If((function(){return!0}),[],"true"),If((function(){return!1}),[],"false"),If((function(){return{}}),[],"emptyObject");const Nf=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=>Nf(t,r,s)))))},zf=(t,e)=>u(t)?e:y(t)?e*parseFloat(t)/100:t,Vf=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Hf extends vl{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,Vf.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=>Vf.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 gm=(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"},fm=(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 mm 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=Jr.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=Jr.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||gm(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=fm(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=Jr.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=fm(i,s),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=gm(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=Jr.now()-i>this.config.press.time&&fm(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},ym=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const _m=[0,0,0];let bm=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({},cs),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},us),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},ps),{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 Kc.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&&(Kc.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(Kc.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&&Hl.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&&(Tg(_m,[t,e,i],this.modelMatrix),t=_m[0],e=_m[1],i=_m[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&&(Tg(_m,[t,e,i],this.modelMatrix),t=_m[0],e=_m[1],i=_m[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(Tg(_m,[e,i,n],this.modelMatrix),e=_m[0],i=_m[1],n=_m[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]:Rs.global.measureTextMethod;var i,n;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Rs.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const s=null!==(i=this.fontFamily)&&void 0!==i?i:ps.fontFamily,r=null!==(n=this.fontSize)&&void 0!==n?n:ps.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&&(Tg(_m,[e,i,n],this.modelMatrix),e=_m[0],i=_m[1],n=_m[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=ud(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=dd(this,l,this.dpr),r.strokeStyle=ud(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=ih(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=ih(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=>Kc.free(t))),this.stack.length=0}};bm.env="browser",bm=vm([Bi(),ym("design:paramtypes",[Object,Number])],bm);var xm=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},Sm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Am=class extends Vg{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Rs.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new bm(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 km(t,e){return new vi((i=>{i(Ks).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Xs).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Am.env="browser",Am=xm([Bi(),Sm("design:paramtypes",[Object])],Am);const wm=km(Am,bm);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)},Em=function(t,e){return function(i,n){e(i,n,t)}};let Mm=class extends Zg{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=wr.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 Rm=class{constructor(){this.type="group",this.numberType=nl}contains(t,e,i){return!1}};Rm=Bm([Bi()],Rm);const Om=new vi(((t,e,i,n)=>{Om.__vloaded||(Om.__vloaded=!0,t(dm).to(Rm).inSingletonScope(),t(um).toService(dm),Xi(t,um))}));Om.__vloaded=!1;var Im=Om;const Pm=new vi(((t,e,i,n)=>{i(Mm)||t(Mm).toSelf().inSingletonScope(),i(up)?n(up).toService(Mm):t(up).toService(Mm)}));var Lm,Dm=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},Fm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let jm=Lm=class extends Yg{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Lm.idprefix}_${Lm.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Rs.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:Lm.GenerateCanvasId(),canvasControled:!0};this.canvas=new Am(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 Am({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)}};jm.env="browser",jm.idprefix="visactor_window",jm.prefix_count=0,jm=Lm=Dm([Bi(),Fm("design:paramtypes",[])],jm);const Nm=new vi((t=>{t(jm).toSelf(),t(Mr).toDynamicValue((t=>t.container.get(jm))).whenTargetNamed(jm.env)}));var 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)};class Hm{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 Gm(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 Wm=class extends Gg{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 Hm(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 Gm(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Gm(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}}};Wm=zm([Bi(),Vm("design:paramtypes",[])],Wm);const Um=new vi((t=>{Um.isBrowserBound||(Um.isBrowserBound=!0,t(Wm).toSelf().inSingletonScope(),t(qi).toService(Wm))}));function Ym(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Ym.__loaded||(Ym.__loaded=!0,t.load(Um),t.load(wm),t.load(Nm),e&&function(t){t.load(Im),t.load(Pm)}(t))}Um.isBrowserBound=!1,Ym.__loaded=!1;var Km=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},Xm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$m=function(t,e){return function(i,n){e(i,n,t)}};let Zm=class extends Zg{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 Fg(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}};Zm=Km([Bi(),$m(0,Ei(Yi)),$m(0,Ri(Gf)),$m(1,Ei(Yi)),$m(1,Ri(fp)),Xm("design:paramtypes",[Object,Object])],Zm);const qm=new vi((t=>{qm.__vloaded||(qm.__vloaded=!0,Xi(t,Gf))}));qm.__vloaded=!1;var Jm=qm,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},tv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ev=function(t,e){return function(i,n){e(i,n,t)}};let iv=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=Jo}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=Wr(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}};iv=Qm([Bi(),ev(0,Ei(Du)),tv("design:paramtypes",[Object])],iv);let nv=!1;const sv=new vi(((t,e,i,n)=>{nv||(nv=!0,t(Wf).to(iv).inSingletonScope(),t(Gf).toService(Wf))}));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},av=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ov=function(t,e){return function(i,n){e(i,n,t)}};let lv=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=tl}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=Wr(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}};lv=rv([Bi(),ov(0,Ei(Fu)),av("design:paramtypes",[Object])],lv);let hv=!1;const cv=new vi(((t,e,i,n)=>{hv||(hv=!0,t(Uf).to(lv).inSingletonScope(),t(Gf).toService(Uf))}));var dv=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)},pv=function(t,e){return function(i,n){e(i,n,t)}};let gv=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=el}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=Wr(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}};gv=dv([Bi(),pv(0,Ei(ju)),uv("design:paramtypes",[Object])],gv);let fv=!1;const mv=new vi(((t,e,i,n)=>{fv||(fv=!0,t(Yf).to(gv).inSingletonScope(),t(Gf).toService(Yf))}));var vv=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},yv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_v=function(t,e){return function(i,n){e(i,n,t)}};let bv=class{constructor(t){this.canvasRenderer=t,this.type="glyph",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=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}};bv=vv([Bi(),_v(0,Ei(Xu)),yv("design:paramtypes",[Object])],bv);let xv=!1;const Sv=new vi(((t,e,i,n)=>{xv||(xv=!0,t(tm).to(bv).inSingletonScope(),t(bv).toService(tm))}));var Av=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 kv=class{constructor(){this.type="image",this.numberType=sl}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};kv=Av([Bi()],kv);let wv=!1;const Tv=new vi(((t,e,i,n)=>{wv||(wv=!0,t(Kf).to(kv).inSingletonScope(),t(kv).toService(Kf))}));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},Ev=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mv=function(t,e){return function(i,n){e(i,n,t)}};let Bv=class{constructor(t){this.canvasRenderer=t,this.type="line",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=Wr(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}};Bv=Cv([Bi(),Mv(0,Ei(Vu)),Ev("design:paramtypes",[Object])],Bv);let Rv=!1;const Ov=new vi(((t,e,i,n)=>{Rv||(Rv=!0,t(Xf).to(Bv).inSingletonScope(),t(Gf).toService(Xf))}));var Iv=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},Pv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Lv=function(t,e){return function(i,n){e(i,n,t)}};let Dv=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=ol}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=Wr(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}};Dv=Iv([Bi(),Lv(0,Ei(Gu)),Pv("design:paramtypes",[Object])],Dv);let Fv=!1;const jv=new vi(((t,e,i,n)=>{Fv||(Fv=!0,t(Qf).to(Dv).inSingletonScope(),t(Gf).toService(Qf))}));var 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},zv=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 Hv=class{constructor(t){this.canvasRenderer=t,this.type="path",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=Wr(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}};Hv=Nv([Bi(),Vv(0,Ei(Hu)),zv("design:paramtypes",[Object])],Hv);let Gv=!1;const Wv=new vi(((t,e,i,n)=>{Gv||(Gv=!0,t($f).to(Hv).inSingletonScope(),t(Gf).toService($f))}));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},Yv=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)}};const Xv=new Ht;let $v=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=ll}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=Wr(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;Xv.setValue(i.x1,i.y1,i.x2,i.y2),Xv.expand(-r/2),h=!Xv.containsPoint(e)}}return n.highPerformanceRestore(),h}};$v=Uv([Bi(),Kv(0,Ei(Wu)),Yv("design:paramtypes",[Object])],$v);let Zv=!1;const qv=new vi(((t,e,i,n)=>{Zv||(Zv=!0,t(Zf).to($v).inSingletonScope(),t(Gf).toService(Zf))}));let Jv=!1;const Qv=new vi(((t,e,i,n)=>{Jv||(Jv=!0,t(Kf).to(kv).inSingletonScope(),t(kv).toService(Kf))}));var ty=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},ey=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},iy=function(t,e){return function(i,n){e(i,n,t)}};let ny=class{constructor(t){this.canvasRenderer=t,this.type="symbol",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=Wr(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}};ny=ty([Bi(),iy(0,Ei(Uu)),ey("design:paramtypes",[Object])],ny);let sy=!1;const ry=new vi(((t,e,i,n)=>{sy||(sy=!0,t(qf).to(ny).inSingletonScope(),t(Gf).toService(qf))}));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};let oy=class{constructor(){this.type="text",this.numberType=dl}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};oy=ay([Bi()],oy);let ly=!1;const hy=new vi(((t,e,i,n)=>{ly||(ly=!0,t(Jf).to(oy).inSingletonScope(),t(Gf).toService(Jf))})),cy=new vi(((t,e,i,n)=>{i(Zm)||t(Zm).toSelf().inSingletonScope(),i(up)?n(up).toService(Zm):t(up).toService(Zm)}));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},uy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let py=class extends bm{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(){}};py.env="node",py=dy([Bi(),uy("design:paramtypes",[Object,Number])],py);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},fy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let my=class extends Vg{constructor(t){super(t)}init(){this._context=new py(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};my.env="node",my=gy([Bi(),fy("design:paramtypes",[Object])],my);const vy=km(my,py);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)},by=function(t,e){return function(i,n){e(i,n,t)}};let xy=class extends Yg{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 my(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 my({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){}};xy.env="node",xy=yy([Bi(),by(0,Ei(Ji)),_y("design:paramtypes",[Object])],xy);const Sy=new vi((t=>{t(xy).toSelf(),t(Mr).toDynamicValue((t=>t.container.get(xy))).whenTargetNamed(xy.env)}));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};let ky=class extends Gg{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 Oa.call(t)}}getCancelAnimationFrame(){return t=>{Oa.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};ky=Ay([Bi()],ky);const wy=new vi((t=>{wy.isNodeBound||(wy.isNodeBound=!0,t(ky).toSelf().inSingletonScope(),t(qi).toService(ky))}));function Ty(t){Ty.__loaded||(Ty.__loaded=!0,t.load(wy),t.load(vy),t.load(Sy))}wy.isNodeBound=!1,Ty.__loaded=!1;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 bm{draw(){}createPattern(t,e){return null}};Ey.env="wx",Ey=Cy([Bi()],Ey);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},By=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ry=class extends Vg{constructor(t){super(t)}init(){this._context=new Ey(this,this._dpr)}release(){}};Ry.env="wx",Ry=My([Bi(),By("design:paramtypes",[Object])],Ry);const Oy=km(Ry,Ey);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)},Ly=function(t,e){return function(i,n){e(i,n,t)}};class Dy{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 Fy=class extends Yg{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new Dy}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 Ry(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 Ry({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()}};Fy.env="wx",Fy=Iy([Bi(),Ly(0,Ei(Ji)),Py("design:paramtypes",[Object])],Fy);const jy=new vi((t=>{t(Fy).toSelf(),t(Mr).toDynamicValue((t=>t.container.get(Fy))).whenTargetNamed(Fy.env)}));var Ny=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)},Vy=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 Hy=class extends Gg{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 Vy(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 Oa.call(t)}}getCancelAnimationFrame(){return t=>{Oa.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}};Hy=Ny([Bi(),zy("design:paramtypes",[])],Hy);const Gy=new vi((t=>{Gy._isWxBound||(Gy._isWxBound=!0,t(Hy).toSelf().inSingletonScope(),t(qi).toService(Hy))}));function Wy(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Wy.__loaded||(Wy.__loaded=!0,t.load(Gy),t.load(Oy),t.load(jy),e&&function(t){t.load(Jm),t.load(cy),t.load(sv),t.load(cv),t.load(mv),t.load(Sv),t.load(Tv),t.load(Ov),t.load(jv),t.load(Wv),t.load(qv),t.load(Qv),t.load(ry),t.load(hy)}(t))}Gy._isWxBound=!1,Wy.__loaded=!1;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},Yy=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 Xy=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=Jo}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=Wr(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=dd(n,r+a,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};Xy=Uy([Bi(),Ky(0,Ei(Du)),Yy("design:paramtypes",[Object])],Xy);let $y=!1;const Zy=new vi(((t,e,i,n)=>{$y||($y=!0,t(em).to(Xy).inSingletonScope(),t(um).toService(em))}));var qy=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)},Qy=function(t,e){return function(i,n){e(i,n,t)}};const t_=new Ht;let e_=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=ll}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=Wr(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=dd(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;t_.setValue(i.x1,i.y1,i.x2,i.y2),t_.expand(-r/2),h=!t_.containsPoint(e)}}return n.highPerformanceRestore(),h}};e_=qy([Bi(),Qy(0,Ei(Wu)),Jy("design:paramtypes",[Object])],e_);let i_=!1;const n_=new vi(((t,e,i,n)=>{i_||(i_=!0,t(am).to(e_).inSingletonScope(),t(um).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};let r_=class extends ld{};r_=s_([Bi()],r_);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},o_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},l_=function(t,e){return function(i,n){e(i,n,t)}};let h_=class extends r_{constructor(t){super(),this.canvasRenderer=t,this.type="line",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;n.highPerformanceSave();const s=Wr(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=dd(n,s+r,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&Xc.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};h_=a_([Bi(),l_(0,Ei(Vu)),o_("design:paramtypes",[Object])],h_);let c_=!1;const d_=new vi(((t,e,i,n)=>{c_||(c_=!0,t(sm).to(h_).inSingletonScope(),t(um).toService(sm))}));var u_=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},p_=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 f_=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=tl}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=Wr(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=dd(n,r+a,n.dpr),h=t.isPointInStroke(e.x,e.y),h})),n.highPerformanceRestore(),h}};f_=u_([Bi(),g_(0,Ei(Fu)),p_("design:paramtypes",[Object])],f_);let m_=!1;const v_=new vi(((t,e,i,n)=>{m_||(m_=!0,t(im).to(f_).inSingletonScope(),t(um).toService(im))}));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},__=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 x_=class extends r_{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=cl}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=Wr(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=dd(n,s+r,n.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,n.modelMatrix!==c&&Xc.free(n.modelMatrix),n.modelMatrix=c,n.highPerformanceRestore(),u}};x_=y_([Bi(),b_(0,Ei(Uu)),__("design:paramtypes",[Object])],x_);let S_=!1;const A_=new vi(((t,e,i,n)=>{S_||(S_=!0,t(om).to(x_).inSingletonScope(),t(um).toService(om))}));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},w_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},T_=function(t,e){return function(i,n){e(i,n,t)}};let C_=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=el}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=Wr(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=dd(n,r+a,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};C_=k_([Bi(),T_(0,Ei(ju)),w_("design:paramtypes",[Object])],C_);let E_=!1;const M_=new vi(((t,e,i,n)=>{E_||(E_=!0,t(nm).to(C_).inSingletonScope(),t(um).toService(nm))}));var B_=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},R_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},O_=function(t,e){return function(i,n){e(i,n,t)}};let I_=class extends r_{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=dl}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=Wr(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=sh(a,u,s),v=nh(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&&Xc.free(n.modelMatrix),n.modelMatrix=u,n.highPerformanceRestore(),g}};I_=B_([Bi(),O_(0,Ei(Yu)),R_("design:paramtypes",[Object])],I_);let P_=!1;const L_=new vi(((t,e,i,n)=>{P_||(P_=!0,t(lm).to(I_).inSingletonScope(),t(um).toService(lm))}));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},F_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},j_=function(t,e){return function(i,n){e(i,n,t)}};let N_=class extends r_{constructor(t){super(),this.canvasRenderer=t,this.type="path",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=Wr(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=dd(n,s+r,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&Xc.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};N_=D_([Bi(),j_(0,Ei(Hu)),F_("design:paramtypes",[Object])],N_);let z_=!1;const V_=new vi(((t,e,i,n)=>{z_||(z_=!0,t(rm).to(N_).inSingletonScope(),t(um).toService(rm))}));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},G_=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 U_=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=ol}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=Wr(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=dd(n,r+a,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};U_=H_([Bi(),W_(0,Ei(Gu)),G_("design:paramtypes",[Object])],U_);let Y_=!1;const K_=new vi(((t,e,i,n)=>{Y_||(Y_=!0,t(hm).to(U_).inSingletonScope(),t(um).toService(hm))}));var X_=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},$_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Z_=function(t,e){return function(i,n){e(i,n,t)}};let q_=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=hl}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};q_=X_([Bi(),Z_(0,Ei(Ku)),$_("design:paramtypes",[Object])],q_);let J_=!1;const Q_=new vi(((t,e,i,n)=>{J_||(J_=!0,t(cm).to(q_).inSingletonScope(),t(um).toService(cm))})),tb=Mg();function eb(){eb.__loaded||(eb.__loaded=!0,nd.RegisterGraphicCreator("arc",jc),Ys.load(Jg),Ys.load(tb?Zy:sv))}eb.__loaded=!1;const ib=eb;function nb(){nb.__loaded||(nb.__loaded=!0,nd.RegisterGraphicCreator("area",Lc),Ys.load(rf),Ys.load(tb?v_:cv))}nb.__loaded=!1;const sb=nb;function rb(){rb.__loaded||(rb.__loaded=!0,nd.RegisterGraphicCreator("circle",eh),Ys.load(hf),Ys.load(tb?M_:mv))}rb.__loaded=!1;const ab=rb;function ob(){ob.__loaded||(ob.__loaded=!0,nd.RegisterGraphicCreator("group",yl))}ob.__loaded=!1;const lb=ob;function hb(){hb.__loaded||(hb.__loaded=!0,nd.RegisterGraphicCreator("line",mc),Ys.load(nf),Ys.load(tb?d_:Ov))}hb.__loaded=!1;const cb=hb;function db(){db.__loaded||(db.__loaded=!0,nd.RegisterGraphicCreator("path",Oc),Ys.load(pf),Ys.load(tb?V_:Wv))}db.__loaded=!1;const ub=db;function pb(){pb.__loaded||(pb.__loaded=!0,nd.RegisterGraphicCreator("polygon",Vc),Ys.load(ff),Ys.load(tb?K_:jv))}pb.__loaded=!1;const gb=pb;function fb(){fb.__loaded||(fb.__loaded=!0,nd.RegisterGraphicCreator("rect",_c),Ys.load(tf),Ys.load(tb?n_:qv))}fb.__loaded=!1;const mb=fb;function vb(){vb.__loaded||(vb.__loaded=!0,nd.RegisterGraphicCreator("richtext",Mc),Ys.load(bf),Ys.load(tb?Q_:Qv))}vb.__loaded=!1;const yb=vb;function _b(){_b.__loaded||(_b.__loaded=!0,nd.RegisterGraphicCreator("shadowRoot",Gc))}_b.__loaded=!1;const bb=_b;function xb(){xb.__loaded||(xb.__loaded=!0,nd.RegisterGraphicCreator("symbol",pc),Ys.load(of),Ys.load(tb?A_:ry))}xb.__loaded=!1;const Sb=xb;function Ab(){Ab.__loaded||(Ab.__loaded=!0,nd.RegisterGraphicCreator("text",lh),Ys.load(df),Ys.load(tb?L_:hy))}Ab.__loaded=!1;const kb=Ab;function wb(){lb(),mb()}const Tb=-.5*Math.PI,Cb=1.5*Math.PI,Eb="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 Mb;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(Mb||(Mb={}));const Bb={[Mb.selectedReverse]:{},[Mb.selected]:{},[Mb.hover]:{},[Mb.hoverReverse]:{}},Rb={container:"",width:30,height:30,style:{}},Ob={debounce:gt,throttle:ft};wb();class Ib extends Hf{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},Ib.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"===cg.env?(cg.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),cg.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:Ob[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"===cg.env?(cg.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),cg.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",Ob[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 Pb(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&Pb(t,e)}))}Ib.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 Lb=t=>!u(t)&&!1!==t.visible;const Db=["#ffffff","#000000"];function Fb(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 jb(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(...Db);for(const s of a)if(t!==s&&jb(s,e,i,n,r))return s}(a,o,i,n,s,r)}function jb(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?Nb(t,e)>n:"largeText"===i?Nb(t,e)>3:Nb(t,e)>4.5}function Nb(t,e){const i=zb(t),n=zb(e);return((i>n?i:n)+.05)/((i>n?n:i)+.05)}function zb(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 Vb(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 Hb(t,e){return[t[0]*e,t[1]*e]}function Gb(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 Wb=(t,e,i,n)=>new Be(Object.assign({defaultFontParams:Object.assign({fontFamily:Eb,fontSize:14},n),getTextBounds:i?void 0:ad,specialCharSet:"-/: .,@%'\"~"+Be.ALPHABET_CHAR_SET+Be.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function Ub(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const n=ad({text:t,fontFamily:e.fontFamily||i.fontFamily||Eb,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 Yb(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 Kb(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 Xb(t){const e=Yb(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?nd.richtext(Kb(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)),nd.text(t))}function $b(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 Zb(){lb(),mb(),Sb(),yb(),kb()}var qb=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({},Kb(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=qb(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");B(null==m?void 0:m.panel)||(t.states=m.panel),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=Ub(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=qb(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");B(null==m?void 0:m.panel)||(t.states=m.panel),this._bgRect=t}}this._textShape=R}}Jb.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const Qb={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}},tx={poptip:j({},Qb)};class ex extends Hf{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}lb(),cb();class ix extends ex{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},ix.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})}}ix.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},lb(),mb();class nx extends ex{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},nx.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})}}nx.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};const sx=new Uint32Array(33),rx=new Uint32Array(33);rx[0]=0,sx[0]=~rx[0];for(let t=1;t<=32;++t)rx[t]=rx[t-1]<<1|1,sx[t]=~rx[t];function ax(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]&sx[31&l]&rx[1+(31&h)])return!0}else{if(i[c]&sx[31&l])return!0;if(i[d]&rx[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,sx[31&s]&rx[1+(31&r)]);else for(n(a,sx[31&s]),n(o,rx[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,rx[31&i]|sx[1+(31&n)]);else for(s(r,rx[31&i]),s(a,sx[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 ox(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 lx(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=ox(t,r),!(n&&e.outOfBounds(r)||e.getRange(r))}function hx(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 hx(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 hx(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 hx(t,e,s,n,h,c)}return!1}const dx=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],ux=["top","inside-top","inside"];function px(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 gx={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 fx(t,e){var i,n;return null!==(n=null===(i=gx[e])||void 0===i?void 0:i.call(gx,t))&&void 0!==n?n:{from:{},to:{}}}const mx=(t,e,i,n)=>{const s=Object.assign({},t.attribute),r=Object.assign({},e.attribute);return U(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 vx(t,e,i,n){t.attribute.text!==e.attribute.text&&A(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new Pa({text:t.attribute.text},{text:e.attribute.text},i,n))}const yx={mode:"same-time",duration:300,easing:"linear"};function _x(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 bx(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 xx(t){return 3===t||4===t}function Sx(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 Ax=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)}},kx=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 Tx(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 Cx(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)}}lb(),kb(),yb(),cb();class Ex extends Hf{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},Ex.defaultAttributes,t)),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(Mb.hover,!0),Pb(this,(t=>{t===e||B(t.states)||t.addState(Mb.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(Pb(this,(t=>{B(t.states)||(t.removeState(Mb.hoverReverse),t.removeState(Mb.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void Pb(this,(t=>{B(t.states)||(t.removeState(Mb.selectedReverse),t.removeState(Mb.selected))}));B(e.states)||(e.addState(Mb.selected,!0),Pb(this,(t=>{t===e||B(t.states)||t.addState(Mb.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:[];(this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)]).forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(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[Cx(g,f,c,d,a,o),Cx(-g,-f,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds);if(i){const t=nd.line({points:i});return e&&e.attribute.fill&&t.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&t.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(t),t}}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)),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 Xb(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&&_.setRange(ox(v,t.AABBBounds,!0))}))),f.length>0&&f.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&&_.setRange(ox(v,t.AABBBounds,!0))})):t.AABBBounds&&_.setRange(ox(v,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 i=new Map,n=this._graphicToText||new Map,s=[],r=[],{visible:a}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{const o=this.getRelatedGraphic(t.attribute),l=t.attribute.id,h=this._isCollectionBase?l:o,c=(null==n?void 0:n.get(h))?"update":"enter";let d;if(a&&(d=this._createLabelLine(t,o)),"enter"===c){if(s.push(t),i.set(h,d?{text:t,labelLine:d}:{text:t}),o){const{from:i,to:n}=fx(t.attribute,"fadeIn");this.add(t),d&&(r.push(d),this.add(d)),this._syncStateWithRelatedGraphic(o),this._animationConfig.enter.duration>0&&o.once("animate-bind",(a=>{t.setAttributes(i),d&&d.setAttributes(i);const l=this._afterRelatedGraphicAttributeUpdate(t,s,d,r,e,o,n,this._animationConfig.enter);o.on("afterAttributeUpdate",l)}))}}else if("update"===c){const e=n.get(h);n.delete(h),i.set(h,e);const s=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&&vx(t,e,n,s))}i.forEach(((i,n)=>{const{duration:s,easing:r,increaseEffect:a=!0,channel:o}=i,{from:l,to:h}=mx(t,e,o,i.options);B(h)||t.animate().to(h,s,r),"text"in l&&"text"in h&&a&&vx(t,e,s,r)}))})(s,t,this._animationConfig.update),e.labelLine&&d&&e.labelLine.animate().to(d.attribute,r,a)}})),n.forEach((t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(fx(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=i}_renderWithOutAnimation(t){var e;const i=new Map,n=this._graphicToText||new Map,{visible:s}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach((t=>{const e=this.getRelatedGraphic(t.attribute),r=(null==n?void 0:n.get(e))?"update":"enter",a=this._isCollectionBase?t.attribute.id:e;let o;if(s&&(o=this._createLabelLine(t,e)),"enter"===r)i.set(a,o?{text:t,labelLine:o}:{text:t}),this.add(t),o&&this.add(o),this._syncStateWithRelatedGraphic(e);else if("update"===r){const e=n.get(a);n.delete(a),i.set(a,e),e.text.setAttributes(t.attribute),e.labelLine&&o&&e.labelLine.setAttributes(o.attribute)}})),n.forEach((t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)})),this._graphicToText=i}_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)}}Mx.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};class Bx extends Ex{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},Bx.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}}}Bx.tag="rect-label",Bx.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};let Rx=class t extends Ex{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 Tx(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};Rx.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class Ox{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 Ix extends Ex{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},Ix.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:"…"}),s=this._createLabelText(n),r=this.getGraphicBounds(s),a=r.x2-r.x1,o=e.map((t=>t.attribute)),l=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),o,i,a);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=bx(l.endAngle-d/2),p=_x(h.x,h.y,l.outerRadius,o),g=_x(h.x,h.y,a+e.line.line1MinLength,o),f=new Ox(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);f.pointA=_x(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):xx(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=_x(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=xx(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=xx(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=xx(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?xx(t.quadrant)?"left":"right":xx(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*(xx(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;e1&&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 Tx(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}Px.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class Lx extends Ex{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},Lx.defaultAttributes,t)),this.name="line-data-label"}labeling(t,e){return Ax(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}Lx.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const Dx={rect:Bx,symbol:Mx,arc:Ix,line:Rx,area:Px,"line-data":Lx};class Fx extends Hf{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},Fx.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=ax(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()}))}}Fx.defaultAttributes={pickable:!1},lb(),cb(),gb(),Sb();class jx extends Hf{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({},jx.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=nd.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=nd.line;U(i)[0].cornerRadius&&(t=nd.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},U(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=nd.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 Nx,zx;jx.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"}(Nx||(Nx={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(zx||(zx={}));const Vx={[zx.selectedReverse]:{},[zx.selected]:{},[zx.hover]:{},[zx.hoverReverse]:{}},Hx={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}}},Gx=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 Wx(t,e,i){return!lt(t,e,0,1e-6)&&!ot(t,i,0,1e-6)}function Ux(t,e,i,n){const s=ad(Object.assign({text:i},n)),r=s.width(),a=s.height(),o=Gx(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=Wx(o,-l,-h)?((o+l)/c-.5)*r:Wx(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=Wx(o,-l,-h)?.5*-a:Wx(o,h,l)?.5*a:Math.cos(o)>=0?(.5-(h-o)/c)*a:(.5-Gx(o-l)/c)*a,{x:p,y:g-f}}function Yx(t){const e={};return Pb(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function Kx(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function Xx(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 Hb(r,(n?-1:1)*(s?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}class $x extends Hf{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(Mb.hover,!0),Pb(e,(t=>{t!==n&&t.name&&!B(t.states)&&t.addState(Mb.hoverReverse,!0)})),n):i})(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=((t,e,i)=>i?(Pb(e,(t=>{t.name&&!B(t.states)&&(t.removeState(Mb.hoverReverse),t.removeState(Mb.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(Mb.selected)?(Pb(e,(t=>{t.name&&!B(t.states)&&(t.removeState(Mb.selectedReverse),t.removeState(Mb.selected))})),null):n.name&&!B(n.states)?(n.addState(Mb.selected,!0),Pb(e,(t=>{t!==n&&t.name&&!B(t.states)&&t.addState(Mb.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=nd.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&&Yx(this._innerView),this.removeAllChild(!0),this._innerView=nd.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=nd.group({x:0,y:0,zIndex:1});if(a.name=Nx.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=nd.group({x:0,y:0,pickable:!1});t.name=Nx.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=nd.group({x:0,y:0,pickable:!1});i.name=Nx.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,n)=>{var s;const r=nd.line(Object.assign({},this._getTickLineAttribute("tick",t,n,e)));if(r.name=Nx.tick,r.id=this._getNodeId(t.id),B(null===(s=this.attribute.tick)||void 0===s?void 0:s.state))r.states=Bb;else{const t=this.data[n],e=j({},Bb,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=nd.line(Object.assign({},this._getTickLineAttribute("subTick",t,s,e)));if(r.name=Nx.subTick,r.id=this._getNodeId(`${s}`),B(n.state))r.states=Bb;else{const i=j({},Bb,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=nd.group({x:0,y:0,pickable:!1});return r.name=`${Nx.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),s.forEach(((t,e)=>{var n;const a=Xb(this._getLabelAttribute(t,e,s,i));if(a.name=Nx.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=Bb;else{const n=j({},Bb,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 Jb(Object.assign({},e));i.name=Nx.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return Kx(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({},Hx.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 Zx(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 qx(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 Jx={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&&Qx(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function Qx(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 tS(t,e){for(let i,n=1,s=t.length,r=t[0];n1&&e.height()>1}function iS(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},rS(t,e.attribute.angle)),{angle:sS(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({},aS(t,e.attribute.angle)),{angle:sS(e.attribute.angle)}))}))}(t,e),Zx(e)}function sS(){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 rS(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=sS(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 aS(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=sS(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 oS{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 Hb([n[1],-1*n[0]],t*(e?1:-1)*i)}}function lS(){lb(),cb(),yb(),kb()}var hS=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=Gb(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({},Vx,c.text),shape:j({},Vx,c.shape),panel:j({},Vx,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 rS(e?"bottom"===n?"top":"bottom":n,i);if("left"===n||"right"===n)return aS(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)})),nS(i,t),!iS(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(eS);if(B(i))return;let n;n=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i),Zx(n);const{method:s="parity",separation:r=0}=e,a=d(s)?s:Jx[s]||Jx.parity;if(n.length>=3&&tS(n,r)){do{n=a(n,r)}while(n.length>=3&&tS(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&&Qx(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=nd.rect({x:e,y:n,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=Nx.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=Ub(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}}cS.defaultAttributes=Hx,W(cS,oS);class dS{isInValidValue(t){const{startAngle:e=Tb,endAngle:i=Cb}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=Tb,endAngle:i=Cb,center:n,radius:s,inside:r=!1,innerRadius:a=0}=this.attribute;return Ut(n,r&&a>0?a:s,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Xx(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 uS,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);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=nd.circle(c);d.name=Nx.line,d.id=this._getNodeId("line"),B(a.state)||(d.states=j({},Vx,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=pS(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({},Vx,d.text),shape:j({},Vx,d.shape),panel:j({},Vx,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 Ux(t,e,i,n)}}gS.defaultAttributes=Hx,W(gS,dS);class fS extends da{constructor(){super(...arguments),this.mode=bn.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},Pb(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{vS[t]=!0}));const SS=t=>-Math.log(-t),AS=t=>-Math.exp(-t),kS=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,wS=t=>10===t?kS:t===Math.E?Math.exp:e=>Math.pow(t,e),TS=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),CS=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),ES=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function MS(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 BS(t,e,i){const n=t[0],s=t[1],r=e[0],a=e[1];let o,l;return sl(o(t))}function RS(t,e,i){let n;return n=1===t?t+2*i:t-e+2*i,t?n>0?n:1:0}function OS(t,e,i,n){return 1===i&&(i=0),RS(t,i,n)*(e/(1-i))}function IS(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),n=t[0]-i*e[0];return[n,i+n]}function PS(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 FS{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=IS(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 jS=Symbol("implicit");class NS extends FS{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=uS.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=jS}clone(){const t=(new NS).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!==jS)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 VS extends NS{constructor(t){super(),this.type=uS.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=OS(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:zS(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 zS(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 VS(!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:HS}=le;function GS(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=HS(re.parseColorString(t),n);return t=>e(t).formatRgb()}return mt(Number(t),Number(e))}return e instanceof ae?HS(t,e):e instanceof re?HS(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 WS extends FS{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:xS,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:xS;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=xS,this._piecewise=BS,this._interpolate=GS}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?PS:BS,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:xS),this.rescale(i)):this._clamp!==xS}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 US=Math.sqrt(50),YS=Math.sqrt(10),KS=Math.sqrt(2),XS=[1,2,5,10],$S=(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=QS(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?qS(0,-(e-1)/n,n):qS((e-1)/n,0,n)},ZS=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 $S(t,i,null==n?void 0:n.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return $S(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=qS(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=qS(t,e,l);return s&&r.reverse(),r})),QS=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let n=XS[0];return i>=US?n=XS[3]:i>=YS?n=XS[2]:i>=KS&&(n=XS[1]),e>=0?{step:n*10**e,gap:n,power:e}:{step:-(10**-e)/n,gap:n,power:e}};function tA(t,e,i){const n=(e-t)/Math.max(0,i);return QS(n)}function eA(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=tA(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 nA(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 sA=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),rA=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})),aA=ht(((t,e,i,n,s,r)=>{const a=[],o={},l=s(t),h=s(e);let c=[];if(Number.isInteger(n))c=JS(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const s=r(i),l=Number.isInteger(n)?sA(t,e,s):sA(t,e,DS(s)),h=sA(t,e,((t,e)=>{let i,n;return e[0]1&&(o[h]=1,a.push(h))})),a})),oA=ht(((t,e,i,n,s)=>eA(n(t),n(e),i).map((t=>DS(s(t))))));class lA extends WS{constructor(){super(...arguments),this.type=uS.Linear}clone(){return(new lA).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 ZS(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=JS(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 eA(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=nA(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=iA(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=iA(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=iA(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function hA(t){return e=>-t(-e)}function cA(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class dA extends WS{constructor(){super(TS(10),wS(10)),this.type=uS.Log,this._limit=cA(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new dA).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=TS(this._base),n=wS(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=hA(i),this._pows=hA(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=SS,this.untransformer=AS):(this._logs=i,this._pows=n,this._limit=cA(),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 xS}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 rA(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 aA(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 oA(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return oA(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=nA(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=LS(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 uA extends lA{constructor(){super(CS(1),ES(1)),this.type=uS.Symlog,this._const=1}clone(){return(new uA).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=CS(t),this.untransformer=ES(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 rA(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 aA(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 oA(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return oA(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=nA(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=LS(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 pA{constructor(){this.type=uS.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 pA).domain(this._domain).range(this._range).unknown(this._unknown)}}const gA=t=>t.map(((t,e)=>({index:e,value:t}))),fA=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 mA(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function vA(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=Wb(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=yA(S,_,f[0],f[f.length-1]):a&&c&&n===e.length-1?T=yA(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=yA(A,b,f[0],f[f.length-1]):a&&d&&n===e.length-1?C=yA(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},bA=(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=Wb(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=Ut({x:0,y:0},i,t),l=Kx(o,Xx(n,o,e,s));return Ux(l,Xx(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},xA={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,n)=>!(n&&mA(i.AABBBounds,t.AABBBounds,e)||(i=t,0))))}},SA=(t,e,i,n)=>_A(t,e,i).map((t=>n?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),AA=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},kA=(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&&!AA(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?kA(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&&fA(e[0],e[i]);)r++,i-=s}return{step:s,delCount:r}},CA=(t,e)=>{if(yS(t.type))return((t,e)=>{if(!yS(t.type))return gA(t.domain());const i=t.range(),n=Math.abs(i[i.length-1]-i[0]);if(n<2)return gA([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=_A(t,h,e).map(((t,e)=>({AABBBounds:t,value:h[e]})));for(;s.length>=3&&vA(s,i);)s=xA.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 gA(h)})(t,e);if(bS(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?gA([n[n.length-1]]):gA([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=SA(t,n,e,c),l=Math.min(...s.map((t=>t[2]))),h=wA(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=SA(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 gA(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=bA(t,i,e),r=X(n),l=K(n),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=TA(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 gA(c)})(t,e)}return gA(t.domain())};function EA(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 MA(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 BA(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=EA(t,!!s),o=EA(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=MA(e,t,!1,!!s),o=MA(e,r,!0,!!s)}else"line"!==n&&"polygon"!==n||(a=EA(t,!!s),o=EA(r,!!s));return s?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class RA extends Hf{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&Yx(this._innerView),this.removeAllChild(!0),this._innerView=nd.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 Kx(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?`${Nx.grid}-sub`:`${Nx.grid}`;if(s.forEach(((t,i)=>{const{id:s,points:o}=t;let c="";if("line"===n||"polygon"===n)c=EA(o,!!a);else if("circle"===n){const{center:t}=this.attribute;c=MA(t,o,!1,!!a)}const u=nd.path(Object.assign({path:c,z:l},d(r)?j({},this.skipDefault?null:RA.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=EA(o,!!a),m=wt(o[0].x-o[1].x),v=wt(o[0].y-o[1].y),y=nd.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:RA.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})}}W(OA,oS);var IA=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 LA(){lb(),Sb(),kb()}W(PA,dS);const DA={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};LA();class FA extends Hf{getCurrent(){return this._current}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},FA.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(GA.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(GA.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===GA.focus||"focus"===o){const n=a.hasState(VA.focus);a.toggleState(VA.focus),n?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[VA.unSelected,VA.unSelectedHover,VA.focus],t),this._setLegendItemState(e,VA.selected,t)})):(this._setLegendItemState(a,VA.selected,t),this._removeLegendItemState(a,[VA.unSelected,VA.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[VA.selected,VA.selectedHover,VA.focus],t),this._setLegendItemState(e,VA.unSelected,t))})))}else{null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((t=>{t.removeState(VA.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(VA.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(HA.legendItemClick,a,t);i?(this._removeLegendItemState(a,[VA.selected,VA.selectedHover],t),this._setLegendItemState(a,VA.unSelected,t)):(this._setLegendItemState(a,VA.selected,t),this._removeLegendItemState(a,[VA.unSelected,VA.unSelectedHover],t))}else this._setLegendItemState(a,VA.selected,t),this._removeLegendItemState(a,[VA.unSelected,VA.unSelectedHover],t),null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[VA.selected,VA.selectedHover],t),this._setLegendItemState(e,VA.unSelected,t))}))}this._dispatchLegendEvent(HA.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,VA.selected),this._removeLegendItemState(e,[VA.unSelected,VA.unSelectedHover])):(this._removeLegendItemState(e,[VA.selected,VA.selectedHover]),this._setLegendItemState(e,VA.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=jA,spaceRow:h=NA}=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;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):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=nd.group({x:0,y:0,cursor:null===(s=w.style)||void 0===s?void 0:s.cursor}),this._appendDataToShape(C,GA.item,t,C)):(C=nd.group(Object.assign({x:0,y:0},w.style)),this._appendDataToShape(C,GA.item,t,C,w.state)),C.id=`${null!=a?a:o}-${i}`,C.addState(e?VA.selected:VA.unSelected);const E=nd.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=nd.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,GA.itemShape,t,C,S.state),n.addState(e?VA.selected:VA.unSelected),E.add(n)}let P=0;if(d){const e=R(g,"size",10);M=nd.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},g),{visible:!0,pickMode:"imprecise",boundsPadding:T})),this._appendDataToShape(M,GA.focus,t,C),P=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=Xb(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,GA.itemLabel,t,C,A.state),D.addState(e?VA.selected:VA.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=Xb(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,GA.itemValue,t,C,k.state),r.addState(e?VA.selected:VA.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 FA(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 FA(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 Ib(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:12},t),{width:e})):new Ib(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=nd.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=jA,spaceRow:a=NA}=n,o=this._itemsContainer,{space:l=zA,defaultCurrent:h=1}=s,c=UA(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=nd.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(VA.selected)?this._setLegendItemState(t,VA.selectedHover,e):this._setLegendItemState(t,VA.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===GA.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(HA.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(VA.unSelectedHover)||t.hasState(VA.selectedHover))&&(i=!0),t.removeState(VA.unSelectedHover),t.removeState(VA.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(VA.unSelectedHover)&&!t.hasState(VA.selectedHover)||(i=!0),t.removeState(VA.unSelectedHover),t.removeState(VA.selectedHover)}));const n=t.getChildren()[0].find((t=>t.name===GA.focus),!1);n&&n.setAttribute("visible",!1),i&&this._dispatchLegendEvent(HA.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(HA.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!==GA.focus&&(n||t.hasState(e)||(n=!0),t.addState(e,!0))})),n&&this._dispatchLegendEvent(HA.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!==GA.focus&&e.forEach((e=>{!n&&t.hasState(e)&&(n=!0),t.removeState(e)}))})),n&&this._dispatchLegendEvent(HA.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(VA.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({},YA,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(VA.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}};KA.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:jA,spaceRow:NA,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:zA,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0};const XA=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)})},$A=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:U(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}},ZA={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:Eb,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:Eb,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:Eb,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},qA=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];lb(),mb(),Sb(),kb(),yb();let JA=class t extends Hf{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:Lb(u)&&Lb(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:Lb(u)&&Lb(u.value)},$A(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:Lb(u)&&Lb(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:Lb(u)&&Lb(u.value)},$A(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},Rb),u.value),visible:Lb(u)&&Lb(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=Lb(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=Lb(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(!Lb(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)+(Lb(s.key)?r+s.key.spacing:0)+(Lb(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&&($b(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:Lb(s.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),$b(c,f,t,u,a),f.setAttribute("y",0)}e+=s.height+s.spaceRow}))}}_createShape(t,e,i,n){var s;if(Lb(e.shape))return i.createOrUpdateChild(`${n}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(s=Ia(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(Lb(t.key)){let s;return s=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},$A(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},$A(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},Rb),t.key)},"richtext"),s}}_createValue(t,e,i){var n;if(Lb(t.value)){let s;return s=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},$A(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},$A(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=>qA.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)&&Lb(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=Lb(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",y=Wb(u),_=Wb(p);let b=0;if(Lb(u)){const{width:t,height:e}=y.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(Lb(p)){const{width:t,height:e}=_.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}m&&lc[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 XA({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return XA({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};function QA(t,e){const i=tk(t),n=tk(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 tk(t,e={x:0,y:0}){return Nt.distancePP(t,e)}function ek(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}JA.defaultAttributes=ZA;const ik=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var sk,rk;!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"}(sk||(sk={})),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.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(rk||(rk={}));const ak="__VCHART",ok=500,lk=500,hk=`${ak}_LABEL_LIMIT`,ck=`${ak}_LABEL_ALIGN`,dk=`${ak}_LABEL_TEXT`,uk=`${ak}_LABEL_VISIBLE`,pk=`${ak}_LABEL_X`,gk=`${ak}_LABEL_Y`,fk=`${ak}_ARC_TRANSFORM_VALUE`,mk=`${ak}_ARC_RATIO`,vk=`${ak}_ARC_START_ANGLE`,yk=`${ak}_ARC_END_ANGLE`,_k=`${ak}_ARC_K`,bk=`${ak}_ARC_MIDDLE_ANGLE`,xk=`${ak}_ARC_QUADRANT`,Sk=`${ak}_ARC_RADIAN`,Ak=-Math.PI/2,kk=3*Math.PI/2;var wk,Tk,Ck,Ek,Mk,Bk,Rk,Ok,Ik,Pk,Lk,Dk,Fk,jk,Nk;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(wk||(wk={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(Tk||(Tk={})),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"}(Ck||(Ck={})),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"}(Ek||(Ek={})),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"}(Mk||(Mk={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(Bk||(Bk={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(Rk||(Rk={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(Ok||(Ok={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(Ik||(Ik={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(Pk||(Pk={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(Lk||(Lk={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(Dk||(Dk={})),t.VGRAMMAR_HOOK_EVENT=void 0,(Fk=t.VGRAMMAR_HOOK_EVENT||(t.VGRAMMAR_HOOK_EVENT={})).BEFORE_EVALUATE_DATA="beforeEvaluateData",Fk.AFTER_EVALUATE_DATA="afterEvaluateData",Fk.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",Fk.AFTER_EVALUATE_SCALE="afterEvaluateScale",Fk.BEFORE_PARSE_VIEW="beforeParseView",Fk.AFTER_PARSE_VIEW="afterParseView",Fk.BEFORE_TRANSFORM="beforeTransform",Fk.AFTER_TRANSFORM="afterTransform",Fk.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",Fk.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",Fk.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",Fk.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",Fk.BEFORE_STAGE_RESIZE="beforeStageResize",Fk.AFTER_STAGE_RESIZE="afterStageResize",Fk.BEFORE_VRENDER_DRAW="beforeVRenderDraw",Fk.AFTER_VRENDER_DRAW="afterVRenderDraw",Fk.BEFORE_MARK_JOIN="beforeMarkJoin",Fk.AFTER_MARK_JOIN="afterMarkJoin",Fk.BEFORE_MARK_UPDATE="beforeMarkUpdate",Fk.AFTER_MARK_UPDATE="afterMarkUpdate",Fk.BEFORE_MARK_STATE="beforeMarkState",Fk.AFTER_MARK_STATE="afterMarkState",Fk.BEFORE_MARK_ENCODE="beforeMarkEncode",Fk.AFTER_MARK_ENCODE="afterMarkEncode",Fk.BEFORE_DO_LAYOUT="beforeDoLayout",Fk.AFTER_DO_LAYOUT="afterDoLayout",Fk.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",Fk.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",Fk.BEFORE_DO_RENDER="beforeDoRender",Fk.AFTER_DO_RENDER="afterDoRender",Fk.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",Fk.AFTER_MARK_RENDER_END="afterMarkRenderEnd",Fk.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",Fk.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",Fk.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",Fk.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",Fk.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",Fk.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",Fk.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",Fk.BEFORE_ELEMENT_STATE="beforeElementState",Fk.AFTER_ELEMENT_STATE="afterElementState",Fk.BEFORE_ELEMENT_ENCODE="beforeElementEncode",Fk.AFTER_ELEMENT_ENCODE="afterElementEncode",Fk.ANIMATION_START="animationStart",Fk.ANIMATION_END="animationEnd",Fk.ELEMENT_ANIMATION_START="elementAnimationStart",Fk.ELEMENT_ANIMATION_END="elementAnimationEnd",Fk.ALL_ANIMATION_START="allAnimationStart",Fk.ALL_ANIMATION_END="allAnimationEnd",function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(jk||(jk={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(Nk||(Nk={}));const zk="__vgrammar_scene_item__",Vk=[Ck.line,Ck.area],Hk=[Ck.arc3d,Ck.rect3d,Ck.pyramid3d],Gk="key",Wk=[{}],Uk=["key"],Yk=!0,Kk=!0,Xk=!1,$k=!0,Zk="VGRAMMAR_IMMEDIATE_ANIMATION",qk=0,Jk=1e3,Qk=0,tw=0,ew=!1,iw=!1,nw="quintInOut",sw={stopWhenStateChange:!1,immediatelyApply:!0};function rw(t,e){return U(t).reduce(((t,i)=>{const n=y(i)?e.getGrammarById(i):i;return n&&t.push(n),t}),[])}function aw(t,e){if(u(t))return[];if(!d(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(y(i))return U(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 rw(t.dependency,e);var i;return[]}function ow(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function lw(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 hw(t,e){return cw(t)?t.output():e[t]}const cw=t=>t&&!u(t.grammarType),dw=t=>d(t)?t:e=>e[t];function uw(t){return!!(null==t?void 0:t.scale)}function pw(t){return!!(null==t?void 0:t.field)}function gw(t,e){if(!t)return[];let i=[];return t.scale&&(i=cw(t.scale)?[t.scale]:U(e.getScaleById(t.scale))),i.concat(aw(t,e))}function fw(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 mw(t,e,i,n,s){i&&(ow(i)?e.forEach((e=>{const s=lw(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 Ck.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case Ck.group:case Ck.rect:case Ck.image:return["width","height","y1"].includes(e);case Ck.path:case Ck.shape:return["path","customPath"].includes(e);case Ck.line:return"defined"===e;case Ck.area:return["x1","y1","defined"].includes(e);case Ck.rule:return["x1","y1"].includes(e);case Ck.symbol:return"size"===e;case Ck.polygon:return"points"===e;case Ck.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(uw(l)){const t=hw(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?Ff(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(pw(l)){const t=Ff(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=lw(l,n,e.datum,t)}))})))}function vw(t,e,i,n){if(!t)return null;if(ow(t))return lw(t,n,e,i);const s={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(uw(h)){const t=hw(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?Ff(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(pw(h)){const t=Ff(h.field);s[r]=t(e)}else s[r]=lw(h,n,e,i)})),s}class yw{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=U(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}let _w=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]}};_w._plotMarks={},_w._marks={},_w._components={},_w._graphicComponents={},_w._transforms={},_w._grammars={},_w._glyphs={},_w._animations={},_w._interactions={},_w._graphics={},_w.registerGlyph=(t,e,i,n,s)=>(_w._glyphs[t]=new yw(e,i,n,s),_w._glyphs[t]),_w.registerAnimationType=(t,e)=>{_w._animations[t]=e},_w.getAnimationType=t=>_w._animations[t],_w.registerInteraction=(t,e)=>{_w._interactions[t]=e},_w.registerGraphic=(t,e)=>{_w._graphics[t]=e},_w.getGraphicType=t=>_w._graphics[t],_w.createGraphic=(t,e)=>{const i=_w._graphics[t];return i?i(e):null};const bw=t=>!!Ck[t];function xw(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var n;const s=_w.getGraphicType(e)?_w.createGraphic(e,i):_w.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 Sw=t=>{t&&(t[zk]=null,t.release(),t.parent&&t.parent.removeChild(t))},Aw=["fillOpacity"],kw=(t,e,i)=>{var n;return"fillOpacity"===e?(t.fillOpacity=null!==(n=i.fillOpacity)&&void 0!==n?n:1,["fillOpacity"]):[]};const ww={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"}],[Ck.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"}],[Ck.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"}],[Ck.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 Tw=(t,e,i,n)=>{const s={},r=e?Object.keys(e):[],a=y(t)?ww[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||(Aw.includes(r)?kw(s,r,e):s[r]=e[r])}))}else r.forEach((t=>{Aw.includes(t)?kw(s,t,e):s[t]=e[t]}));return s},Cw=(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),Ew=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],Mw=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(Ew);function Bw(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)?Mw:Ew,r=[];let a=null;return t.forEach(((t,e)=>{a&&s.every((e=>Cw(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=Rw(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function Rw(t){const e={};return t?(Object.keys(t).forEach((i=>{"x"!==i&&"y"!==i&&"x1"!==i&&"y1"!==i&&"defined"!==i&&"size"!==i&&"width"!==i&&"height"!==i&&"context"!==i&&(e[i]=t[i])})),e):e}let Ow=class{constructor(t){this.data=null,this.states=[],this.diffState=Tk.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:{}})));mw(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?Tw(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[zk]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?Tw(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t)))}updateGraphicItem(){if(!this.graphicItem)return;this.diffState===Tk.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&&(Sw(this.graphicItem),this.graphicItem[zk]=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=dw(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=U(lw(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===Tk.unChange&&(this.diffState=Tk.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&(this.mark.isCollectionMark()&&delete t.defined,Object.assign(e,t)),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==Tk.enter&&this.diffState!==Tk.update||!this.states.length||this.useStates(this.states),this.mark.markType===Ck.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 as))}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[wk.update],a=e[wk.enter],o=e[wk.exit],l=this.mark.isLargeMode()||s&&!this.mark.getSpec().enableSegments;this.diffState===Tk.enter?(a&&mw(this,t,a,n,l),r&&mw(this,t,r,n,l)):this.diffState===Tk.update?((s&&a||i)&&mw(this,t,a,n,l),r&&mw(this,t,r,n,l)):this.diffState===Tk.exit&&o&&(i&&mw(this,t,a,n,l),mw(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=U(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=U(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)Nf(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[Ck.line,Ck.area,Ck.largeRects,Ck.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(n=l.nextAttrs)||void 0===n?void 0:n.points)&&(!0===i||fw(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[wk.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=Rw(h),e===Ck.line||e===Ck.area){const i=function(t,e,i,n){return t&&t.length&&(1!==t.length||e)?t.some((t=>fw(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===Ck.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=Bw(e.items,e.points,i);if(n)return void n.forEach((e=>{t.push(e)}))}const s=Rw(e.items[0]);s.points=e.points,t.push(s)})),t}return n?Bw(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=vw(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=Bw(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t)}else h.points=i,h.segments=null}else e===Ck.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===Ck.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}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&&(Sw(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 Iw{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(),U(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 Pw=(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 Lw extends Iw{constructor(t,e){super(t,e),this.type=Lw.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({},Lw.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=Pw(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=U(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()}}Lw.type="element-select",Lw.defaultOptions={state:Nk.selected,trigger:"click"};class Dw extends Iw{constructor(t,e){super(t,e),this.type=Dw.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},Dw.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=Pw(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()}}Dw.type="element-highlight",Dw.defaultOptions={highlightState:Nk.highlight,blurState:Nk.blur,trigger:"pointerover",triggerOff:"pointerout"};class Fw{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 jw=()=>{W(Lw,Fw),_w.registerInteraction(Lw.type,Lw)},Nw=()=>{W(Dw,Fw),_w.registerInteraction(Dw.type,Dw)},zw=(t,e)=>cw(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,Vw=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,n)=>{const s=t[n];return i[n]=zw(s,e),i}),{}):t.map((t=>zw(t,e))):t;let Hw=-1;class Gw extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++Hw}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=U(this.spec.dependency).map((t=>y(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=U(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 U(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 U(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(aw(this.spec[e],this.view)),this.spec[e]=t,this.attach(aw(t,this.view)),this.commit(),this}}const Ww=(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=aw(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}},Uw=(t,e)=>{const i=_w.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(rw(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(_(e)){const n=e.map((e=>Ww(t,e,i)));return{references:n.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:n.map((t=>t.value))}}return Ww(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}},Yw=(t,e)=>{if(null==t?void 0:t.length){const i=[];let n=[];return t.forEach((t=>{var s;const r=Uw(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},Kw={csv:li,dsv:oi,tsv:hi,json:function(t){if(!y(t))return U(t);try{return U(JSON.parse(t))}catch(t){return[]}}};class Xw extends Gw{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||!Kw[e.type])return U(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return Kw[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?aw(t.format,this.view)[0]:null;if(n&&e.push(n),t.values){const n=aw(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=aw(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=[];U(t.source).forEach((t=>{const i=cw(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=U(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=Yw(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=Yw(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(U(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=U(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 $w="window",Zw="view",qw={trap:!1},Jw="width",Qw="height",tT="viewWidth",eT="viewHeight",iT="padding",nT="viewBox",sT="autoFit";function rT(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 aT(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,rT(t,e,s,n)}class oT{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 rT(this.nodes,e,0,this.compare),aT(this.nodes,e,null,this.compare)}return this.nodes.push(t),rT(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)),rT(this.nodes,e,0,this.compare),aT(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,aT(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class lT{constructor(t){this.list=[],this.ids={},this.idFunc=t||jf}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 hT{constructor(){this.grammars=[],this.logger=it.getInstance(),this._curRank=0,this._committed=new lT((t=>t.uid)),this._heap=new oT(((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 lT((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 cT=(t,e,i,n,s)=>{const r=t=>{if(s||!t||n&&!n(t)||i.call(null,t),t.markType===Ck.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}s&&(!t||n&&!n(t)||i.call(null,t))};r(t)};class dT{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 Go(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Rs.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 Og(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 pm(o)),null===(r=this._eventConfig)||void 0===r?void 0:r.gesture){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new mm(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 uT(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 pT(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 gT(t,e,i,n,s){if(s===$w){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{pT(t,uT(t),!1)}))}));const e=uT(t);pT(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e}class fT extends Gw{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?lw(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}},_T=(t,e)=>e&&e.debounce?gt(t,e.debounce):e&&e.throttle?ft(t,e.throttle):t;class bT extends Ow{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 mw(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[zk]=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?Tw(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);this.graphicItem||this.initGraphicItem(),this.diffState===Tk.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==Tk.enter&&this.diffState!==Tk.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.diffState===Tk.enter&&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=Tw(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=ww[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===Ck.shape&&(o.datum=d[0].datum)})),n}}_generateGlyphItems(t,e,i){const n=e.map((t=>Object.assign({},t,{nextAttrs:i})));return Vk.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)Nf(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[zk]=null})),this.glyphGraphicItems=null),super.release()}}const xT=t=>t.markType===Ck.glyph?new bT(t):new Ow(t);function ST(t,e,i){const n=new Map;if(!t||0===t.length)return{keys:[],data:n};if(!e)return n.set(Gk,i?t.slice().sort(i):t.slice()),{keys:Uk,data:n};const s=dw(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 AT{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?ST(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 kT=(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=fw(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=fw(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 wT=(t,e,i,n,s)=>d(i)?i(t.getDatum(),t,s):i;class TT extends da{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 CT extends da{getEndProps(){return this.to}onBind(){var t;const e=null!==(t=this.target.constructor.NOWORK_ANIMATE_ATTR)&&void 0!==t?t:Ro,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)}}pa.mode|=bn.SET_ATTR_IMMEDIATELY;let ET=0;const MT=t=>!u(t)&&(t.prototype instanceof da||"onBind"in t.prototype&&"onStart"in t.prototype&&"onEnd"in t.prototype&&"onUpdate"in t.prototype);class BT{constructor(t,e,i){this.id=ET++,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||!_w.getAnimationType(e.type))return null;const r=_w.getAnimationType(e.type)(t,s,i);return kT(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?wT(t,0,s[i].from,0,n):void 0,e.to[i]=l?wT(t,0,s[i].to,0,n):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),kT(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=MT(o);return u(o)||MT(o)?h?new o(r.from,r.to,a,t.easing,l):r.to?new CT(r.from,r.to,a,t.easing):void 0:new TT(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 ja(a,e))}r>0&&t.wait(r)}}function RT(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(OT(i,t[i]))})),e}function OT(t,e){const i=[];let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return U(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:qk,totalTime:h.totalTime,oneByOne:null!==(i=h.oneByOne)&&void 0!==i?i:iw,loop:null!==(n=h.loop)&&void 0!==n?n:ew,controlOptions:j({},sw,null!==(s=h.controlOptions)&&void 0!==s?s:{}),timeSlices:[{duration:null!==(r=h.duration)&&void 0!==r?r:Jk,delay:null!==(a=h.delay)&&void 0!==a?a:Qk,delayAfter:null!==(o=h.delayAfter)&&void 0!==o?o:tw,effects:[{type:h.type,channel:h.channel,custom:h.custom,easing:null!==(l=h.easing)&&void 0!==l?l:nw,customParameters:h.customParameters,options:h.options}]}]}}const g=U(t.timeSlices).filter((t=>t.effects&&U(t.effects).filter((t=>t.channel||t.type)).length));if(g.length)return{startTime:null!==(h=t.startTime)&&void 0!==h?h:qk,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:iw,loop:null!==(d=t.loop)&&void 0!==d?d:ew,controlOptions:j({},sw,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:Qk,delayAfter:null!==(i=t.delayAfter)&&void 0!==i?i:tw,effects:U(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:nw,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 IT(t,e,i){return d(t)?t.call(null,e.getDatum(),e,i):t}class PT{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 LT{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=RT(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=RT(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!==Tk.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 PT(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=OT(Zk,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 PT(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=U(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=U(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=U(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===Tk.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 BT(n,i,e);if(l.animate(s,r),!l.isAnimating)return;n.diffState===Tk.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=lw(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,n,s){const r=[],a=IT(t.startTime,e,s),o=IT(t.totalTime,e,s),l=IT(t.oneByOne,e,s),h=IT(t.loop,e,s);let c=0;t.timeSlices.forEach((t=>{var i;const a=IT(t.delay,e,s),l=IT(t.delayAfter,e,s),h=null!==(i=IT(t.duration,e,s))&&void 0!==i?i:o/n,d=U(t.effects).map((t=>Object.assign({},t,{customParameters:IT(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===Tk.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===Tk.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===Zk,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===Tk.exit&&0===o[Tk.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 DT extends Gw{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new LT(this,{}),this.differ=new AT([]),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===Tk.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(e,i){var n;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===Dk.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:Wk,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===Ck.group)return;const e=ST(null!=t?t:Wk,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(Tk.update,t,e,i)}encodeState(t,e,i,n){if(t===Tk.enter&&(this._isReentered=!0),this.spec.encode[t]){const s=this.spec.encode[t];if(ow(s))this.detach(gw(s,this.view));else{const r=y(e);r&&n||!r&&i?(Object.keys(s).forEach((t=>{this.detach(gw(s[t],this.view))})),this.spec.encode[t]={}):r?this.detach(gw(s[e],this.view)):Object.keys(e).forEach((t=>{this.detach(gw(s[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),y(e)?(this.spec.encode[t][e]=i,this.attach(gw(i,this.view))):ow(e)?(this.spec.encode[t]=e,this.attach(gw(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(gw(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=Yw(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=Yw(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 Vk.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!==Tk.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===jk.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&&!ow(s)&&Object.keys(s).forEach((t=>{uw(s[t])&&(e[t]=hw(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];ow(n)||Object.keys(n).forEach((t=>{pw(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[zk];if((null==n?void 0:n.mark)===this){const i=gT(this.view,t,n,0,Zw);this.emitGrammarEvent(e,i,n)}},this.initEvent()),this.animate||(this.animate=new LT(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=hw(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!==Ck.group){if(!this.graphicItem){const t=xw(this,Ck.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||Hk.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||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==Ck.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=dw(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:()=>Gk),a=dw(null!==(s=this.spec.groupBy)&&void 0!==s?s:()=>Gk),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===Tk.enter))),c=[];this.differ.setCallback(((t,e,i)=>{const n=t;let s;if(u(e))s=this.elementMap.get(n),s&&(s.diffState=Tk.exit);else if(u(i)){s=this.elementMap.has(n)?this.elementMap.get(n):xT(this),s.diffState===Tk.exit&&(s.diffState=Tk.enter,this.animate.getElementAnimators(s,Tk.exit).forEach((t=>t.stop("start")))),s.diffState=Tk.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=Tk.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:Wk;l||this.differ.setCurrentData(ST(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]=vw(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[wk.group],n);e.forEach((t=>{this.markType===Ck.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._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:xw(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!==Ck.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=dw(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:()=>Gk),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=xT(this);e.diffState=Tk.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=xT(this);i.diffState=Tk.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!==Ck.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=xw(this,Ck.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!==Tk.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:ww[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=Tk.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&&Sw(this.graphicItem),this.detachAll(),super.release()}}let FT=class extends DT{constructor(t,e){super(t,Ck.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===Ck.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 ww.rect}evaluateJoin(t){if(!this.elements.length){const t=xT(this);t.updateData(Gk,Wk,(()=>""),this.view),this.elements=[t],this.elementMap.set(Gk,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 mw(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[wk.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:xw(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 jT(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 NT(t,e){return Math.min(t<0?t+e:t-1,e)}function zT(t,e,i){let n=NT(t,i),s=NT(e,i);if(A(t)||A(e)?A(t)?A(e)||(n=NT(Math.max(0,s-1),i)):s=NT(n+1,i):(n=1,s=2),n>s){const t=s;s=n,n=t}return{start:n,end:s}}const VT=(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=>jT(t,i))),u=l.map((t=>jT(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}=zT(e,i,r),{start:h,end:c}=zT(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()}))},HT={[Ek.axis]:0,[Ek.legend]:1,[Ek.slider]:2,[Ek.player]:3,[Ek.datazoom]:4},GT=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=HT[t.componentType])&&void 0!==n?n:1/0},WT=(t,e,i,n)=>{const s=i.clone(),r=t.getSpec().layout,a=zf(r.maxChildWidth,s.width()),o=zf(r.maxChildHeight,s.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=yT(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&&dGT(t)-GT(e)));for(let t=0,e=m.length;t{null==t||t.forEach((t=>{var n;if(t.markType!==Ck.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=WT(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(tT,o),i.updateSignal(eT,l),i.updateSignal(iT,h)}else WT(t,s,a,e);else"grid"===r.display&&VT(t,s,a);UT(s,e,i)}}))};class YT extends DT{constructor(t,e,i){super(t,Ck.glyph,i),this.glyphType=e,this.glyphMeta=_w.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(!_w.getGraphicType(Ck.glyph))return;const n=_w.createGraphic(Ck.glyph,i),s=e.getMarks(),r=Object.keys(s).map((t=>{if(_w.getGraphicType(s[t])){const e=_w.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 KT=Symbol.for("key");class XT{diffGrammar(t,e){return function(t,e,i){const n={enter:[],exit:[],update:[]},s=new AT(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(ST(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!==Ck.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?s.push(t):n.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==Ck.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=ST(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=ST(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=dw(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 AT(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(ST(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:KT})),r=ST(e,(t=>{var e;return null!==(e=n(t))&&void 0!==e?e:KT}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==KT){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=lw(i.animation.delay,s,o,l),d=lw(i.animation.duration,s,o,l),u=lw(i.animation.oneByOne,s,o,l),p=lw(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)?bo:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:xo)(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);mo(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)?bo:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:xo)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>uo(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>go(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 fo({morphingData:h[n],saveOnEnd:!0,otherAttrs:c[n]},null!==(o=i.duration)&&void 0!==o?o:ya,null!==(l=i.easing)&&void 0!==l?l:_a))}))}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 vo({morphingData:h,otherAttrs:c},null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:ya,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:_a))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):mo(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 $T{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 ZT extends $T{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===Ck.group&&n.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===Ck.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=>{const n=t.mark;n.markType===Ck.group&&n.includesChild(e,!1)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===Ck.group&&e.includesChild(n,!1)&&(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 qT{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 JT extends DT{addGraphicItem(t,e){const i=t&&t.limitAttrs,n=xw(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?Ck.richtext:Ck.text,t);return super.addGraphicItem(t,e,n)}release(){super.release()}}JT.markType=Ck.text;const QT={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)"}}},tC={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},eC=Object.assign({},QT);eC.axis=Object.assign({},eC.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),eC.circleAxis=Object.assign({},eC.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),eC.grid=Object.assign({},eC.grid,{style:{stroke:"#404349"}}),eC.circleGrid=Object.assign({},eC.circleGrid,{style:{stroke:"#404349"}}),eC.rectLabel=Object.assign({},eC.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),eC.lineLabel=Object.assign({},eC.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),eC.symbolLabel=Object.assign({},eC.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),eC.title=Object.assign({},eC.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const iC={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:tC,components:eC},nC={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:tC,components:QT};let sC=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")}};sC._themes=new Map,sC.registerTheme("default",nC),sC.registerTheme("dark",iC);class rC extends DT{constructor(t,e,i,n){super(t,Ck.component,i),this._componentDatum={[Gk]: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:_w.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,Gk)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[Gk]+=1}evaluateJoin(t){return this.spec.key=Gk,t?(t[Gk]=this._componentDatum[Gk],this._componentDatum=t):this._componentDatum={[Gk]:this._componentDatum[Gk]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}class aC 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[zk],s=gT(0,t,n,0,Zw);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=U(t),i=[];return e.forEach((t=>{if(cw(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)):bw(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 fT(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 Xw(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=_w.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=_w.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 Ck.group:s=new FT(this,n);break;case Ck.glyph:s=new YT(this,null==i?void 0:i.glyphType,n);break;case Ck.component:s=_w.hasComponent(null==i?void 0:i.componentType)?_w.createComponent(null==i?void 0:i.componentType,this,n,null==i?void 0:i.mode):new rC(this,null==i?void 0:i.componentType,n,null==i?void 0:i.mode);break;case Ck.text:s=new JT(this,t,n);break;default:s=_w.hasMark(t)?_w.createMark(t,this,n):new DT(this,t,n)}return this.grammars.record(s),this._dataflow.add(s),s}group(t){return this.mark(Ck.group,t)}glyph(t,e){return this.mark(Ck.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(Ck.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(Ck.component,t,{componentType:Ek.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(Ck.component,t,{componentType:Ek.grid,mode:e})}legend(t){return this.mark(Ck.component,t,{componentType:Ek.legend})}slider(t){return this.mark(Ck.component,t,{componentType:Ek.slider})}label(t){return this.mark(Ck.component,t,{componentType:Ek.label})}datazoom(t){return this.mark(Ck.component,t,{componentType:Ek.datazoom})}player(t){return this.mark(Ck.component,t,{componentType:Ek.player})}title(t){return this.mark(Ck.component,t,{componentType:Ek.title})}scrollbar(t){return this.mark(Ck.component,t,{componentType:Ek.scrollbar})}customized(t,e){const i=_w.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&&vT.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&(Sw(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_"+ ++mT;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(sC.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(Jw,t.width),this.updateSignal(Qw,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=_w.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=Dk.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var n,s,r,a,o;return[{id:Jw,value:null!==(n=t[Jw])&&void 0!==n?n:0},{id:Qw,value:null!==(s=t[Qw])&&void 0!==s?s:0},{id:iT,value:yT(null!==(a=null!==(r=t[iT])&&void 0!==r?r:e[iT])&&void 0!==a?a:null==i?void 0:i.padding)},{id:tT,update:{callback:(t,e)=>{const i=yT(e[iT]);return e[Jw]-i.left-i.right},dependency:[Jw,iT]}},{id:eT,update:{callback:(t,e)=>{const i=yT(e[iT]);return e[Qw]-i.top-i.bottom},dependency:[Qw,iT]}},{id:nT,update:{callback:(t,e)=>{const i=yT(e[iT]);return(t||new Vt).setValue(i.left,i.top,i.left+e[tT],i.top+e[eT])},dependency:[tT,eT,iT]}},{id:sT,value:null!==(o=t[sT])&&void 0!==o?o:e[sT]}]})(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===Ck.glyph?{glyphType:t.glyphType}:t.type===Ck.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=sC.getTheme(t))&&void 0!==e?e:sC.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(Jw);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(Qw);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(tT);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(eT);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(iT);if(arguments.length){const i=yT(t);return this.updateSignal(e,i),i}return yT(e.output())}autoFit(t){const e=this.getSignalById(sT);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(nT);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=Dk.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===Ck.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var e;const i=this._options.doLayout||UT;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=>{cT(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),cT(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=Yk,morph:o=Kk,morphAll:l=Xk,animation:h={},enableExitAnimation:c=$k}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:nw,delay:null!==(i=h.delay)&&void 0!==i?i:Qk,duration:null!==(n=h.duration)&&void 0!==n?n:Jk,oneByOne:null!==(s=h.oneByOne)&&void 0!==s?s:iw,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=Dk.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=Dk.reevaluate,this._dataflow.evaluate()),this._layoutState=Dk.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=>!vT.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 cT(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(Jw,t)),e!==this.height()&&(n=!0,this.updateSignal(Qw,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]:Zw;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):bw(t)?(i.markType=t,i.source=e):i.source=t===$w?$w: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=rw(l,this),v=_T(((t,e)=>{const n=c===Zw&&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===$w&&(t=gT(0,t,e,0,$w));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===Zw){if(function(t,e,i){const n=null==t?void 0:t[e];return!(!1===n||g(n)&&!n[i])}(this._eventConfig,Zw,d))return this.addEventListener(d,v,qw),()=>{this.removeEventListener(d,v)}}else if(c===$w)return cg.addEventListener(d,v),this._eventListeners.push({type:d,source:cg,handler:v}),()=>{cg.removeEventListener(d,v);const t=this._eventListeners.findIndex((t=>t.type===d&&t.source===cg&&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=_w.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 dT(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e;this.grammars=new $T((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new ZT((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 hT,this.animate=new qT(this),this._morph=new XT,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,[Zw,$w]),e}(this._options.eventConfig),this._theme=this._options.disableTheme?null:sC.getDefaultTheme(),this.parseBuiltIn(),(e=this._options).mode&&cg.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=Dk.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!==Ck.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=cg.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&cg.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(),_w.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 oC extends rC{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 lC=(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 hC extends oC{constructor(t,e,i){super(t,Ek.axis,e),this.spec.componentType=Ek.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=_w.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=vw(s,e,i,n);const h=lw(this.spec.inside,n,e,i),c=lw(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(lC(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=lw(this.spec.tickCount,n,e,i);switch(this._getAxisComponentType()){case Bk.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 Bk.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?Bk.circleAxis:Bk.lineAxis,this._axisComponentType}}hC.componentType=Ek.axis;let cC=class extends rC{constructor(t,e){super(t,Ek.label,e),this.spec.componentType=Ek.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=U(this.spec.target).map((t=>y(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=U(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=U(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=lw(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=lw(n,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case Ck.line:case Ck.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case Ck.rect:case Ck.rect3d:case Ck.interval:g=p.rectLabel;break;case Ck.symbol:case Ck.circle:case Ck.cell:g=p.symbolLabel;break;case Ck.arc:case Ck.arc3d:g=p.arcLabel;break;case Ck.polygon:case Ck.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=vw(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=vw(i,t,e,d);f.push(j({},m,n))}));else{const t=vw(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}};cC.componentType=Ek.label;class dC extends oC{constructor(t,e,i){super(t,Ek.grid,e),this.spec.componentType=Ek.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=_w.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=vw(n,t,e,i);const d=lw(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 Rk.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 Rk.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=lw(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(lC(h,s,n,d,this.spec.layout,!0),c))}this._getGridComponentType()===Rk.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=lw(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case Rk.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 Rk.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=Rk.circleAxisGrid:this._gridComponentType=Rk.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case Bk.circleAxis:this._gridComponentType=Rk.circleAxisGrid;break;case Bk.lineAxis:default:this._gridComponentType=Rk.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()?Rk.lineAxisGrid:Rk.circleAxisGrid:Rk.lineAxisGrid}else this._gridComponentType=Rk.lineAxisGrid;return this._gridComponentType}}dC.componentType=Ek.grid;const uC=(t,e,i)=>e.filter((e=>t.callback(e,i))),pC=(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 gC(t){return t.reduce(((t,e)=>t+e),0)}const fC={min:X,max:K,average:function(t){return 0===t.length?0:gC(t)/t.length},sum:gC};function mC(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 vC(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 yC(t,e,i,n){return vC(t,e,i,"min",n)}function _C(t,e,i,n){return vC(t,e,i,"max",n)}function bC(t,e,i,n){return vC(t,e,i,"average",n)}function xC(t,e,i,n){return vC(t,e,i,"sum",n)}const SC=(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=mC;if("min"===s?l=yC:"max"===s?l=_C:"average"===s?l=bC:"sum"===s&&(l=xC),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[]},AC="_mo_hide_";const kC=(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(AC)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(AC,!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(AC,!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},wC=()=>{_w.registerTransform("filter",{transform:uC,markPhase:"beforeJoin"},!0)},TC=()=>{_w.registerTransform("map",{transform:pC,markPhase:"beforeJoin"},!0)},CC=()=>{_w.registerTransform("sampling",{transform:SC,markPhase:"afterEncode"},!0)},EC=()=>{_w.registerTransform("markoverlap",{transform:kC,markPhase:"afterEncode"},!0)},MC=(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}}},BC=(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}}},RC=(t,e,i)=>{var n,s,r,a;const o=null!==(n=t.getFinalGraphicAttributes())&&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}}},OC=(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}}},IC=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),n=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("y",!1),i=t.getGraphicAttribute("y1",!1),n=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),n=t.getGraphicAttribute("width",!1),s=t.getGraphicAttribute("y",!1),r=t.getGraphicAttribute("y1",!1),a=t.getGraphicAttribute("height",!1),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}}}}},PC=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),n=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("y",!1),i=t.getGraphicAttribute("y1",!1),n=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("y",!1),n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicAttribute("height",!1),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 LC=(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.getGraphicAttribute("x",!1),r=t.getGraphicAttribute("x1",!1),a=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);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 DC=(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.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);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 FC=(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.getGraphicAttribute("y",!1),r=t.getGraphicAttribute("y1",!1),a=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);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 jC=(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.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);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)},NC=(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.getFinalGraphicAttributes();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.getFinalGraphicAttributes();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)},zC=(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.getFinalGraphicAttributes();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)},VC=(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.getFinalGraphicAttributes(),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.getFinalGraphicAttributes();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)},HC=(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.getFinalGraphicAttributes();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)},GC=(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((()=>Object.assign(s)))},WC=(t,e,i)=>({from:{points:GC(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),UC=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:GC(t,e)}}),YC=(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),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}})),KC=(t,e,i)=>({from:{points:YC(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),XC=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:YC(t,e,i)}}),$C=(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),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined}})),ZC=(t,e,i)=>({from:{points:$C(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),qC=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:$C(t,e,i)}}),JC=(t,e,i)=>{var n,s;const{offset:r=0,orient:a,direction:o,point:l}=null!=e?e:{};let h=0,c=0;"negative"===a&&(i.group?(h=null!==(n=i.groupWidth)&&void 0!==n?n:i.group.getBounds().width(),c=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupWidth=h,i.groupHeight=c):(h=i.width,c=i.height)),h+=r,c+=r;const u=d(l)?l.call(null,t.getDatum(),t,i):l,p=u&&A(u.x)?u.x:h,g=u&&A(u.y)?u.y:c,f=t.getFinalGraphicAttributes();switch(o){case"x":return{from:{x:p},to:{x:null==f?void 0:f.x}};case"y":return{from:{y:g},to:{y:null==f?void 0:f.y}};default:return{from:{x:p,y:g},to:{x:null==f?void 0:f.x,y:null==f?void 0:f.y}}}},QC=(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}}}},tE=(t,e,i)=>{var n,s,r,a;const o=t.getFinalGraphicAttributes();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}}}},eE=(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}}}},iE={symbol:["_mo_hide_","visible"]},nE=(t,e,i)=>{const n=Object.assign({},t.getPrevGraphicAttributes()),s=Object.assign({},t.getNextGraphicAttributes());let r;e&&U(e.excludeChannels).forEach((t=>{delete n[t],delete s[t]})),t.mark&&t.mark.markType&&(r=iE[t.mark.markType])&&r.forEach((t=>{delete n[t],delete s[t]})),Object.keys(s).forEach((t=>{Nf(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}},sE=(t,e,i)=>{var n,s;const r=null!==(s=null===(n=t.getFinalGraphicAttributes())||void 0===n?void 0:n.angle)&&void 0!==s?s:0;let a=0;return a=at(r/(2*Math.PI),0)?Math.round(r/(2*Math.PI))*Math.PI*2:A(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(r/(2*Math.PI))*Math.PI*2:Math.floor(r/(2*Math.PI))*Math.PI*2,{from:{angle:a},to:{angle:r}}},rE=(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}}},aE=()=>{_w.registerAnimationType("clipIn",MC)},oE=()=>{_w.registerAnimationType("clipOut",BC)},lE=()=>{_w.registerAnimationType("fadeIn",RC)},hE=()=>{_w.registerAnimationType("fadeOut",OC)},cE=()=>{_w.registerAnimationType("growCenterIn",IC)},dE=()=>{_w.registerAnimationType("growCenterOut",PC)},uE=()=>{_w.registerAnimationType("growHeightIn",FC)},pE=()=>{_w.registerAnimationType("growHeightOut",jC)},gE=()=>{_w.registerAnimationType("growWidthIn",LC)},fE=()=>{_w.registerAnimationType("growWidthOut",DC)},mE=()=>{_w.registerAnimationType("growPointsIn",WC)},vE=()=>{_w.registerAnimationType("growPointsOut",UC)},yE=()=>{_w.registerAnimationType("growPointsXIn",KC)},_E=()=>{_w.registerAnimationType("growPointsXOut",XC)},bE=()=>{_w.registerAnimationType("growPointsYIn",ZC)},xE=()=>{_w.registerAnimationType("growPointsYOut",qC)},SE=()=>{_w.registerAnimationType("growAngleIn",NC)},AE=()=>{_w.registerAnimationType("growAngleOut",zC)},kE=()=>{_w.registerAnimationType("growRadiusIn",VC)},wE=()=>{_w.registerAnimationType("growRadiusOut",HC)},TE=()=>{_w.registerAnimationType("moveIn",JC)},CE=()=>{_w.registerAnimationType("moveOut",QC)},EE=()=>{_w.registerAnimationType("scaleIn",tE)},ME=()=>{_w.registerAnimationType("scaleOut",eE)},BE=()=>{_w.registerAnimationType("rotateIn",sE)},RE=()=>{_w.registerAnimationType("rotateOut",rE)},OE=()=>{_w.registerAnimationType("update",nE)},IE=["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 PE,LE,DE;t.ChartEvent=void 0,(PE=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",PE.rendered="rendered",PE.renderFinished="renderFinished",PE.animationFinished="animationFinished",PE.regionSeriesDataFilterOver="regionSeriesDataFilterOver",PE.afterInitData="afterInitData",PE.afterInitEvent="afterInitEvent",PE.afterInitMark="afterInitMark",PE.rawDataUpdate="rawDataUpdate",PE.viewDataFilterOver="viewDataFilterOver",PE.viewDataUpdate="viewDataUpdate",PE.viewDataStatisticsUpdate="viewDataStatisticsUpdate",PE.markDeltaYUpdate="markDeltaYUpdate",PE.viewDataLabelUpdate="viewDataLabelUpdate",PE.scaleDomainUpdate="scaleDomainUpdate",PE.scaleUpdate="scaleUpdate",PE.dataZoomChange="dataZoomChange",PE.drill="drill",PE.layoutStart="layoutStart",PE.layoutEnd="layoutEnd",PE.layoutRectUpdate="layoutRectUpdate",PE.playerPlay="playerPlay",PE.playerPause="playerPause",PE.playerEnd="playerEnd",PE.playerChange="playerChange",PE.playerForward="playerForward",PE.playerBackward="playerBackward",PE.scrollBarChange="scrollBarChange",PE.brushStart="brushStart",PE.brushChange="brushChange",PE.brushEnd="brushEnd",PE.brushClear="brushClear",PE.legendSelectedDataChange="legendSelectedDataChange",PE.legendFilter="legendFilter",PE.legendItemClick="legendItemClick",PE.legendItemHover="legendItemHover",PE.legendItemUnHover="legendItemUnHover",PE.tooltipShow="tooltipShow",PE.tooltipHide="tooltipHide",PE.tooltipRelease="tooltipRelease",PE.afterResize="afterResize",PE.afterRender="afterRender",PE.afterLayout="afterLayout",t.Event_Source_Type=void 0,(LE=t.Event_Source_Type||(t.Event_Source_Type={})).chart="chart",LE.window="window",LE.canvas="canvas",t.Event_Bubble_Level=void 0,(DE=t.Event_Bubble_Level||(t.Event_Bubble_Level={})).vchart="vchart",DE.chart="chart",DE.model="model",DE.mark="mark";const FE=`${ak}_waterfall_default_seriesField`,jE=`${ak}_CORRELATION_X`,NE=`${ak}_CORRELATION_Y`,zE=`${ak}_CORRELATION_SIZE`,VE=`${ak}_MEASURE_CANVAS_ID`,HE=`${ak}_DEFAULT_DATA_INDEX`,GE=`${ak}_DEFAULT_DATA_KEY`,WE=`${ak}_DEFAULT_DATA_SERIES_FIELD`,UE=`${ak}_DEFAULT_SERIES_STYLE_NAME`;var YE;t.AttributeLevel=void 0,(YE=t.AttributeLevel||(t.AttributeLevel={}))[YE.Default=0]="Default",YE[YE.Theme=1]="Theme",YE[YE.Chart=2]="Chart",YE[YE.Base_Series=3]="Base_Series",YE[YE.Series=4]="Series",YE[YE.Mark=5]="Mark",YE[YE.User_Chart=6]="User_Chart",YE[YE.User_Series=7]="User_Series",YE[YE.User_Mark=8]="User_Mark",YE[YE.Built_In=99]="Built_In";const KE=`${ak}_STACK_KEY`,XE=`${ak}_STACK_START`,$E=`${ak}_STACK_END`,ZE=`${ak}_STACK_START_PERCENT`,qE=`${ak}_STACK_END_PERCENT`,JE=`${ak}_STACK_START_OffsetSilhouette`,QE=`${ak}_STACK_END_OffsetSilhouette`,tM=`${ak}_STACK_TOTAL`,eM=`${ak}_STACK_TOTAL_PERCENT`,iM=`${ak}_STACK_TOTAL_TOP`,nM=`${ak}_SEGMENT_START`,sM=`${ak}_SEGMENT_END`;var rM,aM;t.LayoutZIndex=void 0,(rM=t.LayoutZIndex||(t.LayoutZIndex={}))[rM.Axis_Grid=50]="Axis_Grid",rM[rM.CrossHair_Grid=100]="CrossHair_Grid",rM[rM.Region=450]="Region",rM[rM.Mark=300]="Mark",rM[rM.Node=400]="Node",rM[rM.Axis=100]="Axis",rM[rM.MarkLine=500]="MarkLine",rM[rM.MarkArea=100]="MarkArea",rM[rM.MarkPoint=500]="MarkPoint",rM[rM.DataZoom=500]="DataZoom",rM[rM.ScrollBar=500]="ScrollBar",rM[rM.Player=500]="Player",rM[rM.Legend=500]="Legend",rM[rM.CrossHair=500]="CrossHair",rM[rM.Indicator=500]="Indicator",rM[rM.Title=500]="Title",rM[rM.Label=500]="Label",rM[rM.Brush=500]="Brush",rM[rM.CustomMark=500]="CustomMark",rM[rM.Interaction=700]="Interaction",t.LayoutLevel=void 0,(aM=t.LayoutLevel||(t.LayoutLevel={}))[aM.Indicator=10]="Indicator",aM[aM.Region=20]="Region",aM[aM.Axis=30]="Axis",aM[aM.DataZoom=40]="DataZoom",aM[aM.Player=40]="Player",aM[aM.ScrollBar=40]="ScrollBar",aM[aM.Legend=50]="Legend",aM[aM.Title=70]="Title",aM[aM.CustomMark=70]="CustomMark";const oM=["linear","radial","conical"],lM={x0:0,y0:0,x1:1,y1:1},hM={x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},cM={x:.5,y:.5,startAngle:0,endAngle:2*Math.PI},dM={linear:lM,radial:hM,conical:cM},uM={label:{name:"label",type:"text"}},pM=`${ak}_rect_x`,gM=`${ak}_rect_x1`,fM=`${ak}_rect_y`,mM=`${ak}_rect_y1`,vM=Object.assign(Object.assign({},uM),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),yM=Object.assign(Object.assign({},uM),{bar3d:{name:"bar3d",type:"rect3d"}}),_M={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},bM=Object.assign(Object.assign({},uM),_M),xM=Object.assign(Object.assign({},uM),{point:{name:"point",type:"symbol"}}),SM=Object.assign(Object.assign(Object.assign({},uM),_M),{area:{name:"area",type:"area"}}),AM=Object.assign(Object.assign(Object.assign({},uM),_M),{area:{name:"area",type:"area"}}),kM=Object.assign(Object.assign({},uM),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),wM=Object.assign(Object.assign({},uM),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}}),TM=Object.assign(Object.assign({},uM),{rose:{name:"rose",type:"arc"}}),CM=Object.assign(Object.assign({},uM),{area:{name:"area",type:"path"}}),EM=Object.assign(Object.assign({},uM),{group:{name:"group",type:"group"}}),MM=Object.assign(Object.assign({},EM),{track:{name:"track",type:"arc"},progress:{name:"progress",type:"arc"}}),BM=Object.assign(Object.assign({},uM),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),RM=Object.assign(Object.assign({},uM),{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"}}),OM=Object.assign(Object.assign({},uM),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"}}),IM=Object.assign(Object.assign({},uM),{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"}}),PM=Object.assign(Object.assign({},uM),{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"}}),LM=Object.assign(Object.assign({},uM),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),DM=Object.assign(Object.assign({},vM),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),FM=Object.assign(Object.assign({},uM),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),jM=Object.assign(Object.assign({},uM),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),NM=Object.assign(Object.assign({},uM),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}}),zM=Object.assign(Object.assign({},EM),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),VM=Object.assign(Object.assign({},uM),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),HM=Object.assign(Object.assign({},uM),{sunburst:{name:"sunburst",type:"arc"}}),GM=Object.assign(Object.assign({},vM),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),WM=Object.assign(Object.assign({},yM),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),UM=Object.assign(Object.assign({},uM),{circlePacking:{name:"circlePacking",type:"arc"}}),YM=Object.assign(Object.assign({},uM),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}}),KM=Object.assign(Object.assign({},uM),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),XM=Object.assign({},SM),$M=Object.assign(Object.assign({},uM),{liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"symbol"}}),ZM=Object.assign(Object.assign({},uM),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});var qM;!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"}(qM||(qM={}));const JM={[sk.bar]:vM,[sk.bar3d]:yM,[sk.line]:bM,[sk.scatter]:xM,[sk.area]:SM,[sk.radar]:AM,[sk.pie]:kM,[sk.pie3d]:wM,[sk.rose]:TM,[sk.geo]:uM,[sk.map]:CM,[sk.circularProgress]:MM,[sk.link]:BM,[sk.dot]:RM,[sk.wordCloud]:OM,[sk.wordCloud3d]:OM,[sk.funnel]:IM,[sk.funnel3d]:PM,[sk.linearProgress]:LM,[sk.waterfall]:DM,[sk.boxPlot]:FM,[sk.treemap]:jM,[sk.sankey]:NM,[sk.gauge]:zM,[sk.gaugePointer]:VM,[sk.sunburst]:HM,[sk.rangeColumn]:GM,[sk.rangeColumn3d]:WM,[sk.circlePacking]:UM,[sk.heatmap]:YM,[sk.correlation]:KM,[sk.rangeArea]:XM,[sk.liquid]:$M,[sk.venn]:ZM};function QM(t){var e,i;const{type:n}=t;return n===sk.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}const tB={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},eB={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function iB(t,e){var i;if(!t)return[];const n=hB(t,e);if(!n||_(n))return null!==(i=n)&&void 0!==i?i:[];if(g(n)){const{dataScheme:i}=n;return i?oB(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>aB(i)?sB(t,i,e):i)).filter(p)}))):i.map((i=>aB(i)?sB(t,i,e):i)).filter(p):[]}return[]}function nB(t,e){var i,n;return oB(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 sB(t,e,i){var n;const s=hB(t,i);if(!s)return;let r;const{palette:a}=s;if(g(a)&&(r=null!==(n=function(t,e){const i=tB[e];if(i&&t[i])return t[i];if(t[e])return t[e];const n=eB[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 rB=(t,e,i)=>{if(e&&aB(t)){const n=sB(e,t,i);if(n)return n}return t};function aB(t){return t&&"palette"===t.type&&!!t.key}function oB(t){return!(!_(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function lB(t){return _(t)?{dataScheme:t}:t}function hB(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=QM(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 cB extends NS{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(!oB(this._range))return void super.range(this._range);const t=nB(this._range,this._domain);super.range(t)}}const dB={linear:lA,band:VS,point:class extends VS{constructor(t){super(!1),this.type=uS.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:NS,threshold:pA,colorOrdinal:cB};function uB(t){const e=dB[t];return e?new e:null}function pB(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 gB(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function fB(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function mB(t){return!!y(t)&&(!!t.endsWith("%")&&Rf(t.substring(0,t.length-1)))}function vB(t,e,i,n=0){var s,r;return S(t)?t:mB(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 yB(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]=vB(t[n],e.size,i)}))})),o}function _B(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)||mB(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 bB(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const xB=(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},SB=[{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"]}],AB={default:{dataScheme:SB,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)"}}},kB="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",wB={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:kB,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:kB,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"}}}}},TB={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}}},CB=Object.assign(Object.assign({},TB),{label:{space:0}}),EB={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}}}}},MB="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;",BB={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:MB,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:MB,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}}}},RB={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}},OB={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}},IB={horizontal:Object.assign(Object.assign({},RB),{rail:{width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:OB}),vertical:Object.assign(Object.assign({},RB),{rail:{width:8,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:OB})},PB={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}},LB={horizontal:Object.assign(Object.assign({},RB),{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:PB}),vertical:Object.assign(Object.assign({},RB),{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:PB})},DB={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"}}}}},FB={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"}}}}},jB={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 NB(t,e){return t&&e.key in t?t[e.key]:e.default}function zB(t){return t&&"token"===t.type&&!!t.key}const VB={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%"},HB={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:AB,token:VB,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:wB,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:IB,sizeLegend:LB,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:TB,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:CB,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:FB,markArea:DB,markPoint:jB,polarMarkLine:FB,polarMarkArea:DB,polarMarkPoint:jB,geoMarkPoint:jB,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:BB,crosshair:EB,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},GB={name:"dark",colorScheme:{default:{dataScheme:SB,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}}}}}},WB=(t,e)=>t===e||!d(t)&&!d(e)&&(_(t)&&_(e)?e.every((e=>t.some((t=>WB(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>WB(t[i],e[i])))),UB=(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]={}),UB(t[n],e.slice(1),i))};function YB(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]=YB(s,e)}return n}function KB(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])?XB(t,e,r,i):$B(t,r,n[r])}}}}function XB(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?ZB({},t[s][e.index],i):i):t[s]=n?ZB({},t[s],i):i);else if(_(t[s])){const r=t[s].findIndex((t=>t.id===e));r>=0&&(t[s][r]=n?ZB({},t[s][r],i):i)}else t.id===e&&(t[s]=n?ZB({},t[s],i):i)}))}function JB(t,...e){return ZB(QB(t),...e.map(QB))}function QB(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]=lB(n),e}),{}));return t}(t.colorScheme),{series:n}=t,{mark:s,markByName:r}=t;let a;return(s||r)&&(a=Object.keys(JM).reduce(((t,e)=>{var i;const a=null!==(i=null==n?void 0:n[e])&&void 0!==i?i:{};return t[e]=tR(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 tR(t,e,i,n){if(!JM[e])return t;const s={};return Object.values(JM[e]).forEach((({type:e,name:r})=>{s[r]=ZB({},null==i?void 0:i[U(e)[0]],null==n?void 0:n[r],null==t?void 0:t[r])})),Object.assign(Object.assign({},t),s)}const eR=["animationThreshold","colorScheme","name","padding"];function iR(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];eR.includes(r)?s[r]=a:m(a)?aB(a)?s[r]=rB(a,e,n):zB(a)?s[r]=NB(i,a):s[r]=iR(a,e,i,n):s[r]=a})),s}const nR={[HB.name]:HB},sR=HB.name,rR=new Map(Object.keys(nR).map((t=>[t,nR[t]]))),aR=new Map(Object.keys(nR).map((t=>[t,iR(nR[t])]))),oR=new Map(Object.keys(nR).map((t=>[t,t===sR]))),lR=(t,e)=>{if(!t)return;const i=uR(e);rR.set(t,i),aR.set(t,iR(i)),oR.set(t,!0)},hR=(t=sR,e=!1)=>(oR.has(t)&&!oR.get(t)&&lR(t,rR.get(t)),e?aR.get(t):rR.get(t)),cR=t=>rR.delete(t)&&aR.delete(t)&&oR.delete(t),dR=t=>!!y(t)&&rR.has(t),uR=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:sR;return JB({},hR(i),t)};class pR{static registerInstance(t){pR.instances.set(t.id,t)}static unregisterInstance(t){pR.instances.delete(t.id)}static getInstance(t){return pR.instances.get(t)}static instanceExist(t){return pR.instances.has(t)}static forEach(t,e=[],i){const n=U(e);return pR.instances.forEach(((e,i,s)=>{n.includes(i)||t(e,i,s)}),i)}}pR.instances=new Map;class gR{static registerTheme(t,e){lR(t,e)}static getTheme(t,e=!1){return hR(t,e)}static removeTheme(t){return cR(t)}static themeExist(t){return dR(t)}static getDefaultTheme(){return gR.themes.get(sR)}static setCurrentTheme(t){gR.themeExist(t)&&(gR._currentThemeName=t,pR.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return gR.getTheme(gR._currentThemeName,t)}static getCurrentThemeName(){return gR._currentThemeName}}function fR(t,e){return y(t)?gR.themeExist(t)?gR.getTheme(t,e):{}:g(t)?t:{}}function mR(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]=mR(t[n],e)}return i}return _(t)?t.map((t=>mR(t,e))):t}function vR(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]=vR(t[n],e)}return i}return _(t)?t.map((t=>vR(t,e))):t}gR.themes=rR,gR._currentThemeName=sR;function yR(t,e){for(let i=0;it.key===e))}function bR(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 xR(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:{}},TR(t,a,s[o],l,e,r))})),n?SR(s):s}function SR(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))):SR(t[e].nodes);return t}function AR(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,qE);t.values.forEach((t=>{t[tM]=i,t[eM]=n,delete t[iM]}));const s=t.values.reduce(((t,e)=>e[$E]>t[$E]?e:t));s[iM]=!0}else for(const i in t.nodes)AR(t.nodes[i],e)}function kR(t){if(!t.values.length)return;const e=t.values[t.values.length-1][$E]/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[XE]=n,n+=r[$E],r[$E]=n):(r[XE]=s,s+=r[$E],r[$E]=s),r[KE]=t.key}if(i)for(let i=0;i=0?n:s;r=a>=0?1:-1,l[ZE]=0===h?0:Math.min(1,l[XE]/h)*r,l[qE]=0===h?0:Math.min(1,l[$E]/h)*r}}for(const n in t.nodes)wR(t.nodes[n],e,i)}function TR(t,e,i,n,s,r,a){if("values"in e)if(s&&e.values.forEach((t=>t[$E]=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}),TR(t,e.nodes[o],i.nodes[o],n,s,r,l)}}function CR(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,n,s)=>MR(t.style(e,i,n,s)):B(t.style)||(e.style=MR(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,n,s,r)=>MR(t.state[e](i,n,s,r)):B(t.state[e])||(i[e]=MR(t.state[e]))})),e.state=i}return e}function ER(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,n,s,r)=>MR(t[i](e,n,s,r)):B(t[i])||(e[i]=MR(t[i]))})),e}function MR(t){return(null==t?void 0:t.angle)&&(t.angle=Gt(t.angle)),t}class BR{static registerChart(t,e){BR._charts[t]=e}static registerSeries(t,e){BR._series[t]=e}static registerComponent(t,e,i){BR._components[t]={cmp:e,alwaysCheck:i}}static registerMark(t,e){BR._marks[t]=e}static registerRegion(t,e){BR._regions[t]=e}static registerTransform(t,e){BR.transforms[t]=e}static registerLayout(t,e){BR._layout[t]=e}static registerAnimation(t,e){BR._animations[t]=e}static registerImplement(t,e){BR._implements[t]=e}static registerChartPlugin(t,e){BR._chartPlugin[t]=e}static registerComponentPlugin(t,e){BR._componentPlugin[t]=e}static createChart(t,e,i){if(!BR._charts[t])return null;return new(0,BR._charts[t])(e,i)}static createChartSpecTransformer(t,e){if(!BR._charts[t])return null;const i=BR._charts[t];return new(0,i.transformerConstructor)(Object.assign({seriesType:i.seriesType},e))}static createRegion(t,e,i){if(!BR._regions[t])return null;return new(0,BR._regions[t])(e,i)}static createRegionSpecTransformer(t,e){if(!BR._regions[t])return null;return new(0,BR._regions[t].transformerConstructor)(e)}static createSeries(t,e,i){if(!BR._series[t])return null;return new(0,BR._series[t])(e,i)}static createSeriesSpecTransformer(t,e){if(!BR._series[t])return null;return new(0,BR._series[t].transformerConstructor)(e)}static createMark(t,e,i){if(!BR._marks[t])return null;const n=new(0,BR._marks[t])(e,i);return"group"===n.type&&n.setInteractive(!1),n}static getComponents(){return Object.values(BR._components)}static getComponentInKey(t){return BR._components[t].cmp}static getLayout(){return Object.values(BR._layout)}static getLayoutInKey(t){return BR._layout[t]}static getSeries(){return Object.values(BR._series)}static getSeriesInType(t){return BR._series[t]}static getRegionInType(t){return BR._regions[t]}static getAnimationInKey(t){return BR._animations[t]}static getImplementInKey(t){return BR._implements[t]}static getSeriesMarkMap(t){return BR._series[t]?BR._series[t].mark:{}}static getChartPlugins(){return Object.values(BR._chartPlugin)}static getComponentPlugins(){return Object.values(BR._componentPlugin)}static getComponentPluginInType(t){return BR._componentPlugin[t]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}}BR._charts={},BR._series={},BR._components={},BR._marks={},BR._regions={},BR._animations={},BR._implements={},BR._chartPlugin={},BR._componentPlugin={},BR.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}},BR.dataParser={csv:li,dsv:oi,tsv:hi},BR._layout={};const RR=(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))},OR=(t,e,i,n)=>{var s;const r=bS(e.getScale().type),a=[],o=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const l of o)if(l.coordinate===i){const i=U(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:IR(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("_")}`,PR=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&e(n)&&((t,e,i)=>{const n=t.getRegionsInIds(U(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},LR=(t,e)=>{if(!t)return null;if(!ik(t.getRegionsInIndex(),"polar"))return null;const{x:i,y:n}=e,s=PR(t,(t=>"angle"===t.getOrient()),e),r=PR(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&&bS(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=QA({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=tk(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 _=OR(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&&bS(r.type)){const h=t.getCenter(),c={x:i-t.getLayoutStartPoint().x-h.x,y:n-t.getLayoutStartPoint().y-h.y};let d=QA({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=tk(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=OR(m,t,"polar",o);a.push({index:v,value:m,position:r.scale(m),axis:t,data:y})}})),a.length?a:null};function DR(t){return"bottom"===t||"top"===t}function FR(t){return"left"===t||"right"===t}function jR(t){return"z"===t}function NR(t,e){return fB(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function zR(t,e){var i;const n=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?DR(t)?"linear":"band":DR(t)?"band":"linear"}(t.orient,e);return{axisType:n,componentName:`${r.cartesianAxis}-${n}`}}const VR=t=>t.fieldX[0],HR=t=>t.fieldY[0],GR=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},WR=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},UR=(t,e)=>t?e?VR:GR:e?HR:WR,YR=(t,e,i)=>{var n,s;if(!t)return null;if(!ik(t.getRegionsInIndex(),"cartesian"))return null;const{x:r,y:a}=e,o=null!==(n=PR(t,(t=>DR(t.getOrient())),e))&&void 0!==n?n:[],l=null!==(s=PR(t,(t=>FR(t.getOrient())),e))&&void 0!==s?s:[],h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{bS(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=KR(n,i,t,UR(e,bS(n.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(n)){const r=KR(n,i,t,UR(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},KR=(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 XR(t,a,n)},XR=(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=OR(e,t,"cartesian",null!=i?i:DR(t.getOrient())?VR:HR);return{index:s,value:e,position:n.scale(e),axis:t,data:r}};class $R{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:Sf)("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:Sf)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,n;const s=null!==(i=YR(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(n=LR(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=>bS(t.getScale().type))),r=s.length?s:n.filter((t=>{const e=t.getOrient();return DR(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=XR(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var ZR;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(ZR||(ZR={}));const qR={[ZR.dimensionHover]:class extends $R{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)=>!RR(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}),Cf(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}),Cf(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[ZR.dimensionClick]:class extends $R{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 JR=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(qR[t]){const e=new qR[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(qR[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}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class QR{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}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const tO={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 eO{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 QR);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}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 tO[a]&&(a=tO[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.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 IE.includes(e)||Object.values(t.VGRAMMAR_HOOK_EVENT).includes(e)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&_w.hasInteraction(e)}}function iO(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function nO(t,e,i){t.getParser(e)||t.registerParser(e,i)}const sO=new Map;function rO(t,e=!1){let i=e;return t.latestData instanceof fi&&(i=!1),i?P(t.latestData):t.latestData.slice()}const aO=(t,e)=>0===t.length?[]:1===t.length?rO(t[0],null==e?void 0:e.deep):t.map((t=>rO(t,null==e?void 0:e.deep)));function oO(t,e,i){iO(e=e instanceof pi?e:t.dataSet,"copyDataView",aO);const n=new fi(e,i);return n.parse([t],{type:"dataview"}),n.transform({type:"copyDataView",level:cO.copyDataView}),n}function lO(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:Sf)(`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:Sf)(`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([]),xf("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 hO(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var cO;!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"}(cO||(cO={}));const dO=(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 aC(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:mO(this._option.mode),autoFit:!1,eventConfig:{gesture:Cf(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())}clear(t,e=!1){const{chart:i}=t;i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=cg.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this._nextRafId&&(cg.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null),this._isRunning||(this.initView(),this._view&&(this._isRunning=!0,null===(e=this._view)||void 0===e||e.run(t),this._isRunning=!1,this._nextRafId&&(cg.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,this._isRunning=!0,null===(i=this._view)||void 0===i||i.run(t),this._isRunning=!1))))}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.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 Tf(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function yO(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:Sf)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function _O(t){t.crosshair=U(t.crosshair||{}).map((e=>ZB({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function bO(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&&Tf(e.mode)){let t;t=y(h)?null===document||void 0===document?void 0:document.getElementById(h):h;const{width:e,height:n}=Ie(t,i.width,i.height);a=e,o=n}else if(Ef(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 xO(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")}),t}function SO(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"}(gO||(gO={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(fO||(fO={}));class AO{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({},AO.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=U(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]))))}}AO.defaultMarkInfo={};class kO{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new AO,this._markReverse=new AO,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement(gO.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement(gO.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement(gO.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement(gO.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement(gO.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(gO.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[gO.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[gO.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(ZR.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 wO={};Object.values(gO).forEach((t=>{wO[t]=!0}));const TO={[gO.STATE_HOVER]:gO.STATE_HOVER_REVERSE,[gO.STATE_SELECTED]:gO.STATE_SELECTED_REVERSE,[gO.STATE_DIMENSION_HOVER]:gO.STATE_DIMENSION_HOVER_REVERSE};function CO(t){return TO[t]}class EO{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=CO(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=CO(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=CO(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=CO(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 MO{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 BO extends MO{constructor(){super(...arguments),this.id=Bf(),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 RO extends BO{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,n){super(t),this.grammarType=pO.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 OO extends MO{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 RO(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 IO extends OO{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 PO extends IO{constructor(){super(...arguments),this.id=Bf(),this.stateKeyToSignalName=t=>`${ak}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===uO.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===uO.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?uO.none:uO.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?uO.exit:uO.appear}}}}class LO{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=>ZB({},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 DO extends MO{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=LO,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new AO,this._lastLayoutRect=null,this.id=Bf(),this.userId=t.id,this._spec=t,this.effect={},this.event=new JR(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=`${ak}_${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=BR.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 FO{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=yB(_B(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:vB(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(n=this._maxHeight)&&void 0!==n?n:null:vB(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(s=this._minWidth)&&void 0!==s?s:null:vB(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:vB(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:vB(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:vB(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=vB(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=vB(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]=vB(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 jO extends DO{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 FO(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 NO extends LO{_initTheme(t,e){return{spec:t,theme:this._theme}}}class zO extends jO{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=NO,this.modelType="region",this.specKey="region",this.type=zO.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.interaction=new EO,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 PO({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||U(t.userId).includes(e.userId))&&(!p(t.specIndex)||U(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 kO(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 fO)B(t.stateStyle[fO[e]])||this.interaction.registerMark(fO[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 VO(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 HO(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 GO(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 WO(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),GO(c,!0,u,o),n&&HO(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function UO(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),GO(c,!1,u,a),n&&HO(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function KO(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}=VO(t);n.length&&WO(n,e,i,!1,"left"),s.length&&WO(s,e,i,!0,"left"),r.length&&UO(r,e,0,"left")}(e,this,a),n.length&&function(t,e,i){const{startItems:n,middleItems:s,endItems:r}=VO(t);n.length&&YO(n,e,i,!1,"top"),s.length&&YO(s,e,i,!0,"top"),r.length&&KO(r,e,0,"top")}(n,this,r),i.length&&function(t,e,i){const{startItems:n,middleItems:s,endItems:r}=VO(t);n.length&&WO(n,e,i,!1,"right"),s.length&&WO(s,e,i,!0,"right"),r.length&&UO(r,e,0,"right")}(i,this,a),s.length&&function(t,e,i){const{startItems:n,middleItems:s,endItems:r}=VO(t);n.length&&YO(n,e,i,!1,"bottom"),s.length&&YO(s,e,i,!0,"bottom"),r.length&&KO(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:Sf)("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}}}XO.type="base";const $O=["line","area","trail"];function ZO(t){return $O.includes(t)}class qO extends IO{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(ZO)?n:!t.mark||ZO(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=>!!wO[t])).map((t=>[t,10])),n=!t.mark||ZO(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(ak)));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(ak)));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(yS(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 JO extends BO{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=pO.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 QO extends JO{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${ak}_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 tI extends BO{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=pO.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 qO(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 JR(n.getOption().eventDispatcher,n.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new QO(t)}stateKeyToSignalName(t){return`${ak}_${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=gO.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=gO.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===uO.appear&&this.runAnimationByState(uO.normal)})):this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,(()=>{this.runAnimationByState(uO.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),this._morph&&this._morphKey&&(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 eI extends tI{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].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))}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&&ZB(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(_S(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=uB(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()):oM.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):_S(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=nB(iB(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({},dM[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)oM.includes(null===(o=s.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(s.stroke)(t,e));else{const e=nB(iB(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 iI extends eI{constructor(){super(...arguments),this.type=iI.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)?(xf("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?(xf("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})}))}}iI.type="group";const nI=()=>{bb(),lb(),_w.registerGraphic(Ck.group,yl),BR.registerMark(iI.type,iI)},sI={type:"clipIn"},rI={type:"fadeIn"};function aI(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 rI;default:return sI}}const oI={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"}},lI={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},hI=()=>{BR.registerAnimation("scaleInOut",(()=>lI))},cI=(t,e)=>({appear:aI(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:Da,duration:oI.update.duration,easing:oI.update.easing}],disappear:{type:"clipOut"}}),dI=()=>{BR.registerAnimation("line",cI)},uI=()=>{aC.useRegisters([mE,vE,yE,_E,bE,xE,aE,oE])},pI={measureText:(t,e,i,n)=>((t,e,i)=>Wb(t,e,i,{fontFamily:VB.fontFamily,fontSize:VB.fontSize}))(e,i,n).measure(t)};class gI{static instance(){return gI.instance_||(gI.instance_=new gI),gI.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 fI{constructor(){this.id=Bf(),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))?xf("不要重复添加相同的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 mI extends fI{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 vI{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>BR.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>BR.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>BR.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return BR.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>BR.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){BR.registerTransform(t,e)}static registerFunction(t,e){t&&e&&gI.instance().registerFunction(t,e)}static unregisterFunction(t){t&&gI.instance().unregisterFunction(t)}static getFunction(t){return t?gI.instance().getFunction(t):null}static getFunctionList(){return gI.instance().getFunctionNameList()}static registerMap(t,e,i){const n=BR.getImplementInKey("registerMap");n&&n(t,e,i)}static unregisterMap(t){const e=BR.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,sO.get(e);var e}static hideTooltip(t=[]){pR.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,c;this.id=Bf(),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 d=this._option,{dom:u,renderCanvas:p,mode:g,stage:f,poptip:m}=d,v=e(d,["dom","renderCanvas","mode","stage","poptip"]),_=Tf(g);_&&u&&(this._container=y(u)?null===document||void 0===document?void 0:document.getElementById(u):u),p&&(this._canvas=p),f&&(this._stage=f),"node"===g||this._container||this._canvas||this._stage?(_?Ym(Ys):"node"===g&&Ty(Ys),this._viewBox=this._option.viewBox,this._currentThemeName=gR.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new vO({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:p},Object.assign(Object.assign({mode:this._option.mode,stage:f,pluginList:!1!==m?["poptipForText"]:[]},v),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new eO(this,this._compiler),this._event=new JR(this._eventDispatcher,g),this._compiler.initView(),null===(o=this.getStage())||void 0===o||o.setTheme({text:{fontFamily:null===(l=this._currentTheme)||void 0===l?void 0:l.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!_&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),pR.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=ZB({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=mR(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,n;vI.getFunctionList()&&vI.getFunctionList().length&&(t=vR(t,vI)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=BR.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=BR.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=BR.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 bO(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:ok,height:null!==(n=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==n?n:lk})}_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,nO(this._dataSet,"dataview",ci),nO(this._dataSet,"array",n),iO(this._dataSet,"stackSplit",dO),iO(this._dataSet,"copyDataView",aO);for(const t in BR.transforms)iO(this._dataSet,t,BR.transforms[t]);for(const t in BR.dataParser)nO(this._dataSet,t,BR.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),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;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,null===(n=this._compiler)||void 0===n||n.releaseGrammar(!1===(null===(s=this._option)||void 0===s?void 0:s.animation)||!1===(null===(r=this._spec)||void 0===r?void 0:r.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.reCompile&&(null===(a=this._compiler)||void 0===a||a.clear({chart:this._chart,vChart:this},!this._option.animation||!this._spec.animation),null===(o=this._compiler)||void 0===o||o.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(){var t,e;this._option.animation&&(null===(t=this._chart)||void 0===t||t.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(uO.update,!0)})),null===(e=this._chart)||void 0===e||e.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(uO.update,!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,pR.unregisterInstance(this)}updateData(t,e,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,n)}))}_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=U(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i){return u(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),this._compiler.render(),this):(this._spec.data=U(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0){if(this._chart)return this._chart.updateFullData(t),e&&this._compiler.render(),this;const i=U(this._spec.data);return U(t).forEach((t=>{var e;const{id:n,values:s,parser:r,fields:a}=t,o=i.find((t=>t.name===n));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 n=lO(t,this._dataSet,i,{onError:null===(e=this._option)||void 0===e?void 0:e.onError});_(this._spec.data)&&this._spec.data.push(n)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:n,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i){const n=this._updateSpec(t,e);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.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){var i,n;const s=this._spec;if(!this._setNewSpec(t,e))return;H(s.theme,this._spec.theme)||this._setCurrentTheme();const r=this._shouldChartResize(s);return null===(n=null===(i=this._compiler)||void 0===i?void 0:i.getVGrammarView())||void 0===n||n.updateLayoutTag(),this._spec.type!==s.type?{reTransformSpec:!0,change:!0,reMake:!0,reCompile:!1,reSize:r}:(this._initChartSpec(this._spec,"render"),xO(this._chart.updateSpec(this._spec),{reTransformSpec:!1,change:r,reMake:!1,reCompile:!1,reSize:r}))}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)||qB(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)||qB(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=ZB({},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=fR(this._currentThemeName,!0);else if(y(n)&&(!s||y(s))||y(s)&&(!n||y(n))){const t=JB({},fR(this._currentThemeName,!0),fR(n,!0),fR(s,!0));this._currentTheme=t}else{const t=JB({},fR(this._currentThemeName),fR(n),fR(s));this._currentTheme=iR(t)}var r;r=R(this._currentTheme,"component.poptip"),j(tx.poptip,Qb,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=!!Tf(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?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return fR(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){if(!gR.themeExist(t))return this;const e=this._setCurrentTheme(t);return yield this.updateCustomConfigAndRerender(e,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){if(!gR.themeExist(t))return this;const e=this._setCurrentTheme(t);return this.updateCustomConfigAndRerender(e,!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}}_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 yO(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(!Tf(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)?null===document||void 0===document?void 0:document.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?bB(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 xf("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?bB(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(xf("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return gI.instance().getFunction(t)}registerFunction(t,e){t&&e&&gI.instance().registerFunction(t,e)}unregisterFunction(t){t&&gI.instance().unregisterFunction(t)}getFunctionList(){return gI.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}_initChartPlugin(){const t=BR.getChartPlugins();t.length>0&&(this._chartPlugin=new mI(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}}}vI.InstanceManager=pR,vI.ThemeManager=gR,vI.globalConfig={uniqueTooltip:!0},vI.Utils=pI,vI.vglobal=cg;BR.registerRegion("region",zO),BR.registerLayout("base",XO),nI(),aC.useRegisters([wC,TC]),aC.useRegisters([EE,ME,lE,hE,TE,CE,BE,RE,OE]),Nw(),jw(),lR(GB.name,GB),it.getInstance(et.Error);const yI=(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(sk).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=BR.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:n}=f,s=U(null!==(h=null===(l=i.component)||void 0===l?void 0:l[n])&&void 0!==h?h:[]);null===(d=U(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=BR.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=U(null!==(p=null===(u=i.component)||void 0===u?void 0:u[s])&&void 0!==p?p:[]);U(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},_I=(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=yI(t,s,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!u(e)||U(e).some((e=>d(e)?e(t,i,n):WB(t.spec,e)))))})})(a,r,t,e,i,n);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const f=ZB({},i),m=d(s)?s(g,t,e):s;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:ZB(f,m),hasChanged:!0};const i=ZB({},t,m);UB(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 bI{constructor(t){this.id=Bf(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}const xI=t=>{BR.registerChartPlugin(t.type,t)};class SI extends bI{constructor(){super(SI.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[SI.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[SI.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=YB(this._option.globalInstance.getSpec(),["data",SI.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return n.length>0?(s=YB(this._baseChartSpec,["data",SI.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=_I(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=YB(i,["data",SI.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()}}SI.pluginType="chart",SI.specKey="media",SI.type="MediaQueryPlugin";const AI=/\{([^}]+)\}/,kI=/\{([^}]+)\}/g,wI=/:/;class TI extends bI{constructor(){super(TI.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=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[TI.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)),BR.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=AI.test(i),this._isNumericFormatterCache.set(i,n))),n){const t=i.replace(kI,((t,i)=>{if(!wI.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}}TI.pluginType="chart",TI.specKey="formatter",TI.type="formatterPlugin";const CI=()=>{xI(TI)};function EI(t){return 2===t.length&&A(t[0])&&A(t[1])&&t[1]>=t[0]}function MI(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 BI(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 RI(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 OI(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 II(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 PI=(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 gA(v)};class LI extends bI{constructor(){super(LI.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!yS(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&&EI(c)&&EI(d)))return;const u=MI(t,c),p=MI(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(!RI(u,p))return}else if(0===_&&0===b){if(!RI(p,u))return}else if(y||A)if(y&&!A){if(!BI(u,p))return}else if(A&&!y){if(!BI(p,u))return}else{if(f===b)return;if(f>b){if(!OI(u,p))return}else if(!OI(p,u))return}else{if(0===f&&0===_){if(!II(u,p))return}else if(0===b&&0===g&&!II(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){iO(e.getOption().dataSet,"tickAlign",PI);const t={targetAxis:()=>n,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}LI.pluginType="component",LI.type="AxisSyncPlugin";const DI=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,FI=(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},rd||(rd=nd.CreateGraphic("richtext",{})),rd.setAttributes(a),rd.AABBBounds);var a;return{width:r.width(),height:r.height(),text:n}},jI="vchart-tooltip-container",NI={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}};function zI(t,e){return R(e,`component.${t}`)}function VI(t,e,i,n){if(t)return{formatFunc:t,args:[i,n]};const s=BR.getFormatter();return e&&s?{formatFunc:s,args:[i,n,e]}:{}}const HI={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function GI(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 WI(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 UI(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const YI=(t,e,i)=>{var n;const s=null!==(n="band"===e?zI("axisBand",i):["linear","log","symlog"].includes(e)?zI("axisLinear",i):{})&&void 0!==n?n:{},r=DR(t)?zI("axisX",i):FR(t)?zI("axisY",i):zI("axisZ",i);return ZB({},zI("axis",i),s,r)},KI=(t,e,i)=>{var n;const s=null!==(n="band"===e?zI("axisBand",i):"linear"===e?zI("axisLinear",i):{})&&void 0!==n?n:{},r=zI("angle"===t?"axisAngle":"axisRadius",i);return ZB({},zI("axis",i),s,r)},XI=t=>"band"===t||"ordinal"===t||"point"===t;function $I(t,e){return{id:t,label:t,value:e,rawValue:t}}function ZI(t,e,i,n){let s=0,r=t.length-1;for(;s<=r;){const a=Math.floor((s+r)/2),o=t[a];if(o[i]<=e&&o[n||i]>=e)return o;o[i]>e?r=a-1:s=a+1}return null}const qI=(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(bS(a.type))A=a.bandwidth(),0===A&&a.step&&(w=a.step());else if(yS(a.type)){const n=e.fieldX[0],r=e.fieldX2,a=ZI(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=GI(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(bS(r.type))k=r.bandwidth(),0===k&&r.step&&(T=r.step());else if(yS(r.type)){const n=e.fieldY[0],r=e.fieldY2,a=ZI(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=GI(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(QI(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&&JI(t,"top",r.label),e.visible&&JI(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(QI(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&&JI(t,"left",a.label),e.visible&&JI(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}},JI=(t,e,i)=>{const{formatMethod:n,formatter:s}=i,{formatFunc:r,args:a}=VI(n,s,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},QI=(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)}))}))},tP=(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=iP(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},eP=(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=iP(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},iP=(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},nP=(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},sP={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"]},rP=(t,e)=>{var i,n;return null!==(n=null===(i=sP[t])||void 0===i?void 0:i[0])&&void 0!==n?n:e},aP=(t,e)=>{var i,n;return null!==(n=null===(i=sP[t])||void 0===i?void 0:i[1])&&void 0!==n?n:e},oP=(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}=qI(3,e,i,n,s,r,a);return o?tP(r,o,d,h):l?eP(a,l,u,c):void 0},lP={fontFamily:VB.fontFamily,spacing:10,wordBreak:"break-word"};function hP(t={},e,i){var n,s;return Object.assign(Object.assign({},null!=i?i:lP),{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 cP=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},dP=(t,e)=>p(e)?t.map((t=>e[t])):void 0,uP=(t,e)=>i=>t.every(((t,n)=>i[t]===(null==e?void 0:e[n]))),pP=t=>!u(t)&&(_(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function gP(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=fP(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=>uP(i,n)(t)&&uP(s,r)(t)&&(u(a)||uP([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 vI.globalConfig.uniqueTooltip&&vI.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 vI.globalConfig.uniqueTooltip&&vI.hideTooltip(u.id),d}return"none"}const fP=(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=dP(c,t);let y=dP(d,t);const _=pP(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(uP(c,v));if(!_&&(y=dP(d,i),!pP(y)))return;const s=e.type===sk.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=bS(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(uP(c,s));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=dP(d,o),!pP(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(uP(c,s));if(!_&&(y=dP(d,r),!pP(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===sk.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(uP(c,v))).find((t=>t[g]===f));m.forEach((s=>{if(y=dP(d,i),!pP(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},mP=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 vP=(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 yP{constructor(){this.activeTriggerSet={mark:new Set,dimension:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set,dimension:new Set,group:new Set}}}class _P extends yP{constructor(t){super(),this._getSeriesCacheInfo=()=>{var t,e,i;const{series:n}=this,s=n.getSeriesField();return{seriesFields:p(s)?U(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 U(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:xP(e.title,{seriesId:this.series.id},!0),content:SP(e.content,{seriesId:this.series.id},!0)}))})),this.spec=a,this.activeType=mP(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 bP=(t,e,i)=>{const n=d(e)?e(t):e;return i?Object.assign(Object.assign({},t),n):Object.assign(Object.assign({},n),t)},xP=(t,e,i)=>p(t)?d(t)?(...n)=>bP(t(...n),e,i):bP(t,e,i):void 0,SP=(t,e,i)=>{const n=p(t)?U(t).map((t=>d(t)?(...n)=>U(t(...n)).map((t=>bP(t,e,i))):bP(t,e,i))):void 0;return n},AP=(t,e,i)=>{var n;let s={};switch(t){case"mark":case"group":e&&(s=null!==(n=vP(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=vP(n,"dimension",s);r&&t.push(r)}))));const e=[];t.forEach((({content:t})=>{d(t)?e.push(t):e.push(...U(t))})),s=Object.assign(Object.assign({},t[0]),{content:e})}}return s},kP=(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=wP(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)&&mP(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(...U(t)))})),r=Object.assign(Object.assign({},t[0]),{content:e})}}}return r},wP=ht((t=>t.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(p))),[]))),TP=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},CP=(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}=VI(void 0,n,t,e);i&&r&&(s=i(...r))}return s},MP=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;class BP{}BP.dom=`${ak}_TOOLTIP_HANDLER_DOM`,BP.canvas=`${ak}_TOOLTIP_HANDLER_CANVAS`;const RP=20,OP={key:"其他",value:"..."},IP=(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)},PP=(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=MP(t.title,e,i),{visible:h,value:c,valueTimeFormat:p,valueTimeFormatMode:g,valueStyle:f,hasShape:m,valueFormatter:v}=null!=l?l:{},y=!1!==EP(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:IP(EP(c,t,i,v),p,g),valueStyle:EP(f,t,i),hasShape:m}}else o.title={hasShape:!1,visible:!1};const _=((t,e,i)=>{if(u(t))return t;let n=[];return U(t).forEach((t=>{d(t)?n=n.concat(U(t(e,i))):n.push(t)})),n})(t.content,e,i),{maxLineCount:b=RP}=t,x=t.othersLine?Object.assign(Object.assign({},OP),t.othersLine):OP,S=t=>{if(null==t?void 0:t.length)for(const e of t)for(const t of null!=_?_:[]){const n=LP(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=LP(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},LP=(t,e,i)=>{const n=IP(EP(e.key,t,i,e.keyFormatter),e.keyTimeFormat,e.keyTimeFormatMode),s=IP(EP(e.value,t,i,e.valueFormatter),e.valueTimeFormat,e.valueTimeFormatMode),r=!1!==EP(e.visible,t,i)&&(p(n)||p(s)),a=EP(e.isKeyAdaptive,t,i),o=EP(e.spaceRow,t,i),l=EP(e.shapeType,t,i),h=EP(e.shapeColor,t,i),c=EP(e.shapeFill,t,i),d=EP(e.shapeStroke,t,i),u=EP(e.shapeLineWidth,t,i),g=EP(e.shapeHollow,t,i),f=EP(e.keyStyle,t,i),m=EP(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 DP extends bI{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=MP(x.position,b,e),w=null!==(s=MP(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:ok,O=null!==(o=null==B?void 0:B.height)&&void 0!==o?o:lk;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(Tf(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=DI(t,e),j=DI(T,D)}}else P.width=R,P.height=O;const N=j/F;let z,V,H,G,W=k,U=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=oP(e.dimensionInfo,ik(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.x,a=t.end.x)}else W=t;if(I)switch(rP(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=oP(e.dimensionInfo,ik(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.y,a=t.end.y)}else U=t;if(I)switch(aP(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=nP(t,c),V=nP(i,c),H=nP(e,c),G=nP(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=nP(t,c):Y(t),S(e)||d(e)?V=nP(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(rP(W,"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(aP(U,"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,Tf(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"===rP(k,"right")?$+=v+C/2:$+=2*v+C)},at=()=>{et()&&($=-D.x/j)},ot=()=>{it()&&(I?$=(Q-D.x)/j-C:"center"===rP(k,"right")?$-=v+C/2:$-=2*v+C)},lt=()=>{it()&&($=(Q-D.x)/j-C)},ht=()=>{nt()&&(I?Z=-D.y/j:"center"===aP(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"===aP(k,"bottom")?Z-=y+E/2:Z-=2*y+E)},ut=()=>{st()&&(Z=(tt-D.y)/j-E)};switch(rP(k,"right")){case"center":case"centerLeft":case"centerRight":et()?(rt(),lt()):(ot(),at());break;case"left":rt(),lt();break;case"right":ot(),at()}switch(aP(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({},NI),{offsetX:null!==(t=null==i?void 0:i.x)&&void 0!==t?t:NI.offsetX,offsetY:null!==(e=null==i?void 0:i.y)&&void 0!==e?e:NI.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=_B(d.padding),S=hP(Object.assign({textAlign:"right"===_?"right":"left"},u),i),A=hP(Object.assign({textAlign:"right"===_?"right":"left"},f),i),k=hP(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:cP(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=ZB({},A,hP(b,void 0,{})),{width:n,height:s,text:r}=FI(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=ZB({},k,hP(x,void 0,{})),{width:e,height:n,text:s}=FI(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=ZB({},S,hP(W,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}=FI(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(Tf(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=DI(t,n),u=DI(l,c)}return n*=d,s*=d,Tf(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()}}DP.specKey="tooltip";const FP=(t,e)=>p(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",jP=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 NP;const zP=(t=document.body)=>{if(u(NP)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),NP=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return NP};function VP(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}=ZB({},e,t),n={};return n.width=FP(i),n}(E),O=HP(M),I=HP(B),{bottom:P,left:L,right:D,top:F}=_B(h),j="right"===f?"marginLeft":"marginRight";return{align:f,panel:{width:FP(T+2*w),minHeight:FP(g+2*w),paddingBottom:FP(P),paddingLeft:FP(L),paddingRight:FP(D),paddingTop:FP(F),borderColor:k,borderWidth:FP(w),borderRadius:FP(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)?FP(null==r?void 0:r.spaceRow):"0px"},HP(ZB({},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 GP.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=GP.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==wf?void 0:wf.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(GP.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}}GP.type="tooltipModel";const WP={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},UP={boxSizing:"border-box"},YP={display:"inline-block",verticalAlign:"top"},KP={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},XP={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},$P={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},ZP={lineHeight:"normal",boxSizing:"border-box"};class qP extends GP{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=jP(u),_=t=>new uc({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 JP extends GP{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 QP={overflowWrap:"normal",wordWrap:"normal"};class tL extends GP{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(ZB({},YP,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=ZB({},o?XP:KP,Object.assign(Object.assign(Object.assign({height:FP(l)},QP),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 ZB({},$P,Object.assign(Object.assign(Object.assign({height:FP(n)},QP),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 ZB({},ZP,Object.assign(Object.assign({height:FP(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 eL extends GP{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 tL(this.product,this._option,t,e);return i.init(),this.children[i.childIndex]=i,i}setStyle(t){super.setStyle(ZB(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+jP(e)),0);return Object.assign(Object.assign({},t),{width:`${a+zP(this._option.getContainer())}px`,maxHeight:FP(n),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class iL extends GP{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 qP(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 JP(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(ZB({},WP,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 nL="99999999999999";class sL extends GP{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:nL,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 iL(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 eL(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(ZB({},UP,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 rL=t=>{BR.registerComponentPlugin(t.type,t)};class aL extends DP{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(aL.type),this.type=BP.dom,this._tooltipContainer=null==wf?void 0:wf.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(wf&&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=VP(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()}))}}aL.type=BP.dom;class oL extends DP{constructor(){super(oL.type),this.type=BP.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 JA({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()}}oL.type=BP.canvas;const lL=()=>{rL(oL)},hL=(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},cL={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}},dL=(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=yR([],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 uL(a,s,o)},uL=(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)=>{Rf(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=>{Rf(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]=cL[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},pL=(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=>{Rf(t[e])||(t[e]=0)}))})),t};class gL extends JO{_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 fL(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function mL(t,e,i){t&&(i.needDefaultSeriesField&&(t[WE]=i.defaultSeriesField),t[HE]=e,t[GE]=i.getKey(t,e,i))}const vL=["appear","enter","update","exit","disappear","normal"];function yL(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 AL(s)&&delete s.type,s.oneByOne&&(s=bL(s,null!==(n=null==i?void 0:i.dataIndex)&&void 0!==n?n:xL,null==i?void 0:i.dataCount)),s})):o.map(((t,e)=>{var n;let s=ZB({},o[e],a);return AL(s)&&delete s.type,s.oneByOne&&(s=bL(s,null!==(n=null==i?void 0:i.dataIndex)&&void 0!==n?n:xL,null==i?void 0:i.dataCount)),s})),n[r]=l):n[r]=o}return n.state=n.update,n}function _L(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),kL(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 bL(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 xL(t,e){var i,n;return null!==(i=null==t?void 0:t[HE])&&void 0!==i?i:null===(n=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===n?void 0:n.elementIndex}function SL(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 AL(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function kL(t,e){if(_(t))t.forEach(((i,n)=>{t[n]=e(t[n],n),kL(t[n],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),kL(t[i],e)}class wL extends LO{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=U(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=QM(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=tR(R(a,`series.${h}`),h,l,o),d=R(a,`series.${h}_${r}`);return ZB({},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),c(t.stackOffsetSilhouette)&&(this.stack=t.stackOffsetSilhouette||this.stack),p(t.stackValue)&&(this.stack=!0),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",n="initLabelMarkStyle",s,r){if(!t)return;U(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=ZB({},i,n,t),s=i.label;return s&&g(s)&&_(e.label)&&(e.label=e.label.map((t=>ZB({},s,t)))),e};return _(t)?{spec:t.map((t=>s(t))),theme:i}:{spec:s(t),theme:i}}return{spec:t,theme:i}}}class TL extends DO{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:`${ak}_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=wL,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=function(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)}(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)&&(iO(this._rawData.dataSet,"invalidTravel",pL),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=lO(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=oO(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=oO(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new gL(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;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){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];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):this._rawStatisticsCache[t]=uL(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t]}}return e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))&&(this._rawStatisticsCache[t].min=X(this._rawStatisticsCache[t].values),this._rawStatisticsCache[t].max=K(this._rawStatisticsCache[t].values)),this._rawStatisticsCache[t]}_statisticViewData(){iO(this._dataSet,"dimensionStatistics",dL);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&&yR(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){iO(this._dataSet,"dimensionStatistics",dL);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=yR(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&yR(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)&&(iO(this._rawData.dataSet,"addVChartProperty",hL),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:fL.bind(this),call:mL}},!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=yL({},_L(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"}}:Cf(n)||Ef(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=ZB(s,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=ZB(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:gO.STATE_HOVER_REVERSE,highlightState:gO.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:gO.STATE_SELECTED_REVERSE,state:gO.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 t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:WE;this.getMarksWithoutRoot().forEach((t=>{const n={},s={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(n[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{s[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:UE,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][i]]:!0===n[t[i]]});const a={};Object.keys(s).forEach((e=>{a[e]=n=>{var s,a;let o;if(Array.isArray(n)){if(0===n.length)return;o=null===(s=r[n[0][i]])||void 0===s?void 0:s[e]}return o=null===(a=r[n[i]])||void 0===a?void 0:a[e],o||t.getAttribute(e,n)}})),this.setMarkStyle(t,a,UE)}))}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 _P(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=null!=i?i:{data:!0}).invalidType=!0,t.invalidType!==e.invalidType&&(r.reCompile=!0),i.extensionMark=!0,(U(t.extensionMark).length!==U(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((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||hO(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()}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:WE,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),n=this._getDataScheme();return null===(e=(t=(new cB).domain(i)).range)||void 0===e?void 0:e.call(t,n)}_getDataScheme(){return iB(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:WE}}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(...U(y));const a=this.getSpec()||{};T.setMorph(x),T.setMorphKey((null===(n=a.morph)||void 0===n?void 0:n.morphKey)||`${this.getSpecIndex()}`),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,ZB({},h,d||a[T.name]))}return T}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:GE}_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!==$E&&t!==qE&&t!==XE&&t!==ZE||(t=this.getStackValueField()),null!==(e=bR(this.getRawData(),t))&&void 0!==e?e:t}getMarkInfoList(){var t;const e=super.getMarkInfoList();return e.length?e:Object.values(null!==(t=JM[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=>Rf(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:WE]}}function CL(t,e,i){const n=t.getScale(0),s="isInverse"in t&&t.isInverse();yS(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 EL(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}}}TL.mark=uM,TL.transformerConstructor=wL;class ML extends TL{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=U(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=U(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&U(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);yS(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:`${ak}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?U(this._spec.xField)[0]:U(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX($E),this.setFieldX2(XE)):(this.setFieldY($E),this.setFieldY2(XE))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(qE),this.setFieldX2(ZE)):(this.setFieldY(qE),this.setFieldY2(ZE))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(QE),this.setFieldX2(JE)):(this.setFieldY(QE),this.setFieldY2(JE))}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=U(this._spec.xField),this._specYField=U(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(U(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(U(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)&&(CL("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 BL="monotone";class RL{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(_M.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===BL?"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(_M.point,{morph:SL(this._spec,_M.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:`${ak}_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(ZR.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:gO.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[_M.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(ZR.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,ZB({},this._spec[_M.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:gO.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 OL extends eI{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)&&(_S(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);let c=this._styleConvert(h);a&&"angle"===l&&(c=this.convertAngleToRadian(c)),this.setAttribute(l,c,e,i,n)})),o&&this.setEnableSegments(o)}}class IL extends OL{constructor(){super(...arguments),this.type=IL.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)===sk.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}IL.type="line";const PL=()=>{BR.registerMark(IL.type,IL),bb(),cb(),_w.registerGraphic(Ck.line,mc),uI()};class LL extends eI{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class DL extends LL{constructor(){super(...arguments),this.type=DL.type}}DL.type="symbol";const FL=()=>{BR.registerMark(DL.type,DL),bb(),Sb(),_w.registerGraphic(Ck.symbol,pc)};class jL extends wL{_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 NL extends fI{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function zL(t,e,i,n){switch(t){case r.cartesianBandAxis:return YI(NR(i,["z"]),"band",e);case r.cartesianLinearAxis:return YI(NR(i,["z"]),"linear",e);case r.cartesianLogAxis:return YI(NR(i,["z"]),"log",e);case r.cartesianSymlogAxis:return YI(NR(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return YI(NR(i),void 0,e);case r.polarBandAxis:return KI(i.orient,"band",e);case r.polarLinearAxis:return KI(i.orient,"linear",e);case r.polarAxis:return KI(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,n;const s=U(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h}=null!==(n=zI(r.crosshair,t))&&void 0!==n?n:{},c=s.find((t=>DR(t.orient)));let d;d=p(c)?ZB({},XI(c.type)?a:o,l):l;const u=s.find((t=>FR(t.orient)));let g;return g=p(u)?ZB({},bS(u.type)?a:o,h):h,{xField:d,yField:g}})(e,n);case r.polarCrosshair:return((t,e)=>{var i,n;const s=U(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h}=null!==(n=zI(r.crosshair,t))&&void 0!==n?n:{},c=s.find((t=>"angle"===t.orient));let d;d=p(c)?ZB({},XI(c.type)?a:o,l):l;const u=s.find((t=>"radius"===t.orient));let g;return g=p(u)?ZB({},bS(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 VL(i,zI(t,e));default:return zI(t,e)}}const VL=(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=ZB({},e,n);return delete s.horizontal,delete s.vertical,s};class HL extends LO{getTheme(t,e){return zL(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({},_B(e)),{[n]:0}))}}class GL extends jO{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 NL(this)}constructor(e,i){super(e,i),this.name="component",this.modelType="component",this.transformerConstructor=HL,this._delegateEvent=(e,i,n,s=null,r=null)=>{var a,o;i instanceof qr||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 PO({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}}}GL.transformerConstructor=HL;class WL extends eI{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(Ck.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}WL.type="component";const UL=()=>{BR.registerMark(WL.type,WL)},YL=t=>t;class KL extends GL{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 U(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()?Rk.circleAxisGrid:Rk.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=yL(null===(o=BR.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 JO(this._option,t)]}collectData(t,e){const i=[];return ek(this._regions,(n=>{var s;let r=this.collectSeriesField(t,n);if(r=_(r)?yS(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 ek(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=U(t)),p(i)&&(this._regionUserId=U(i)),p(e)&&(this._seriesIndex=U(e)),p(n)&&(this._regionIndex=U(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()})),ek(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(ek(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;tthis._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=CR(n=t.domainLine)).startSymbol=CR(n.startSymbol),n.endSymbol=CR(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 MR(ZB({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:MR(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)=>MR(t[i](e.rawValue,n,e,s,r)):B(t[i])||(e[i]=MR(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 MR(ZB({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:MR(t.tick.style)),t.tick.state&&(i.tick.state=ER(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 MR(ZB({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:MR(t.subTick.style)),t.subTick.state&&(i.subTick.state=ER(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=HI[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?Gt(p):null,textStyle:ZB({},d,MR(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:MR(h.style)}),h.state&&(i.title.state.shape=ER(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:MR(o.style)}),o.state&&(i.title.state.background=ER(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=ER(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=MR(t.background.style)),t.background.state&&(i.panel.state=ER(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 MR(ZB({},null===(s=this._theme.grid)||void 0===s?void 0:s.style,r))}:MR(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:MR(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=VI(t,e);return i?(t,n,s)=>i(n.rawValue,n,e):null}_initTickDataSet(t,e=0){nO(this._option.dataSet,"scale",YL),iO(this._option.dataSet,"ticks",CA);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)}}KL.specKey="axes";const XL=()=>{_w.registerGraphicComponent(Bk.lineAxis,((t,e)=>new cS(t,e))),_w.registerGraphicComponent(Bk.circleAxis,(t=>new gS(t))),_w.registerComponent(Ek.axis,hC),_w.registerGraphicComponent(Rk.lineAxisGrid,((t,e)=>new OA(t,e))),_w.registerGraphicComponent(Rk.circleAxisGrid,((t,e)=>new PA(t,e))),_w.registerComponent(Ek.grid,dC),UL(),BR.registerAnimation("axis",(()=>({appear:{custom:mS},update:{custom:fS},exit:{custom:Fa}})))},$L=[LI];class ZL extends KL{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),ek(this._regions,(t=>{const e=this.getOrient();DR(e)?t.setXAxisHelper(this.axisHelper()):FR(e)?t.setYAxisHelper(this.axisHelper()):jR(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=ZB({x:t.x,y:t.y},this._axisStyle,s);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(ZB({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=DR(this.getOrient()),s=t=>{var e;return(n?!DR(t.getOrient()):DR(t.getOrient()))&&yS(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=NR(i,["z"]),jR(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(!UI(e))return null;const{axisType:t,componentName:n}=zR(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=>FR(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(!UI(t))return;const{axisType:n,componentName:s}=zR(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=BR.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=[];DR(this.getOrient())?A(e)&&(o=this._inverse?[e-s,n]:[n,e-s]):jR(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($L.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){DR(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&&!DR(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),!jR(this.getOrient())&&this._spec.innerOffset){const t=this._spec;FR(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=vB(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=vB(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=DR(this.getOrient())?t.fieldX:jR(this.getOrient())?t.fieldZ:t.fieldY,yS(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:yS(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&&(DR(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=DR(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 ek(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]:DR(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:jR(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,s}updateSeriesScale(){const t=this.getOrient();ek(this._regions,(e=>{DR(t)?(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):FR(t)?(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):jR(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=DR(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=DR(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=ZB(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 $I(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}=WI(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>=qL?10:s>=JL?5:s>=QL?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 eD extends ZL{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new lA}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}}eD.type=r.cartesianLinearAxis,eD.specKey="axes",W(eD,tD);const iD=()=>{XL(),BR.registerComponent(eD.type,eD)};class nD extends ZL{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new VS}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=OS(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=U(e).concat(i);if(s.push(r),o){const e=$I(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=>$I(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 sD=()=>{XL(),BR.registerComponent(nD.type,nD)};class rD extends eD{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),ek(this._regions,(t=>{DR(this.getOrient())?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=ZB({},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 JO(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=>$I(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=>$I(e.value,this._getNormalizedValue([e.value],t))))),n}transformScaleDomain(){}}rD.type=r.cartesianTimeAxis,rD.specKey="axes";class aD extends eD{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new dA}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(){}}aD.type=r.cartesianLogAxis,aD.specKey="axes",W(aD,tD);class oD extends eD{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new uA}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}transformScaleDomain(){}}oD.type=r.cartesianSymlogAxis,oD.specKey="axes",W(oD,tD);class lD extends ML{constructor(){super(...arguments),this.type=sk.line,this.transformerConstructor=jL,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(yL(null===(i=BR.getAnimationInKey("line"))||void 0===i?void 0:i(s,r),_L("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=EL(this);this._symbolMark.setAnimationConfig(yL(null===(n=BR.getAnimationInKey("scaleInOut"))||void 0===n?void 0:n(),_L("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]}}lD.type=sk.line,lD.mark=bM,lD.transformerConstructor=jL,W(lD,RL);class hD{get dataList(){return this._dataArr}constructor(t,e){this._dataArr=[],this._onError=e,this._dataSet=t}parseData(t){this._dataArr=[];const e=U(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(n,((t,e)=>{hO(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 cD{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)=>{Of(i.domain)&&i.domain.forEach((n=>{n.dataId===t&&n.fields.forEach((t=>{yR(e,[{key:t,operations:yS(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&&yR(e,[{key:i.field,operations:yS(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?uB("colorOrdinal"):uB(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(Of(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),Of(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(!Of(e.domain))return e.domain&&0!==e.domain.length||n.domain(t),void this._updateMarkScale(i,n,n.domain().slice());let s;s=yS(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const n=yS(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;yS(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(yS(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const n=this._getSeriesBySeriesId(t.seriesId),s=yS(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)));yS(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 dD{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=xR(t,!0);for(const e in a)for(const i in a[e].nodes)wR(a[e].nodes[i],t.getStackInverse(),s);if(r)for(const t in a)for(const e in a[t].nodes)kR(a[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),n=t.getStackValueField();e&&n&&AR(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 uD extends MO{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=Bf(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:ok,height:lk},this._viewRect={width:ok,height:lk},this._viewBox={x1:0,y1:0,x2:ok,y2:lk},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)=>U(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=_B(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new JR(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new hD(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._spec.background&&"object"==typeof this._spec.background&&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 dD(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=function(t){if(!t)return null;if("string"==typeof t)return{fill:t,fillOpacity:1};if("object"!=typeof t)return null;const e=N(t,["x","y","width","height","x1","y1","image"]);return e.background=t.image,e}(this._spec.background);t&&(this._backgroundMark=BR.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({},t),{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=BR.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 DO)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 eI))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof eI)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){U(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),U(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&hO(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=bO(this._spec,this._option,{width:ok,height:lk})),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=iB(n),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new cD(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){xO(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=iB(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{xO(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{var n,s;const r=i.specKey||i.type,a=null!==(n=this._spec[r])&&void 0!==n?n:{};_(a)?(e[r]=e[r]||{specCount:a.length,componentCount:0},e[r].componentCount++,xO(t,i.updateSpec(null!==(s=a[i.getSpecIndex()])&&void 0!==s?s:{},a))):xO(t,i.updateSpec(a))}));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()];xO(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=yB(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(gO.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(gO.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(gO.STATE_SELECTED)}clearHovered(){this.clearState(gO.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?U(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===ZR.dimensionHover||n===ZR.dimensionClick){const i=s.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>bS(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=>{r?i[t.series.fieldY[0]]=n:i[t.series.fieldX[0]]=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 pD=(t,e)=>{var i;const n=t.spec,{regionId:s,regionIndex:r}=n;if(p(s)){const t=U(s);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return U(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class gD{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);UB(t,r,l.spec),UB(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}));UB(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=pD(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=pD(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=U(s);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return U(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(BR.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(BR.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=BR.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,n.forEach((t=>{const n=BR.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=BR.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(U(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(U(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 fD extends gD{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")&&ZB(i,SO(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 mD extends fD{_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),_O(t)}}class vD extends uD{constructor(){super(...arguments),this.transformerConstructor=mD,this.type="line",this.seriesType=sk.line,this._canStack=!0}}vD.type="line",vD.seriesType=sk.line,vD.transformerConstructor=mD;function yD(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 _D=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:yD(t,e)}),bD=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:yD(t,e)}),xD={type:"fadeIn"},SD={type:"growCenterIn"};function AD(t,e){if(!1===e)return{};switch(e){case"fadeIn":return xD;case"scaleIn":return SD;default:return _D(t)}}class kD extends eI{constructor(){super(...arguments),this.type=kD.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}kD.type="rect";const wD=()=>{BR.registerMark(kD.type,kD),bb(),mb(),_w.registerGraphic(Ck.rect,_c),aC.useRegisters([uE,pE,gE,fE,cE,dE])};function TD(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[pM]):this._spec.barMinHeight?this._calculateRectPosition(t,!1):pB(this._dataToPosX(t),e),this._getBarXEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[gM]):pB(this._dataToPosX1(t),e),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[fM]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):pB(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[mM]):pB(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({},MD.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{morph:SL(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(MD.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(iO(this._option.dataSet,"addVChartProperty",hL),n){const t=([t],{scaleDepth:e})=>{var i;let n=[{}];const s=this.getDimensionField(),r=u(e)?s.length:Math.min(s.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};iO(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:fL.bind(this),call:mL}},!1),null==e||e.target.addListener("change",s.reRunAllTransform)}this._barBackgroundViewData=new gL(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=mM,n=fM,s="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=gM,n=pM,s="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=xR(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)TD(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=pB(this[s](t),o),d=pB(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[XE],s=t[$E],r=t[ZE],h=t[qE];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]),{[XE]:i,[$E]:n}),a?{[ZE]:o,[qE]:l}:void 0);t.push(_c(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=>pB(this._dataToPosY(t),a),y1:t=>pB(this._dataToPosY1(t),a)}:{y:t=>pB(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=>pB(this._dataToPosX(t),r),x1:t=>pB(this._dataToPosX1(t),r)}:{x:t=>pB(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=EL(this);this._barMark.setAnimationConfig(yL(null===(e=BR.getAnimationInKey("bar"))||void 0===e?void 0:e(i,n),_L(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;if(void 0!==this._spec.barWidth&&r===s)return xB(this._spec.barWidth,a);const o=void 0!==this._spec.barMinWidth,l=void 0!==this._spec.barMaxWidth;let h=a;return o&&(h=Math.max(h,xB(this._spec.barMinWidth,a))),l&&(h=Math.min(h,xB(this._spec.barMaxWidth,a))),h}_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=U(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=xB(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 _=yS(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}}MD.type=sk.bar,MD.mark=vM,MD.transformerConstructor=ED;const BD=()=>{CC(),wD(),BR.registerAnimation("bar",((t,e)=>({appear:AD(t,e),enter:_D(t,!1),exit:bD(t,!1),disappear:bD(t)}))),sD(),iD(),BR.registerSeries(MD.type,MD)};class RD extends fD{_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),_O(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 OD extends uD{constructor(){super(...arguments),this.transformerConstructor=RD,this.type="bar",this.seriesType=sk.bar,this._canStack=!0}}OD.type="bar",OD.seriesType=sk.bar,OD.transformerConstructor=RD;class ID extends OL{constructor(){super(...arguments),this.type=ID.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}ID.type="area";const PD=()=>{BR.registerMark(ID.type,ID),bb(),sb(),_w.registerGraphic(Ck.area,Lc),uI()};class LD extends _P{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var n,s,r,a;for(const i of U(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 DD=()=>{BR.registerAnimation("area",cI),dI(),hI()};class FD extends jL{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=ZB({},f.style,g.style),l.state=ZB({},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 jD extends ML{constructor(){super(...arguments),this.type=sk.area,this.transformerConstructor=FD,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(jD.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===BL?"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 pB(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 pB(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(yL(null===(e=BR.getAnimationInKey("line"))||void 0===e?void 0:e(s,r),_L("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(yL(null===(i=BR.getAnimationInKey("area"))||void 0===i?void 0:i(s,r),_L("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=EL(this);this._symbolMark.setAnimationConfig(yL(null===(n=BR.getAnimationInKey("scaleInOut"))||void 0===n?void 0:n(),_L("point",this._spec,this._markAttributeContext),t))}}initTooltip(){this._tooltipHelper=new LD(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}}}jD.type=sk.area,jD.mark=SM,jD.transformerConstructor=FD,W(jD,RL);class ND extends fD{_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),_O(t)}}class zD extends uD{constructor(){super(...arguments),this.transformerConstructor=ND,this.type="area",this.seriesType=sk.area,this._canStack=!0}}zD.type="area",zD.seriesType=sk.area,zD.transformerConstructor=ND;class VD extends TL{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)?U(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?U(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=U(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(U(t)),n=this.radiusAxisHelper.dataToPosition(U(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:[]};yS(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:[]};yS(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)&&CL(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 HD=(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[fk],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[fk]*t;g(e,b,i),b+=i}))}return 0!==f&&(i[i.length-1][l]=r),i};function GD(t,e,i){return(n,s,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(n,s,i)}:{overall:!1}}const WD=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:GD(t,!0,uO.appear)}),UD={type:"fadeIn"},YD=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:GD(t,!0,uO.enter)}),KD=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:GD(t,!0,uO.exit)}),XD=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:GD(t,!0,uO.exit)});function $D(t,e){if(!1===e)return{};switch(e){case"fadeIn":return UD;case"growRadius":return WD(Object.assign(Object.assign({},t),{growField:"radius"}));default:return WD(Object.assign(Object.assign({},t),{growField:"angle"}))}}class ZD extends eI{constructor(t,e){super(t,e),this.type=qD.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)=>Ut({x:0,y:0},this.getAttribute("centerOffset",e,i,n),e[bk])[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 qD extends ZD{constructor(){super(...arguments),this.type=qD.type}}qD.type="arc";const JD=()=>{bb(),ib(),_w.registerGraphic(Ck.arc,jc),aC.useRegisters([kE,wE,SE,AE]),BR.registerMark(qD.type,qD)};class QD extends wL{_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=ZB({},this._theme,i,t);const s=(t,e)=>ZB({},"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 tF extends VD{constructor(){super(...arguments),this.transformerConstructor=QD,this._pieMarkName="pie",this._pieMarkType="arc",this._startAngle=Ak,this._endAngle=kk,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this.dataToCentralPosition=t=>{const e=t[bk];if(u(e))return null;const i=this.computeDatumRadius(t),n=this.computeDatumInnerRadius(t);return Ut(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;iO(this._dataSet,"pie",HD),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:vk,asEndAngle:yk,asRatio:mk,asMiddleAngle:bk,asRadian:Sk,asQuadrant:xk,asK:_k}},!1);const e=new fi(this._dataSet,{name:`${ak}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new gL(this._option,e)}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},tF.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{morph:SL(this._spec,this._pieMarkName),defaultMorphElementKey:this._seriesField,key:GE,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 nk(vk)(t)}endAngleScale(t){return nk(yk)(t)}initMarkStyle(){const e=this._pieMark;e&&this.setMarkStyle(e,{x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:gB(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:gB(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:nk(uk).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[bk];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const n=this.computeDatumRadius(t);return Ut(this.computeCenter(t),n,i)}initAnimation(){var t,e;const i={growFrom:(t,e,i)=>{var n;if(i===uO.appear)return this._startAngle;if(i===uO.disappear)return this._endAngle;const s=[uO.disappear,uO.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[HE];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[HE]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[HE])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[HE])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+Ut({x:0,y:0},a,e[bk]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+Ut({x:0,y:0},a,e[bk]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+Ut({x:0,y:0},a,e[bk]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+Ut({x:0,y:0},a,e[bk]).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]}}tF.transformerConstructor=QD,tF.mark=kM;class eF extends tF{constructor(){super(...arguments),this.type=sk.pie}}eF.type=sk.pie;const iF=()=>{JD(),BR.registerAnimation("pie",((t,e)=>({appear:$D(t,e),enter:YD(t),exit:KD(t),disappear:XD(t)}))),BR.registerSeries(eF.type,eF)};class nF extends gD{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,n;const s=U(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 sF extends nF{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 rF extends uD{constructor(){super(...arguments),this.transformerConstructor=sF}}rF.transformerConstructor=sF;class aF extends rF{constructor(){super(...arguments),this.transformerConstructor=sF,this.type="pie",this.seriesType=sk.pie}}aF.type="pie",aF.seriesType=sk.pie,aF.transformerConstructor=sF;class oF extends gD{_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")&&ZB(e,SO(this.type,t))})),this._transformAxisSpec(t)}}class lF extends uD{constructor(){super(...arguments),this.transformerConstructor=oF,this.type="common",this._canStack=!0}}lF.type="common",lF.transformerConstructor=oF;const hF={rect:gF,symbol:uF,arc:mF,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=uF(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=cF(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),lh(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:vF,area:vF,rect3d:gF,arc3d:mF,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function cF(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}=VI(i,n,o.text,e);return h&&(o.text=h(...c,{series:a})),o}function dF(t){return d(t)?e=>t(e.data):t}function uF(t){var e,i,n;const{series:s,labelSpec:r}=t,a="horizontal"===s.direction?"right":"top",o=null!==(e=dF(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:pF(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function pF(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function gF(t){var e,i,n,s,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=dF(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:fF(o)};let g=!1;return y(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function fF(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 mF(t){var e;const{labelSpec:i}=t,n=null!==(e=dF(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 vF(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 yF extends GL{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)))}}yF.type=r.label;class _F extends eI{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=_F.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})}}_F.type="text";class bF extends _F{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}}bF.type="text",bF.constructorType="label";const xF=()=>{BR.registerMark(bF.constructorType,bF),bb(),kb(),yb(),_w.registerGraphic(Ck.text,lh)};class SF extends HL{_initTheme(t,e){return{spec:t,theme:this._theme}}}class AF extends yF{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=SF,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),ek(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=ZB({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=hF[t])&&void 0!==i?i:hF.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}:cF(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}}AF.type=r.label,AF.specKey="label",AF.transformerConstructor=SF;var kF;!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(kF||(kF={}));const wF={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class TF extends GL{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=>{this._handleIn(t),this._clickLock=this._hasActive&&this._spec.lockAfterClick,this._clickLock&&S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._clickLock=!1,this._handleOutEvent()}),this.triggerOff))},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"}:Cf(e)||Ef(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=this.trigger||"hover",e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;if(_(t)){const n=[];return t.forEach((t=>{n.push({click:"click"===t,in:i[t],out:e(t)})})),n}return[{click:"click"===t,in:i[t],out:e(t)}]}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)=>{wF[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||t.yField)&&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){DR(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=>{bS(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[0],n=e.series.dataToPosition(e.datum[0]);(p(t.dimType)?"y"===t.dimType:FR(null===(s=null==t?void 0:t.axis)||void 0===s?void 0:s.getOrient()))?a=n.y:r=n.x}else if("mark"===n){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=e.x,a=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=ik(this._regions,"cartesian");if(!e)return;const{x:i,y:n,offsetWidth:s,offsetHeight:r,bandWidth:a,bandHeight:o}=qI(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=tP(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=eP(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 ix(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(s=new nx(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 Jb(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]}}CF.specKey="crosshair",CF.type=r.cartesianCrosshair;class EF{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=YR(s,a,!0))&&void 0!==e?e:[],...null!==(i=LR(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(!bS(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=mP(n).includes(t):p(e.visible)||p(e.activeType)?d.visible=mP(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)&&(wP(n).every((t=>{var e;return!mP(null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec).includes("dimension")}))?d.visible=!1:p(e.visible)||p(e.activeType)?d.visible=mP(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=AP(t,i,n),f=kP(t,i,n),m=ZB({},P(e[t]),f),v=g.title,y=CP(void 0,m,u.shape,void 0,v);p(m.title)?m.title=xP(m.title,Object.assign(Object.assign({},v),y)):m.title=xP(v,y,!0);const _=U(g.content);if(p(m.content)){const t=TP(_);m.content=SP(m.content,(e=>CP(e,m,u.shape,t)))}else m.content=SP(_,(t=>CP(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=PP(a,t,e),l=!!p(o)&&!1!==MP(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 MF extends EF{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 BF extends EF{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 RF extends EF{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:n,series:s,dimensionInfo:r}=t,a=[{datum:U(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)?U(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 U(n);const r=s.getViewData().latestData,a=s.getSeriesField();if(!a)return r;const o=U(n)[0][a];return r.filter((t=>t[a]===o))}}const OF=t=>p(t)&&!_(t),IF=t=>p(t)&&_(t);class PF extends HL{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:n}=super._initTheme(t,e);return i.style=ZB({},this._theme,i.style),{spec:i,theme:n}}_transformSpecAfterMergingTheme(t,e,i){var n,s,r,a,o,l,h,c,d;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(n=t.visible)||void 0===n||n,t.activeType=mP(t),t.renderMode=null!==(s=t.renderMode)&&void 0!==s?s:Ef(this._option.mode)||!Tf(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=null===(d=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===d?void 0:d.getElementById(t.parentElement)):Tf(this._option.mode)&&(t.parentElement=null==wf?void 0:wf.body)}}class LF extends GL{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=PF,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._getMouseOutHandler=t=>e=>{var i,n,s;if(this._alwaysShow)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=Tf(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(!t&&this._clickLock)return;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&&OF(this._cacheInfo)?a.mark=this._showTooltipByMouseEvent("mark",i,e,t,!0):r&&IF(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),t&&this._clickLock&&(this._clickLock=!1))},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(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));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&vI.globalConfig.uniqueTooltip&&l&&vI.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._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?BP.canvas:BP.dom,s=BR.getComponentPluginInType(t);s||Sf("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 BF(this),dimension:new MF(this),group:new RF(this)}}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=U(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)),(Cf(i)||Ef(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)))}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=gP(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(IF(t)){if(OF(this._cacheInfo))return!1;const e=this._cacheInfo;if(!(e.length===t.length&&t.every(((t,i)=>RR(t,e[i])))))return!1}else{if(IF(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}}LF.type=r.tooltip,LF.transformerConstructor=PF,LF.specKey="tooltip";function DF(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=MR(t.style)),B(t.textStyle)||ZB(n.textStyle,MR(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&MR(n.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&MR(n.background.style),n}(n)),B(s.focusIconStyle)||MR(s.focusIconStyle),s.shape&&(s.shape=CR(s.shape)),s.label&&(s.label=CR(s.label)),s.value&&(s.value=CR(s.value)),s.background&&(s.background=CR(s.background)),mB(s.maxWidth)&&(s.maxWidth=Number(s.maxWidth.substring(0,s.maxWidth.length-1))*i.width/100),mB(s.width)&&(s.width=Number(s.width.substring(0,s.width.length-1))*i.width/100),mB(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)||MR(r.railStyle),B(r.sliderStyle)||MR(r.sliderStyle)):(B(r.textStyle)||MR(r.textStyle),r.handler&&CR(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(ZB(b,a.style),p(a.padding)&&(b.padding=a.padding)),b}const FF=(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},jF=(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:WE;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 NF extends GL{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:()=>{ek(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),ek(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=fB(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=U(n)),p(e)&&(this._regionUserId=U(e)),p(s)&&(this._seriesIndex=U(s)),p(i)&&(this._regionUserIndex=U(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 JO(this._option,e),this._initSelectedData(),ek(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)||(ek(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(ZB({},n,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(ZB({},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(ZB({},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}}NF.specKey="legends";class zF extends NF{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),ek(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:cO.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){iO(this._option.dataSet,"discreteLegendFilter",jF),iO(this._option.dataSet,"discreteLegendDataMake",FF);const t=new fi(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return ek(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(!Of(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=bR(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},DF(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(i),this._addLegendItemFormatMethods(i),i}_getLegendConstructor(){return KA}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(HA.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(HA.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(HA.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}=VI(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=VI(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}zF.specKey="legends",zF.type=r.discreteLegend;vI.useRegisters([()=>{CC(),EC(),PL(),FL(),dI(),hI(),sD(),iD(),BR.registerSeries(lD.type,lD),BR.registerChart(vD.type,vD)},()=>{CC(),EC(),PL(),PD(),FL(),DD(),sD(),iD(),BR.registerSeries(jD.type,jD),BR.registerChart(zD.type,zD)},()=>{BD(),BR.registerChart(OD.type,OD)},()=>{iF(),BR.registerChart(aF.type,aF)},()=>{BR.registerChart(lF.type,lF)},iD,sD,()=>{BR.registerComponent(zF.type,zF)},()=>{BR.registerComponent(LF.type,LF)},()=>{BR.registerComponent(CF.type,CF)},()=>{_w.registerGraphicComponent(Ek.label,(t=>new Fx(t))),_w.registerComponent(Ek.label,cC),xF(),UL(),BR.registerComponent(AF.type,AF,!0)},lL,CI,Nw,jw]),vI.useRegisters([()=>{Wy(Ys)}]),t.ARC_END_ANGLE=yk,t.ARC_K=_k,t.ARC_MIDDLE_ANGLE=bk,t.ARC_QUADRANT=xk,t.ARC_RADIAN=Sk,t.ARC_RATIO=mk,t.ARC_START_ANGLE=vk,t.ARC_TRANSFORM_VALUE=fk,t.AxisSyncPlugin=LI,t.BASE_EVENTS=IE,t.CORRELATION_SIZE=zE,t.CORRELATION_X=jE,t.CORRELATION_Y=NE,t.CanvasTooltipHandler=oL,t.DEFAULT_CHART_HEIGHT=lk,t.DEFAULT_CHART_WIDTH=ok,t.DEFAULT_CONICAL_GRADIENT_CONFIG=cM,t.DEFAULT_DATA_INDEX=HE,t.DEFAULT_DATA_KEY=GE,t.DEFAULT_DATA_SERIES_FIELD=WE,t.DEFAULT_GRADIENT_CONFIG=dM,t.DEFAULT_LABEL_ALIGN=ck,t.DEFAULT_LABEL_LIMIT=hk,t.DEFAULT_LABEL_TEXT=dk,t.DEFAULT_LABEL_VISIBLE=uk,t.DEFAULT_LABEL_X=pk,t.DEFAULT_LABEL_Y=gk,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_GRADIENT_CONFIG=lM,t.DEFAULT_MEASURE_CANVAS_ID=VE,t.DEFAULT_RADIAL_GRADIENT_CONFIG=hM,t.DEFAULT_SERIES_STYLE_NAME=UE,t.DomTooltipHandler=aL,t.Factory=BR,t.FormatterPlugin=TI,t.GradientType=oM,t.MediaQuery=SI,t.POLAR_DEFAULT_RADIUS=.6,t.POLAR_END_ANGLE=270,t.POLAR_END_RADIAN=kk,t.POLAR_START_ANGLE=-90,t.POLAR_START_RADIAN=Ak,t.PREFIX=ak,t.SEGMENT_FIELD_END=sM,t.SEGMENT_FIELD_START=nM,t.STACK_FIELD_END=$E,t.STACK_FIELD_END_OffsetSilhouette=QE,t.STACK_FIELD_END_PERCENT=qE,t.STACK_FIELD_KEY=KE,t.STACK_FIELD_START=XE,t.STACK_FIELD_START_OffsetSilhouette=JE,t.STACK_FIELD_START_PERCENT=ZE,t.STACK_FIELD_TOTAL=tM,t.STACK_FIELD_TOTAL_PERCENT=eM,t.STACK_FIELD_TOTAL_TOP=iM,t.ThemeManager=gR,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=vI,t.WaterfallDefaultSeriesField=FE,t.builtinThemes=nR,t.computeActualDataScheme=nB,t.darkTheme=GB,t.dataScheme=SB,t.default=vI,t.defaultThemeName=sR,t.getActualColor=rB,t.getColorSchemeBySeries=hB,t.getDataScheme=iB,t.getMergedTheme=uR,t.getTheme=hR,t.hasThemeMerged=oR,t.isColorKey=aB,t.isProgressiveDataColorScheme=oB,t.isTokenKey=zB,t.lightTheme=HB,t.queryColorFromColorScheme=sB,t.queryToken=NB,t.registerCanvasTooltipHandler=lL,t.registerChartPlugin=xI,t.registerDomTooltipHandler=()=>{rL(aL)},t.registerFormatPlugin=CI,t.registerMediaQuery=()=>{xI(SI)},t.registerTheme=lR,t.removeTheme=cR,t.themeExist=dR,t.themes=rR,t.token=VB,t.transformColorSchemeToStandardStruct=lB,t.version="1.11.5",t.vglobal=cg,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/vchart/package.json b/packages/vchart/package.json index 6fc5512b75..adff75dcbc 100644 --- a/packages/vchart/package.json +++ b/packages/vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vchart", - "version": "1.11.4", + "version": "1.11.5", "description": "charts lib based @visactor/VGrammar", "main": "cjs/index.js", "module": "esm/index.js", @@ -130,7 +130,7 @@ "@visactor/vgrammar-sankey": "0.13.10", "@visactor/vgrammar-venn": "0.13.10", "@visactor/vgrammar-util": "0.13.10", - "@visactor/vutils-extension": "workspace:1.11.4" + "@visactor/vutils-extension": "workspace:1.11.5" }, "publishConfig": { "access": "public", diff --git a/packages/vutils-extension/package.json b/packages/vutils-extension/package.json index 0f09e792d8..01597c8afa 100644 --- a/packages/vutils-extension/package.json +++ b/packages/vutils-extension/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vutils-extension", - "version": "1.11.4", + "version": "1.11.5", "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 9540b193fa..308451ccf6 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 V(t){return Object.prototype.toString.call(t)}function N(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(V(t)!==V(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=N(t),n=N(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 Vt(t){return t>=1?Et:t<=-1?-Et:Math.asin(t)}function Nt(t,e,i,s,n){let r,a;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,Ve,Ne,Ge;function We(t){return He=1/0,Ve=1/0,Ne=-1/0,Ge=-1/0,t.forEach((t=>{He>t.x&&(He=t.x),Net.y&&(Ve=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,Vi=Math.tan;function Ni(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=Ni(-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=Vs},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 Vs(){Hs(Bs,Rs)}var Ns=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(Ns)),Ns.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,Vn=Oi(30*Pi);function Nn(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=Nn(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 Vi((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,Vr(t)},Yr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Rr.DSV,Nr(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",Va="Instance",Na="Invalid";class Ga{constructor(t,e){this.id=ya.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=Na,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 No 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 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 No(t,s):new Vo(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 Vo("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){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"linearClosed":return ol(t,i)}}class hl 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 cl=["l",0,0,0,0,0,0,0];function dl(t,e,i){const s=cl[0]=t[0];if("a"===s||"A"===s)cl[1]=e*t[1],cl[2]=i*t[2],cl[3]=t[3],cl[4]=t[4],cl[5]=t[5],cl[6]=e*t[6],cl[7]=i*t[7];else if("h"===s||"H"===s)cl[1]=e*t[1];else if("v"===s||"V"===s)cl[1]=i*t[1];else for(let s=1,n=t.length;s{rt.getInstance().warn("空函数")}}),wl=Object.assign(Object.assign({},yl),{points:[],cornerRadius:0,closePath:!0}),Cl=Object.assign(Object.assign({},yl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},yl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const El=Object.assign(Object.assign({},yl),{symbolType:"circle",size:10,keepDirIn3d:!0}),Pl=Object.assign(Object.assign(Object.assign({},yl),fl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Bl=Object.assign(Object.assign(Object.assign({},yl),fl),{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}),Rl=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},yl),{fill:!0,cornerRadius:0}),Ll=Object.assign(Object.assign({},Rl),{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 Ol=new class{},Il={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"}},Dl=!0,Fl=!1,jl=/\w|\(|\)|-/,zl=/[.?!,;:/,。?!、;:]/,Hl=/\S/;function Vl(t,e,i,s,n){if(!e||e<=0)return 0;const r=Ol.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=Nl(t,a)),a}function Nl(t,e){let i=e;for(;jl.test(t[i-1])&&jl.test(t[i])||zl.test(t[i]);)if(i--,i<=0)return e;return i}function Gl(t,e){const i=Ol.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 Wl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Ul=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=Pl.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=Nl(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=Nl(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}};Ul=Wl([La()],Ul);var Yl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Kl=Symbol.for("TextMeasureContribution");let Xl=class extends Ul{};Xl=Yl([La()],Xl);const $l=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 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===Ia&&(t.cache=e,t.activated=!0)}},ql=Symbol.for("CanvasFactory"),Zl=Symbol.for("Context2dFactory");function Jl(t){return $l.getNamed(ql,Ol.global.env)(t)}const Ql=1e-4,th=Math.sqrt(3),eh=1/3;function ih(t){return t>-fh&&tfh||t<-fh}const nh=[0,0],rh=[0,0],ah=[0,0];function oh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function lh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function hh(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 ch(t){return(t%=Bt)<0&&(t+=Bt),t}function dh(t,e,i,s,n,r){if(r>e&&r>s||rn?o:0}function uh(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 mh(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(ih(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 _h=[-1,-1,-1],yh=[-1,-1];function bh(){const t=yh[0];yh[0]=yh[1],yh[1]=t}function xh(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(ih(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,eh):Math.pow(i,eh),s=s<0?-Math.pow(-s,eh):Math.pow(s,eh);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+th*Math.sin(e)))/(3*a),h=(-o+i*(s-th*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,_h);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&bh(),p=hh(e,s,r,o,yh[0]),u>1&&(g=hh(e,s,r,o,yh[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(ih(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,_h);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=lh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);_h[0]=-l,_h[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>=_h[0]+t&&a<=_h[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=_h[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 kh(t){return Math.round(t/Ct*1e8)/1e8%2*Ct}function Mh(t,e){let i=kh(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-kh(i-n)):e&&i1&&(i||(h+=dh(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;Th[0]=S,Th[1]=A,Mh(Th,Boolean(a[6])),S=Th[0],A=Th[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(mh(c,d,f,v,e,s,n))return!0}else h+=dh(c,d,f,v,s,n)||0;c=f,d=v;break;case uo.C:if(i){if(ph(c,d,f,v,_,y,b,x,e,s,n))return!0}else h+=xh(c,d,f,v,_,y,b,x,s,n)||0;c=b,d=x;break;case uo.Q:if(i){if(uh(c,d,f,v,_,y,e,s,n))return!0}else h+=Sh(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+=dh(c,d,o,l,s,n),i){if(gh(f,v,_,k,k+M,T,e,w,n))return!0}else h+=Ah(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(mh(u,p,o,p,e,s,n)||mh(o,p,o,l,e,s,n)||mh(o,l,u,l,e,s,n)||mh(u,l,u,p,e,s,n))return!0}else h+=dh(o,p,o,l,s,n),h+=dh(u,l,u,p,s,n);break;case uo.Z:if(i){if(mh(c,d,u,p,e,s,n))return!0}else h+=dh(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},Ph=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Bh=Symbol.for("VWindow"),Rh=Symbol.for("WindowHandlerContribution");let Lh=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&&($l.getNamed(Rh,t.env).configure(this,t),this.actived=!0)},this._uid=ya.GenAutoIncrementId(),this.global=Ol.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)}};Lh=Eh([La(),Ph("design:paramtypes",[])],Lh);var Oh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Dh=function(t,e){return function(i,s){e(i,s,t)}};let Fh=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=Ol.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=Ch.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:fl.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:fl.fontFamily,fontSize:fl.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=$l.get(Bh),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 jh;Fh=Oh([La(),Dh(0,Ba($a)),Dh(0,Oa(Kl)),Ih("design:paramtypes",[Object])],Fh),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(jh||(jh={}));const zh=new ae;let Hh=class{constructor(){this.matrix=new ae}init(t){return this.mode=jh.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=jh.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(zh.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(zh.a,zh.b,zh.c,zh.d,zh.e,zh.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(zh.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(zh.a,zh.b,zh.c,zh.d,zh.e,zh.f),this}scale(t,e,i){return this.mode===jh.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===jh.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return zh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(zh.a,zh.b,zh.c,zh.d,zh.e,zh.f),this}translate(t,e){return this.mode===jh.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===jh.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Hh=Oh([La(),Ih("design:paramtypes",[])],Hh);const Vh={arc:bl,area:xl,circle:Sl,line:Ml,path:Tl,symbol:El,text:Pl,rect:Cl,polygon:wl,richtext:Bl,richtextIcon:Ll,image:Rl,group:Al,glyph:kl},Nh=Object.keys(Vh);function Gh(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Wh={arc:Object.assign({},Vh.arc),area:Object.assign({},Vh.area),circle:Object.assign({},Vh.circle),line:Object.assign({},Vh.line),path:Object.assign({},Vh.path),symbol:Object.assign({},Vh.symbol),text:Object.assign({},Vh.text),rect:Object.assign({},Vh.rect),polygon:Object.assign({},Vh.polygon),richtext:Object.assign({},Vh.richtext),richtextIcon:Object.assign({},Vh.richtextIcon),image:Object.assign({},Vh.image),group:Object.assign({},Vh.group),glyph:Object.assign({},Vh.glyph)};class Uh{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Nh.forEach((t=>{this._defaultTheme[t]=Object.create(Wh[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;Nh.forEach((s=>{const n=Object.create(Wh[s]);t&&t[s]&&Gh(n,t[s]),i[s]&&Gh(n,i[s]),e[s]&&Gh(n,e[s]),this.combinedTheme[s]=n})),e.common&&Nh.forEach((t=>{Gh(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 Yh=new Uh;function Kh(t,e){return t.glyphHost?Kh(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)):Yh.getTheme()}return null}(t)||t.attachedThemeGraphic&&Kh(t.attachedThemeGraphic)||Yh.getTheme()}var Xh=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 $h 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 Xh(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 Jh))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(ic(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 Jh))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=ic(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 Jh))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=ic(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 Jh))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=ic(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 Jh))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=ec.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(ic(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(ic(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,ic(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 Jh))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"):ic(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 Qh))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=ec.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 sc(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 Jh,this.rootWheelEvent=new Qh,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 oc{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return oc.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 lc{static Avaliable(){return!0}avaliable(){return lc.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 hc{static Avaliable(){return!!Ol.global.getRequestAnimationFrame()}avaliable(){return hc.Avaliable()}tick(t,e){Ol.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var cc;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(cc||(cc={}));class dc{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-dc.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*dc.bounceIn(2*t):.5*dc.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}}}dc.quadIn=dc.getPowIn(2),dc.quadOut=dc.getPowOut(2),dc.quadInOut=dc.getPowInOut(2),dc.cubicIn=dc.getPowIn(3),dc.cubicOut=dc.getPowOut(3),dc.cubicInOut=dc.getPowInOut(3),dc.quartIn=dc.getPowIn(4),dc.quartOut=dc.getPowOut(4),dc.quartInOut=dc.getPowInOut(4),dc.quintIn=dc.getPowIn(5),dc.quintOut=dc.getPowOut(5),dc.quintInOut=dc.getPowInOut(5),dc.backIn=dc.getBackIn(1.7),dc.backOut=dc.getBackOut(1.7),dc.backInOut=dc.getBackInOut(1.7),dc.elasticIn=dc.getElasticIn(1,.3),dc.elasticOut=dc.getElasticOut(1,.3),dc.elasticInOut=dc.getElasticInOut(1,.3*1.5);class uc{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 pc=new uc;class gc{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(){}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 mc extends gc{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let fc=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]:pc;this.id=t,this.timeline=e,this.status=So.INITIAL,this.tailAnimate=new vc(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.duration===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 mc((()=>{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 vc(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()}};fc.mode=Ao.NORMAL,fc.interpolateMap=new Map;class vc{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 _c(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?dc[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?dc[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 _c(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 _c{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 yc=200,bc="cubicOut",xc=1e3,Sc="quadInOut";var Ac;!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"}(Ac||(Ac={}));const kc=[!1,!1,!1,!1],Mc=[0,0,0,0],Tc=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Mc[0]=t[0],Mc[2]=t[0],Mc[1]=t[1],Mc[3]=t[1],Mc):t:t:0,wc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Cc=[1,2,3,0,1,2,3,0];function Ec(t,e,i,s){for(;t>=Bt;)t-=Bt;for(;t<0;)t+=Bt;for(;t>e;)e+=Bt;wc[0].x=i,wc[1].y=i,wc[2].x=-i,wc[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]:Oc.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)}}Oc.TimeOut=1e3/60;const Ic=new Oc,Dc=(t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class Fc extends gc{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 jc;!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"}(jc||(jc={}));class zc extends gc{constructor(t,e,i,s,n){super(t,e,i,s,n),this.newPointAnimateType="appear"===(null==n?void 0:n.newPointAnimateType)?"appear":"grow"}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}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?[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=Pc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),i.points=this.points}}class Hc extends gc{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 Vc extends Hc{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=Ol.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 Nc extends Hc{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=Ol.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 Gc extends gc{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 Wc extends gc{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?dc[n]:n;e=r(e),s.onUpdate(t,e,i)})),this.updating=!1)}}function Uc(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 Yc(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 Jc(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 Qc(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 id(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}))),rd=(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]},ad=(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 rd(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return rd(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);ad(n[0],s,i),ad(n[1],e-s,i)}};var od;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(od||(od={}));class ld{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:od.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===od.Color1){const e=ld.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];ld.store1[t]=e,ld.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=ld.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&&(ld.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],ld.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===od.Color1){if(ld.store1[t])return;ld.store1[t]=i,ld.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(ld.store255[t])return;ld.store255[t]=i,ld.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function hd(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 cd(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)=>dd(y(t)?t[r]:t,y(e)?e[r]:e,i,s))):dd(t,e,i,s,n)}function dd(t,e,i,s,n){if(!t||!e)return t&&hd(t)||e&&hd(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=ld.Get(t,od.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=ld.Get(e,od.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:hd(a)})))});return o?cd(r,l,i,s,n):cd(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:gd(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:gd(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:gd(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),hd(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)}ld.store255={},ld.store1={};const ud=[0,0,0,0],pd=[0,0,0,0];function gd(t,e,i){return ld.Get(t,od.Color255,ud),ld.Get(e,od.Color255,pd),`rgba(${Math.round(ud[0]+(pd[0]-ud[0])*i)},${Math.round(ud[1]+(pd[1]-ud[1])*i)},${Math.round(ud[2]+(pd[2]-ud[2])*i)},${ud[3]+(pd[3]-ud[3])*i})`}const md=(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=cd(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},fd=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?Jc(t):[],n=Jc(e);i&&s&&(i.fromTransform&&Qc(s,i.fromTransform.clone().getInverse()),Qc(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})))},_d=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],yd=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!_d.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]?ld.Get(t[n],od.Color255):t[n],to:"string"==typeof r?ld.Get(r,od.Color255):r,key:n}):i.push({from:t[n],to:r,key:n}),s=!0)})),s?i:null};class bd extends gc{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;fd(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&md(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const xd=(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=vd(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=yd(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 bd({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:xc,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Sc)),c};class Sd extends gc{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;fd(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&&md(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Ad=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Rc.includes(t))(i)||(e[i]=t[i])})),e},kd=(t,e,i)=>{const s=Ad(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=Ol.graphicService.creator.rect({x:0,y:0,width:a,height:o});n.appendChild(i),e.push(i)}))}},Md=(t,e,i)=>{const s=[],n=i?null:Ad(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Ad(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=ed(t.attribute),n=id(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(Ol.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=id(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(Ol.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=id(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(Ol.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 sd(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 sd(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(Ol.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:nd(i)}];const s=[];return ad(i,e,s),s})(t,e).forEach((t=>{s.push(Ol.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 ad(r,e,h),h})(t,e).forEach((t=>{s.push(Ol.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=Jc(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(Ol.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(Ol.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&kd(t,s,e),s};class wd{static GetImage(t,e){var i;const s=wd.cache.get(t);s?"fail"===s.loadState?Ol.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):wd.loadImage(t,e)}static GetSvg(t,e){var i;let s=wd.cache.get(t);s?"fail"===s.loadState?Ol.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"},wd.cache.set(t,s),s.dataPromise=Ol.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=wd.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"},wd.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Ol.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Ol.global.loadBlob(t):"json"===e&&(i.dataPromise=Ol.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!wd.isLoading&&wd.toLoadAueue.length){wd.isLoading=!0;const t=wd.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(wd.cache.set(i,n),n.dataPromise=Ol.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((()=>{wd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),wd.loading()})).catch((t=>{console.error(t),wd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),wd.loading()}))}}),0)}static loadImage(t,e){const i=Cd(t,wd.toLoadAueue);if(-1!==i)return wd.toLoadAueue[i].marks.push(e),void wd.loading();wd.toLoadAueue.push({url:t,marks:[e]}),wd.loading()}static improveImageLoading(t){const e=Cd(t,wd.toLoadAueue);if(-1!==e){const t=wd.toLoadAueue.splice(e,1);wd.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Cd(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;Id.x=n+(null!==(i=t.scrollX)&&void 0!==i?i:0),Id.y=r+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else Id.x=n,Id.y=r;return Id}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Ol.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Ol.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]:Bd;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Bd;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(Ol.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:yc,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:bc),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 Pd.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(Pd),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=ul.x,y:e=ul.y,scaleX:i=ul.scaleX,scaleY:s=ul.scaleY,angle:n=ul.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),Ol.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(ul);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Ed.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),Ol.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=cd(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=cd(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=cd(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 Kh(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:Ol.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 hl).fromString(t):this.pathProxy=new hl,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",Ol.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new tc(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)}}}Fd.mixin(nc);class jd{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 zd(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Hd(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 Vd=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class Nd{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=Hd(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=zd(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Hd(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 jd(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 jd(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 Gd(t,e){return Wd(t)}function Wd(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 qd=0;function Zd(){return qd++}var Jd;function Qd(t){const e=[];let i=0,s="";for(let n=0;ntu.set(t,!0)));const eu=new Map;function iu(t){if(tu.has(t))return!0;if(eu.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>eu.set(t,!0)));const su=Zd(),nu=Zd(),ru=Zd(),au=Zd(),ou=Zd(),lu=Zd(),hu=Zd(),cu=Zd(),du=Zd(),uu=Zd();Zd();const pu=Zd();Zd();const gu=Zd(),mu=Zd(),fu=Zd(),vu=Symbol.for("GraphicService"),_u=Symbol.for("GraphicCreator"),yu={"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"},bu=Object.keys(yu);var xu;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(xu||(xu={}));let Su=class t extends Fd{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=lu,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 Uh),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Uh)}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;Ol.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),Ol.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=ul.x,y:e=ul.y,dx:i=ul.dx,dy:s=ul.dy,scaleX:n=ul.scaleX,scaleY:r=ul.scaleY,angle:a=ul.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=Kh(this).group;this._AABBBounds.clear();const i=Ol.graphicService.updateGroupAABBBounds(t,e,this._AABBBounds,this),{boundsPadding:s=e.boundsPadding}=t,n=Tc(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(),Ol.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Ol.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,Ol.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{Ol.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),Ol.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=Ol.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 Au(t){return new Su(t)}Su.NOWORK_ANIMATE_ATTR=Dd;class ku extends Su{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 Uh,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=>{Ol.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=>{Ol.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 Mu=Symbol.for("TransformUtil"),Tu=Symbol.for("GraphicUtil"),wu=Symbol.for("LayerService"),Cu=Symbol.for("StaticLayerHandlerContribution"),Eu=Symbol.for("DynamicLayerHandlerContribution"),Pu=Symbol.for("VirtualLayerHandlerContribution");var Bu,Ru=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Lu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ou=Bu=class{static GenerateLayerId(){return`${Bu.idprefix}_${Bu.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Ol.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?$l.get(Cu):"dynamic"===t?$l.get(Eu):$l.get(Pu),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 ku(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Bu.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)}};Ou.idprefix="visactor_layer",Ou.prefix_count=0,Ou=Bu=Ru([La(),Lu("design:paramtypes",[])],Ou);var Iu=new ba((t=>{t(eo).to(ro).inSingletonScope(),t(Bh).to(Lh),t(Tu).to(Fh).inSingletonScope(),t(Mu).to(Hh).inSingletonScope(),t(wu).to(Ou).inSingletonScope()}));function Du(t,e){return!(!t&&!e)}function Fu(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function ju(t,e,i){return i&&t*e>0}function zu(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Hu(t,e){return t*e>0}function Vu(t,e,i,s){return t*e>0&&0!==i&&0!==s}function Nu(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 Wu(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(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:m,outerEndAngle:f,innerEndAngle:v,innerStartAngle:_}=t.getParsePadAngle(o,l),y=u,b=u,x=u,S=u,A=Math.max(b,y),k=Math.max(x,S);let M=A,T=k;const w=n*Ot(m),C=n*Ft(m),E=r*Ot(v),P=r*Ft(v);let B,R,L,O;if((k>wt||A>wt)&&(B=n*Ot(f),R=n*Ft(f),L=r*Ot(_),O=r*Ft(_),hwt){const t=Dt(y,M),r=Dt(b,M),o=Gu(L,O,w,C,n,t,Number(c)),l=Gu(B,R,E,P,n,r,Number(c));M0&&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+B,s+n*Ft(f))}else!a||a[0]?(e.moveTo(i+w,s+C),e.arc(i,s,n,m,f,!c)):e.moveTo(i+n*Ot(f),s+n*Ft(f));if(!(r>wt)||g<.001)!a||a[1]?e.lineTo(i+E,s+P):e.moveTo(i+E,s+P),d=!0;else if(T>wt){const t=Dt(S,T),n=Dt(x,T),o=Gu(E,P,B,R,r,-n,Number(c)),l=Gu(w,C,L,O,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),T0&&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+L,s+O)}else!a||a[1]?e.lineTo(i+E,s+P):e.moveTo(i+E,s+P),!a||a[2]?e.arc(i,s,r,v,_,c):e.moveTo(i+r*Ot(_),s+r*Ft(_))}return a?a[3]&&e.lineTo(i+n*Ot(o),s+n*Ft(o)):e.closePath(),d}class Uu{static GetCanvas(){try{return Uu.canvas||(Uu.canvas=Ol.global.createCanvas({})),Uu.canvas}catch(t){return null}}static GetCtx(){if(!Uu.ctx){const t=Uu.GetCanvas();Uu.ctx=t.getContext("2d")}return Uu.ctx}}class Yu extends oe{static getInstance(){return Yu._instance||(Yu._instance=new Yu),Yu._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=Uu.GetCanvas(),s=Uu.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 Yu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Ku{static GetSize(t){for(let e=0;e=t)return Ku.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Ku.GenKey(t,e,i,s,n),l=Ku.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=Ku.GenKey(t,e,i,s,n);Ku.cache[l]?Ku.cache[l].push({width:a,height:o,pattern:r}):Ku.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}Ku.cache={},Ku.ImageSize=[20,40,80,160,320,640,1280,2560];const Xu=Symbol.for("ArcRenderContribution"),$u=Symbol.for("AreaRenderContribution"),qu=Symbol.for("CircleRenderContribution"),Zu=Symbol.for("GroupRenderContribution"),Ju=Symbol.for("ImageRenderContribution"),Qu=Symbol.for("PathRenderContribution"),tp=Symbol.for("PolygonRenderContribution"),ep=Symbol.for("RectRenderContribution"),ip=Symbol.for("SymbolRenderContribution"),sp=Symbol.for("TextRenderContribution"),np=Symbol.for("InteractiveSubRenderContribution"),rp=["radius","startAngle","endAngle",...Bd];class ap extends Fd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=au}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=Kh(this).circle;this._AABBBounds.clear();const i=this.attribute,s=Ol.graphicService.updateCircleAABBBounds(i,Kh(this).circle,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Tc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Kh(this).circle[t]}needUpdateTags(t){return super.needUpdateTags(t,rp)}needUpdateTag(t){return super.needUpdateTag(t,rp)}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 hl;return o.arc(0,0,n,r,a),o}clone(){return new ap(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ap.NOWORK_ANIMATE_ATTR}}function op(t){return new ap(t)}function lp(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 hp(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function cp(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)}ap.NOWORK_ANIMATE_ATTR=Dd;class dp{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=fu,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=Kh(this).text;this._AABBBounds.clear();const e=this.attribute,i=Ol.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=this.attribute,n=Tc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}updateWrapAABBBounds(t){var e,i,s,n;const r=Kh(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=Dc(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=Ol.graphicUtil.textMeasure,k=new dp(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===Jd.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=hp(x,o),M=cp(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=Kh(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=Dc(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 _=Ol.graphicUtil.textMeasure,y=new dp(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=Kh(this).text,a=Ol.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=Dc(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=hp(x,o),e=this.cache.verticalList.length*b,i=cp(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=>Qd(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===Jd.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=hp(x,o),M=this.cache.verticalList.length*b,T=cp(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 Kh(this).text[t]}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:up;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:up;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function gp(t){return new pp(t)}pp.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Dd),pp.baselineMapAlign={top:"left",bottom:"right",middle:"center"},pp.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class mp{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 fp(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 vp=new class extends mp{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 fp(t,e/2,i,s,n)}drawOffset(t,e,i,s,n,r){return fp(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 _p=new class extends mp{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 yp(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 bp=new class extends mp{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 yp(t,e/2,i,s,n)}drawFitDir(t,e,i,s,n){return yp(t,e/2,i,s,n)}drawOffset(t,e,i,s,n,r){return yp(t,e/2+n,i,s,r)}};function xp(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Sp=new class extends mp{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return xp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return xp(t,e/2+n,i,s)}};class Ap extends mp{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 kp=new Ap;var Mp=new class extends Ap{constructor(){super(...arguments),this.type="triangle"}};const Tp=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),wp=Math.sin(Pt/10)*Tp,Cp=-Math.cos(Pt/10)*Tp;function Ep(t,e,i,s){const n=wp*e,r=Cp*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 Pp=new class extends mp{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 Ep(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Ep(t,e/2+n,i,s)}};const Bp=jt(3);function Rp(t,e,i,s){const n=e,r=n/Bp,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 Lp=new class extends mp{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 Rp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Rp(t,e/2+n,i,s)}};function Op(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 Ip=new class extends mp{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}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)}};function Dp(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Fp=new class extends mp{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}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)}};const jp=-.5,zp=jt(3)/2,Hp=1/jt(12);function Vp(t,e,i,s){const n=e/2,r=e*Hp,a=n,o=e*Hp+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(jp*n-zp*r+i,zp*n+jp*r+s),t.lineTo(jp*a-zp*o+i,zp*a+jp*o+s),t.lineTo(jp*l-zp*h+i,zp*l+jp*h+s),t.lineTo(jp*n+zp*r+i,jp*r-zp*n+s),t.lineTo(jp*a+zp*o+i,jp*o-zp*a+s),t.lineTo(jp*l+zp*h+i,jp*h-zp*l+s),t.closePath(),!1}var Np=new class extends mp{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 Vp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Vp(t,e/2+n,i,s)}};var Gp=new class extends mp{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 Wp=new class extends mp{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 Up=new class extends mp{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 Yp=jt(3);function Kp(t,e,i,s){const n=e*Yp;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Xp=new class extends Ap{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Kp(t,e/2/Yp,i,s)}drawOffset(t,e,i,s,n){return Kp(t,e/2/Yp+n,i,s)}};function $p(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 qp=new class extends mp{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 $p(t,e/4,i,s)}drawOffset(t,e,i,s,n){return $p(t,e/4+n,i,s)}};function Zp(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 Jp=new class extends mp{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 Zp(t,e/4,i,s)}drawOffset(t,e,i,s,n){return Zp(t,e/4+n,i,s)}};function Qp(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 tg=new class extends mp{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 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-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var ig=new class extends mp{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 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,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var ng=new class extends mp{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return sg(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return sg(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 rg(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var ag=new class extends mp{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return rg(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return rg(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 og(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 lg=new class extends mp{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 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-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function hg(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function cg(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var dg=new class extends mp{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)?cg(t,e,i,s):hg(t,e,i,s)}drawOffset(t,e,i,s,n){return S(e)?cg(t,e+2*n,i,s):hg(t,[e[0]+2*n,e[1]+2*n],i,s)}};const ug=new Jt;class pg{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;ug.x1=s.bounds.x1*t,ug.y1=s.bounds.y1*t,ug.x2=s.bounds.x2*t,ug.y2=s.bounds.y2*t,e.union(ug)}))}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 gg={};[vp,_p,bp,Sp,Xp,Mp,Pp,Lp,Ip,Fp,Np,Gp,Wp,kp,Up,qp,Jp,tg,ig,dg,ng,ag,lg].forEach((t=>{gg[t.type]=t}));const mg={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"},fg=new Jt,vg=["symbolType","size",...Bd];let _g=class t extends Fd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=mu}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=Kh(this).symbol;let{symbolType:i=e.symbolType}=this.attribute,s=gg[i];if(s)return this._parsedPath=s,s;if(s=t.userSymbolMap[i],s)return this._parsedPath=s,s;if(i=mg[i]||i,!0===((n=i).startsWith("{const e=(new hl).fromString(t.d),i={};bu.forEach((e=>{t[e]&&(i[yu[e]]=t[e])})),r.push({path:e,attribute:i}),fg.union(e.bounds)}));const a=fg.width(),o=fg.height(),l=1/It(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new pg(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var n;const r=(new hl).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 pg(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=Kh(this).symbol;this._AABBBounds.clear();const i=this.attribute,s=Ol.graphicService.updateSymbolAABBBounds(i,Kh(this).symbol,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Tc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Kh(this).symbol[t]}needUpdateTags(t){return super.needUpdateTags(t,vg)}needUpdateTag(t){return super.needUpdateTag(t,vg)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new hl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new hl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function yg(t){return new _g(t)}_g.userSymbolMap={},_g.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Dd);const bg=["segments","points","curveType",...Bd];let xg=class t extends Fd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",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||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Bc(i,s,e))}doUpdateAABBBounds(){const t=Kh(this).line;this._AABBBounds.clear();const e=this.attribute,i=Ol.graphicService.updateLineAABBBounds(e,Kh(this).line,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Tc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Kh(this).line[t]}needUpdateTags(t){return super.needUpdateTags(t,bg)}needUpdateTag(t){return super.needUpdateTag(t,bg)}toCustomPath(){const t=this.attribute,e=new hl,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 Sg(t){return new xg(t)}xg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Dd);const Ag=["width","x1","y1","height","cornerRadius",...Bd];class kg extends Fd{constructor(t){super(t),this.type="rect",this.numberType=pu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}doUpdateAABBBounds(){const t=Kh(this).rect;this._AABBBounds.clear();const e=this.attribute,i=Ol.graphicService.updateRectAABBBounds(e,Kh(this).rect,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Tc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Kh(this).rect[t]}needUpdateTags(t){return super.needUpdateTags(t,Ag)}needUpdateTag(t){return super.needUpdateTag(t,Ag)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:s,height:n}=ed(t),r=new hl;return r.moveTo(e,i),r.rect(e,i,s,n),r}clone(){return new kg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return kg.NOWORK_ANIMATE_ATTR}}function Mg(t){return new kg(t)}kg.NOWORK_ANIMATE_ATTR=Dd;class Tg extends Fd{constructor(t){super(t),this.type="glyph",this.numberType=ou,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=Ol.graphicService.updateGlyphAABBBounds(this.attribute,Kh(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 Tg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Tg.NOWORK_ANIMATE_ATTR}}function wg(t){return new Tg(t)}Tg.NOWORK_ANIMATE_ATTR=Dd;class Cg{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=Il[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 Eg{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const s=Dc(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}=Gl(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}=Gl(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=Vl(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}=Gl(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||Fl;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||Dl;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=Vl(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Gl(this.text.slice(t),this.character);return i+this.ellipsisWidth-s}return i}}const Pg=["width","height","image",...Bd];class Bg extends Fd{constructor(t){super(t),this.type="image",this.numberType=hu,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=Kh(this).image;this._AABBBounds.clear();const e=this.attribute,i=Ol.graphicService.updateImageAABBBounds(e,Kh(this).image,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Tc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Rl[t]}needUpdateTags(t){return super.needUpdateTags(t,Pg)}needUpdateTag(t){return super.needUpdateTag(t,Pg)}clone(){return new Bg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Bg.NOWORK_ANIMATE_ATTR}}function Rg(t){return new Bg(t)}Bg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Dd);class Lg extends Bg{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=Tc(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=Tc(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=Rl.width,height:e=Rl.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 Og{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 Lg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=Il[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Eg){const e=Hl.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 Lg)break;if("vertical"===this.direction&&"vertical"!==s.direction){s.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";s.ellipsisStr=r;const{width:a}=Gl(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 Lg)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 Lg)break;const{width:n}=Gl(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 Lg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Ig{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=Il[this.direction]}store(t){if(t instanceof Lg){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 Og(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 Lg?"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=Vl(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 Eg(i,t.newLine,t.character),new Eg(s,!0,t.character)]}(t,s);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const Dg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...Bd];class Fg extends Fd{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=gu}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Bl.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:Bl.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:Bl.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:Bl.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:Bl.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:Bl.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:Bl.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:Bl.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=Kh(this).richtext;this._AABBBounds.clear();const e=this.attribute,i=Ol.graphicService.updateRichTextAABBBounds(e,Kh(this).richtext,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Tc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Bl[t]}needUpdateTags(t){return super.needUpdateTags(t,Dg)}needUpdateTag(t){return super.needUpdateTag(t,Dg)}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(){var t;const{textConfig:e=[],maxWidth:i,maxHeight:s,width:n,height:r,ellipsis:a,wordBreak:o,verticalDirection:l,textAlign:h,textBaseline:c,layoutDirection:d,singleLine:u,disableAutoWrapLine:p}=this.attribute,g=[];for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,g.push(t)}}else{const i=this.combinedStyleToCharacter(e[t]);if(S(i.text)&&(i.text=`${i.text}`),i.text&&i.text.includes("\n")){const t=i.text.split("\n");for(let e=0;e0,f="number"==typeof s&&Number.isFinite(s)&&s>0,v="number"==typeof n&&Number.isFinite(n)&&n>0&&(!m||n<=i),_="number"==typeof r&&Number.isFinite(r)&&r>0&&(!f||r<=s),y=new Cg(0,0,(v?n:m?i:0)||0,(_?r:f?s:0)||0,a,o,l,h,c,d||"horizontal",!v&&m,!_&&f,u||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),b=new Ig(y);if(p){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 Fg.NOWORK_ANIMATE_ATTR}}function jg(t){return new Fg(t)}Fg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Dd);const zg=["path","customPath",...Bd];class Hg extends Fd{constructor(t){super(t),this.type="path",this.numberType=du}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=Kh(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof hl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof hl?this.cache:t.path)}doUpdateAABBBounds(){const t=Kh(this).path;this.doUpdatePathShape(),this._AABBBounds.clear();const e=this.attribute,i=Ol.graphicService.updatePathAABBBounds(e,Kh(this).path,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Tc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new hl).fromString(t.path):t.customPath&&(this.cache=new hl,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Kh(this).path[t]}needUpdateTags(t){return super.needUpdateTags(t,zg)}needUpdateTag(t){return super.needUpdateTag(t,zg)}toCustomPath(){return(new hl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Hg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Hg.NOWORK_ANIMATE_ATTR}}function Vg(t){return new Hg(t)}Hg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Dd);const Ng=["segments","points","curveType",...Bd];class Gg extends Fd{constructor(t){super(t),this.type="area",this.numberType=ru}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=Kh(this).area;this._AABBBounds.clear();const e=this.attribute,i=Ol.graphicService.updateAreaAABBBounds(e,Kh(this).area,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Tc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Bc(i,s,e))}getDefaultAttribute(t){return Kh(this).area[t]}needUpdateTags(t){return super.needUpdateTags(t,Ng)}needUpdateTag(t){return super.needUpdateTag(t,Ng)}toCustomPath(){const t=new hl,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 Gg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Gg.NOWORK_ANIMATE_ATTR}}function Wg(t){return new Gg(t)}Gg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Dd);const Ug=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Bd];class Yg extends Fd{constructor(t){super(t),this.type="arc",this.numberType=su}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=Kh(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);return Math.min(S(e,!0)?e:a*parseFloat(e)/100,a/2)}getParsedAngle(){const t=Kh(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=Kh(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=Vt(Number(l)/o*Ft(g)),n=Vt(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=Kh(this).arc;this._AABBBounds.clear();const i=this.attribute,s=Ol.graphicService.updateArcAABBBounds(i,Kh(this).arc,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Tc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return super.needUpdateTags(t,Ug)}needUpdateTag(t){return super.needUpdateTag(t,Ug)}getDefaultAttribute(t){return Kh(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 Yg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Yg.NOWORK_ANIMATE_ATTR}}function Kg(t){return new Yg(t)}Yg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Dd);const Xg=["points","cornerRadius",...Bd];class $g extends Fd{constructor(t){super(t),this.type="polygon",this.numberType=uu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=Kh(this).polygon;this._AABBBounds.clear();const e=this.attribute,i=Ol.graphicService.updatePolygonAABBBounds(e,Kh(this).polygon,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Tc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Bc(i,s,e))}getDefaultAttribute(t){return Kh(this).polygon[t]}needUpdateTags(t){return super.needUpdateTags(t,Xg)}needUpdateTag(t){return super.needUpdateTag(t,Xg)}toCustomPath(){const t=this.attribute.points,e=new hl;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 $g(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return $g.NOWORK_ANIMATE_ATTR}}function qg(t){return new $g(t)}$g.NOWORK_ANIMATE_ATTR=Dd;class Zg extends Su{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 Jg(t){return new Zg(t)}class Qg{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 tm extends Qg{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;$d(i,s+(r+o)/2,!0,a)}return i}}class em{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 em.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},rm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},am=function(t,e){return function(i,s){e(i,s,t)}};function om(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 lm(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 hm(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 cm(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),om(t,t,[n+o,r+l,a+h]),om(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),om(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=sm.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]}om(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),om(i,i,[-s[0],-s[1],0]),hm(t,t,i)}}let dm=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 Qg],this._symbolBoundsContribitions=[new tm],this._imageBoundsContribitions=[new Qg],this._circleBoundsContribitions=[new Qg],this._arcBoundsContribitions=[new Qg],this._pathBoundsContribitions=[new Qg]}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,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}=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 h=this.tempAABBBounds1,c=this.tempAABBBounds2;return h.setValue(i.x1,i.y1,i.x2,i.y2),c.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=cp(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=hp(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){$d(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}=t,r=i;return n.forEach((t=>{r.add(t.x,t.y)})),r}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{r.add(t.x,t.y)}))})),r}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):Ec(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):(Ec(h,l,n,i),Ec(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){$d(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;$d(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)}};dm=nm([La(),am(0,Ba(_u)),rm("design:paramtypes",[Object])],dm);const um=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 pm,gm;function mm(t){return pm||(pm=um.CreateGraphic("text",{})),pm.initAttributes(t),pm.AABBBounds}const fm={x:0,y:0,z:0,lastModelMatrix:null};class vm{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=ju(o,l,n),p=Hu(o,c),g=Du(n,r),m=Fu(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;fm.x=n,fm.y=r,fm.z=a,fm.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=sm.allocate(),n=sm.allocate();cm(n,t,e),hm(s,d||s,n),fm.x=0,fm.y=0,fm.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),sm.free(n)}if(g&&!d){const s=t.getOffsetXY(e);fm.x+=s.x,fm.y+=s.y,fm.z=a,i.setTransformForCurrent()}else if(p)fm.x=0,fm.y=0,fm.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);fm.x+=s.x,fm.y+=s.y,this.transformWithoutTranslate(i,fm.x,fm.y,fm.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),fm.x=0,fm.y=0,fm.z=0;return fm}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=Kh(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,_=ju(d,u,h),y=Hu(d,g),b=Du(h),x=Fu(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&&sm.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}const _m=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 ym{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(ym.IsGradientStr(t))try{const e=_m(t)[0];if(e){if("linear"===e.type)return ym.ParseLinear(e);if("radial"===e.type)return ym.ParseRadial(e);if("conic"===e.type)return ym.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 bm(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 xm(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 Sm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},km=function(t,e){return function(i,s){e(i,s,t)}};class Mm{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=Kh(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=Ch.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),Ch.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 Tm=new Mm;let wm=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)}))}};wm=Sm([La(),km(0,Ba($a)),km(0,Oa(np)),Am("design:paramtypes",[Object])],wm);class Cm{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=Ch.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])),Ch.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 Em=new Cm;const Pm=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=bm(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T+r,innerRadius:M-r,startAngle:_-a,endAngle:y+a}),e.beginPath(),Wu(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=bm(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T-r,innerRadius:M+r,startAngle:_+a,endAngle:y-a}),e.beginPath(),Wu(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})}},Bm=Em,Rm=Tm;const Lm=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=bm(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=bm(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()}}}},Om=Em,Im=Tm;const Dm=new class extends Mm{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()}},Fm=Ct/2;function jm(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],-Fm,0,!1)}if(t.lineTo(_[0],_[1]),!q(v,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,Fm,!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],Fm,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+Fm,!1)}return t.closePath(),t}var zm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Hm{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=bm(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(),jm(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=bm(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(),jm(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 Vm=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)}};Vm=zm([La()],Vm);let Nm=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()}}};Nm=zm([La()],Nm);const Gm=new Hm,Wm=Em,Um=Tm;const Ym=new class extends Hm{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)}},Km=new class extends Mm{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=Kh(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=Tc(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?jm(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 Xm=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=bm(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=bm(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()}}}},$m=Em,qm=Tm;var Zm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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,s){e(i,s,t)}};let tf=class extends vm{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=su,this.builtinContributions=[Pm,Rm,Bm],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||T>wt)&&(O=n*Ot(y),I=n*Ft(y),D=r*Ot(x),F=r*Ft(x),uwt){const t=Dt(S,C),r=Dt(A,C),a=Gu(D,F,P,B,n,t,Number(p)),o=Gu(O,I,R,L,n,r,Number(p));if(C0&&e.arc(i+o.cx,s+o.cy,r,Lt(o.y11,o.x11),Lt(o.y01,o.x01),!p)}}else e.moveTo(i+P,s+B);if(!(r>wt)||v<.001)e.lineTo(i+R,s+L),g=!0;else if(E>wt){const t=Dt(M,E),n=Dt(k,E),a=Gu(R,L,O,I,r,-n,Number(p)),o=Gu(P,B,D,F,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),E0&&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(x),s+r*Ft(x));return g}drawShape(t,e,i,s,n,r,a,o){const l=Kh(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++)kc[s]=t,i&&(i=!(null!==(e=kc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)kc[e]=!!t[e],i&&(i=!!kc[e]);else kc[0]=!1,kc[1]=!1,kc[2]=!1,kc[3]=!1;return{isFullStroke:i,stroke:kc}})(d);if((v||C)&&(e.beginPath(),Wu(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(),Wu(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),cd(o.color,l.color,h,!1)}(0,0,h,n);a||ju&&(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=Kh(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}};tf=Zm([La(),Qm(0,Ba($a)),Qm(0,Oa(Xu)),Jm("design:paramtypes",[Object])],tf);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 vm{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=au,this.builtinContributions=[Lm,Im,Om],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Kh(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=Kh(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function af(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 of(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),af(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 hf=class extends vm{constructor(){super(...arguments),this.numberType=cu}draw(t,e,i,s){const n=Kh(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;of(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(),of(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"===f)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=ll(t.points,f,{startPoint:e});return s=n,n})).filter((t=>!!t)),"linearClosed"===f){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===v){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],v,_,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=v*r;let g=0,m=!1;t.cache.forEach(((r,f)=>{if(m)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(m=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[f],[l,t.attribute],Dt(y,1),_,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,v,_,i,s,t,a,o)}};function cf(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 df(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),af(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),af(t,l,1,s),o=!1):o=!0}t.closePath()}hf=lf([La()],hf);const uf=new class extends Cm{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:Lc(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Lc(l,"textureColor")),textureSize:b=(null!==(m=t.attribute.textureSize)&&void 0!==m?m:Lc(l,"textureSize")),texturePadding:x=(null!==(f=t.attribute.texturePadding)&&void 0!==f?f:Lc(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},pf=Tm;var gf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ff=function(t,e){return function(i,s){e(i,s,t)}};function vf(t,e,i){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"linearClosed":return ol(t,i)}}let _f=class extends vm{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=ru,this.builtinContributions=[uf,pf],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=Kh(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}=t.attribute,b=this.valid(t,g,a,o);if(!b)return;const{doFill:x,doStroke:S}=b,{clipRange:A=g.clipRange,closePath:k,points:M,segments:T}=t.attribute;let{curveType:w=g.curveType}=t.attribute;if(k&&"linear"===w&&(w="linearClosed"),1===A&&!T&&!M.some((t=>!1===t.defined))&&"linear"===w)return this.drawLinearAreaHighPerformance(t,e,!!m,S,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(T&&T.length){let e,i;const s=T.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=vf(t.points,w,{startPoint:e});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=T.length-1;t>=0;t--){const e=T[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=T[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=vf(i,"stepBefore"===w?"stepAfter":"stepAfter"===w?"stepBefore":w),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!M||!M.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=M,i=[];for(let t=M.length-1;t>=0;t--)i.push({x:null!==(u=M[t].x1)&&void 0!==u?u:M[t].x,y:null!==(p=M[t].y1)&&void 0!==p?p:M[t].y});const s=vf(e,w),n=vf(i,"stepBefore"===w?"stepAfter":"stepAfter"===w?"stepBefore":w);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===A){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,x,v,S,y,r[c],[g,t.attribute],A,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=A*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,x,v,S,y,r[u],[g,t.attribute],Dt(m,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,x,v,S,y,t.attribute,g,A,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Kh(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=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),cf(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),cf(t,e,i,s),e.length=0,i.length=0)}n=o})),cf(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},Sf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Af=function(t,e){return function(i,s){e(i,s,t)}};let kf=class extends vm{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=du,this.builtinContributions=[bf,yf],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:Kh(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=Kh(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};kf=xf([La(),Af(0,Ba($a)),Af(0,Oa(Qu)),Sf("design:paramtypes",[Object])],kf);var Mf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 vm{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=pu,this.builtinContributions=[Gm,Um,Wm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Kh(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=zu(g,m,k,M,c),w=Vu(g,v,k,M),C=Du(c,d),E=Fu(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(),jm(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=Kh(t,null==s?void 0:s.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Cf=Mf([La(),wf(0,Ba($a)),wf(0,Oa(ep)),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 vm{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=mu,this.builtinContributions=[Xm,qm,$m],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=Kh(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=Kh(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Rf=Ef([La(),Bf(0,Ba($a)),Bf(0,Oa(ip)),Pf("design:paramtypes",[Object])],Rf);const Lf=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 Of=new class extends Mm{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=Lf.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=mm(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?(jm(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&&Lf.free(C),w()}};var If=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Df=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ff=function(t,e){return function(i,s){e(i,s,t)}};let jf=class extends vm{constructor(t){super(),this.textRenderContribitions=t,this.numberType=fu,this.builtinContributions=[Of],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Kh(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=Dc(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=im.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),im.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=Kh(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=hp(l,f),_=cp(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=cp("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 zf(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},Uf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Yf=function(t,e){return function(i,s){e(i,s,t)}};let Kf=class extends vm{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=uu,this.builtinContributions=[Gf,Nf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Kh(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))?zf(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 zf(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=Hf(d,u),b=Hf(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*f);const S=Vf(h,_,y,d,u),A=Vf(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Hf(k,M),w=Vf(h,Hf(_,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=Kh(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Kf=Wf([La(),Yf(0,Ba($a)),Yf(0,Oa(tp)),Uf("design:paramtypes",[Object])],Kf);var Xf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)}};const Zf=["","repeat-x","repeat-y","repeat"];let Jf=class extends vm{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=hu,this.builtinContributions=[Ym,Km],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Kh(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(),jm(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,Zf[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 wd.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Kh(t).image;this._draw(t,a,!1,i)}};Jf=Xf([La(),qf(0,Ba($a)),qf(0,Oa(Ju)),$f("design:paramtypes",[Object])],Jf);const Qf=Symbol.for("IncrementalDrawContribution"),tv=Symbol.for("ArcRender"),ev=Symbol.for("AreaRender"),iv=Symbol.for("CircleRender"),sv=Symbol.for("GraphicRender"),nv=Symbol.for("GroupRender"),rv=Symbol.for("LineRender"),av=Symbol.for("PathRender"),ov=Symbol.for("PolygonRender"),lv=Symbol.for("RectRender"),hv=Symbol.for("SymbolRender"),cv=Symbol.for("TextRender"),dv=Symbol.for("RichTextRender"),uv=Symbol.for("GlyphRender"),pv=Symbol.for("ImageRender"),gv=Symbol.for("DrawContribution");var mv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const vv=Symbol.for("DrawItemInterceptor"),_v=new Jt,yv=new Jt;class bv{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return t.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){_v.copy(s.dirtyBounds),yv.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(_v),s.backupDirtyBounds.copy(yv)),!0}}class xv{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 Sv=class{constructor(){this.order=1,this.interceptors=[new bv,new kv,new Av,new xv]}afterDrawItem(t,e,i,s,n){for(let r=0;r(e=t.numberType===nu,!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&&sm.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Mv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},wv=function(t,e){return function(i,s){e(i,s,t)}};const Cv=Symbol.for("RenderService");let Ev=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}};Ev=Mv([La(),wv(0,Ba(gv)),Tv("design:paramtypes",[Object])],Ev);var Pv=new ba((t=>{t(Cv).to(Ev)}));const Bv=Symbol.for("PickerService"),Rv=Symbol.for("GlobalPickerService");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};const Ov=Symbol.for("PickItemInterceptor");let Iv=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){if(!t.shadowRoot)return null;const{parentMatrix:r}=n||{};if(!r)return null;const a=e.pickContext;a.highPerformanceSave();const o=t.shadowRoot,l=im.allocateByObj(r),h=new Xt(l.a*i.x+l.c*i.y+l.e,l.b*i.x+l.d*i.y+l.f),c=e.pickGroup(o,h,l,s);return a.highPerformanceRestore(),c}};Iv=Lv([La()],Iv);let Dv=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}};Dv=Lv([La()],Dv);let Fv=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===nu,!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()}};Fv=Lv([La()],Fv);var jv=new ba(((t,e,i)=>{i(Bv)||(t(Rv).toSelf(),t(Bv).toService(Rv)),t(Fv).toSelf().inSingletonScope(),t(Ov).toService(Fv),t(Iv).toSelf().inSingletonScope(),t(Ov).toService(Iv),t(Dv).toSelf().inSingletonScope(),t(Ov).toService(Dv),Za(t,Ov)})),zv=new ba((t=>{t(vu).to(dm).inSingletonScope(),t(_u).toConstantValue(um)}));const Hv=Symbol.for("AutoEnablePlugins"),Vv=Symbol.for("PluginService");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},Gv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wv=function(t,e){return function(i,s){e(i,s,t)}};let Uv=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&&$l.isBound(Hv)&&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=[]}};Uv=Nv([La(),Wv(0,Ba($a)),Wv(0,Oa(Hv)),Gv("design:paramtypes",[Object])],Uv);var Yv=new ba((t=>{t(Vv).to(Uv),function(t,e){t($a).toDynamicValue((t=>{let{container:i}=t;return new qa(e,i)})).whenTargetNamed(e)}(t,Hv)})),Kv=new ba((t=>{Za(t,to)})),Xv=new ba((t=>{t(Kl).to(Xl).inSingletonScope(),Za(t,Kl)})),$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},qv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Zv=class{constructor(){this.type="static",this.offscreen=!1,this.global=Ol.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=Jl({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()}};Zv=$v([La(),qv("design:paramtypes",[])],Zv);var Jv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)};let t_=class{constructor(){this.offscreen=!1,this.type="virtual",this.global=Ol.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(){}};t_=Jv([La(),Qv("design:paramtypes",[])],t_);var e_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)};let s_=class{constructor(){this.offscreen=!0,this.type="dynamic",this.global=Ol.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;const s=Jl({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){}};s_=e_([La(),i_("design:paramtypes",[])],s_);var n_=new ba((t=>{t(Zv).toSelf(),t(s_).toSelf(),t(t_).toSelf(),t(Cu).toService(Zv),t(Eu).toService(s_),t(Pu).toService(t_)}));var r_=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 a_(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 r_(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,s)}))}function l_(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 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)},d_=function(t,e){return function(i,s){e(i,s,t)}};let u_=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=Ol.global,this.layerService=Ol.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:yl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:yl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,im.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=l_(e,i,yl.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=Lf.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=im.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))})):a_(t,yl.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),Lf.free(n),im.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||$l.get(Qf);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},g_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},m_=function(t,e){return function(i,s){e(i,s,t)}};let f_=class{constructor(t){this.groupRenderContribitions=t,this.numberType=lu}drawShape(t,e,i,s,n,r,a,o){const l=Kh(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=zu(u,f,p,g,h),k=Vu(u,v,p,g),M=Du(h,c),T=Fu(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(),jm(e,i,s,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Dm));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=Kh(t,null==s?void 0:s.theme).group,l=n.modelMatrix;if(n.camera){const e=sm.allocate(),i=sm.allocate();cm(i,t,o),hm(e,l||e,i),n.modelMatrix=e,sm.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&&sm.free(n.modelMatrix),n.modelMatrix=l,n.baseGlobalAlpha/=a,d&&d.then?d.then((()=>{r?n.restore():n.highPerformanceRestore()})):r?n.restore():n.highPerformanceRestore()}};f_=p_([La(),m_(0,Ba($a)),m_(0,Oa(Zu)),g_("design:paramtypes",[Object])],f_);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};let __=class extends hf{constructor(){super(...arguments),this.numberType=cu}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=Kh(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=ju(u,p,c),_=Hu(u,g),y=Du(c),b=Fu(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())}};__=v_([La()],__);var y_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 b_=class extends _f{constructor(){super(...arguments),this.numberType=ru}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=Kh(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=ju(u,d,c),m=Du(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())}};b_=y_([La()],b_);var x_,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},A_=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)}},M_=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"}(x_||(x_={}));let T_=class extends u_{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=x_.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 M_(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:yl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:yl.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 M_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return M_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>M_(this,void 0,void 0,(function*(){if(2!==t.count)yield o_(t,yl.zIndex,((i,s)=>{if(this.status===x_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return M_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return M_(this,void 0,void 0,(function*(){this.rendering&&(this.status=x_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=x_.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 M_(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:()=>M_(this,void 0,void 0,(function*(){yield o_(t,yl.zIndex,(t=>M_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};T_=S_([La(),k_(0,Ra(sv)),k_(1,Ba(__)),k_(2,Ba(b_)),k_(3,Ba($a)),k_(3,Oa(vv)),A_("design:paramtypes",[Array,Object,Object,Object])],T_);var w_=new ba((t=>{t(Mm).toSelf().inSingletonScope(),t(Cm).toSelf().inSingletonScope(),t(gv).to(u_),t(Qf).to(T_),t(nv).to(f_).inSingletonScope(),t(sv).toService(nv),Za(t,Zu),t(wm).toSelf().inSingletonScope(),Za(t,np),Za(t,sv),t(Sv).toSelf().inSingletonScope(),t(vv).toService(Sv),Za(t,vv)}));function C_(){C_.__loaded||(C_.__loaded=!0,$l.load(Iu),$l.load(zv),$l.load(Pv),$l.load(jv),$l.load(Yv),function(t){t.load(Kv),t.load(Xv),t.load(n_)}($l),function(t){t.load(w_)}($l))}C_.__loaded=!1,C_();const E_=$l.get(eo);Ol.global=E_;const P_=$l.get(Tu);Ol.graphicUtil=P_;const B_=$l.get(Mu);Ol.transformUtil=B_;const R_=$l.get(vu);Ol.graphicService=R_;const L_=$l.get(wu);Ol.layerService=L_;class O_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ya.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Ol.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),Ol.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){Ol.graphicService.hooks.onAttributeUpdate.taps=Ol.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Ol.graphicService.hooks.onSetStage.taps=Ol.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class I_{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 D_{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,Ol.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))})),Ol.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){Ol.graphicService.hooks.onAddIncremental.taps=Ol.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Ol.graphicService.hooks.onClearIncremental.taps=Ol.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Ol.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 F_{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)),Ol.graphicService.hooks.onRemove.unTap(this.key),Ol.graphicService.hooks.onRelease.unTap(this.key),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?Ol.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:Ol.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return function(t){const e={};return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[si(i)]=t[i])})),["fontSize","lineHeight"].forEach((i=>{const s=si(i);u(t[i])||(e[s]=/^[0-9]*$/.test(`${t[i]}`)?`${t[i]}px`:`${t[i]}`)})),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:Kh(t).text)}getTransformOfText(t){const e=Kh(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=Ol.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),f=o+m.left-p.left,v=l+m.top-p.top;if(a.left=`${f}px`,a.top=`${v}px`,"text"===t.type&&"position"===c&&(a=Object.assign(Object.assign({},a),this.getTransformOfText(t))),d(n.style)){const e=n.style({top:v,left:f,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)));Ol.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"===Ol.global.env&&(t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:yl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:yl.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&&Ol.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"===Ol.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 j_=new Jt;class z_{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()})),Ol.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&&(j_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(j_,t.parent&&t.parent.globalTransMatrix)))})),Ol.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))})),Ol.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){Ol.graphicService.hooks.beforeUpdateAABBBounds.taps=Ol.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Ol.graphicService.hooks.afterUpdateAABBBounds.taps=Ol.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)),Ol.graphicService.hooks.onRemove.taps=Ol.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const H_=new Jt;class V_{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=Kh(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,Ol.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),Ol.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&H_.copy(s)})),Ol.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(H_.equals(i)||this.tryLayout(t,!1))})),Ol.graphicService.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1)}))}deactivate(t){Ol.graphicService.hooks.onAttributeUpdate.taps=Ol.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Ol.graphicService.hooks.beforeUpdateAABBBounds.taps=Ol.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Ol.graphicService.hooks.afterUpdateAABBBounds.taps=Ol.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Ol.graphicService.hooks.onSetStage.taps=Ol.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const N_=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===cc.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=cc.INITIAL,Ol.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),Ol.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:hc},{mode:"timeout",cons:lc},{mode:"manual",cons:oc}];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!==cc.INITIAL&&(this.status=cc.PAUSE,!0)}resume(){return this.status!==cc.INITIAL&&(this.status=cc.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===cc.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===cc.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=cc.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=cc.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};N_.addTimeline(pc),N_.setFPS(60);class G_{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=ld.Get(e,od.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)?ld.Get(e,od.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}function W_(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 U_(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 Y_{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=sm.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=sm.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()})),i&&Ol.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))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])this.htmlMap[o].root.render(r);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t){const i=n.createRoot(t);i.render(r),this.htmlMap||(this.htmlMap={}),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}}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 q_="white";class Z_ extends Su{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:q_}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 Uh,this.hooks={beforeRender:new Qa(["stage"]),afterRender:new Qa(["stage"])},this.global=Ol.global,!this.global.env&&X_()&&this.global.setEnv("browser"),this.window=$l.get(Bh),this.renderService=$l.get(Cv),this.pluginService=$l.get(Vv),this.layerService=$l.get(wu),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:q_,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||N_,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new uc,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 ac(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 G_(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 Y_(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 I_))}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 O_))}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 D_))}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 z_,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 V_))}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 F_))}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 $_))}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){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(){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){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(){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];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];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){this.pickerService||(this.pickerService=$l.get(Bv));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){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){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;const e=$l.get(Bh),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;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 J_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)};const ty=new ae(1,0,0,1,0,0),ey={x:0,y:0};let iy=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 hl,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 im.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(im.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(im.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},ey),function(t,e,i){return wh(t,0,!1,e,i)}(this.path.commandList,ey.x,ey.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ey);const i=bm(this,this.lineWidth,this.dpr);return function(t,e,i,s){return wh(t,e,!0,i,s)}(this.path.commandList,i,ey.x,ey.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(ty,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=>im.free(t))),this.stack.length=0}};iy=J_([La(),Q_("design:paramtypes",[Object,Number])],iy);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={WIDTH:500,HEIGHT:500,DPR:1};let ay=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=ry.WIDTH,height:n=ry.HEIGHT,dpr:r=ry.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)}};ay.env="browser",ay=sy([La(),ny("design:paramtypes",[Object])],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};let ly=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}}};ly=oy([La()],ly);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},cy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let dy=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}};dy=hy([La(),cy("design:paramtypes",[])],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},py=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gy=function(t,e){return function(i,s){e(i,s,t)}};let my=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=Ol.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=sm.allocate();if(lm(i,e),a){if(i){const t=sm.allocate();r.modelMatrix=hm(t,a,i),sm.free(i)}}else lm(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=Kh(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=Kh(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&&sm.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),im.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function fy(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&&fy(t,e,a,s,n),n.push(t[a],t[a+1]),i-a>2&&fy(t,a,i,s,n))}function vy(t,e){const i=t.length-1,s=[t[0]];return fy(t,0,i,e,s),s.push(t[i]),s}my=uy([La(),gy(0,Ba($a)),gy(0,Oa(Ov)),py("design:paramtypes",[Object])],my);let _y=!1;const yy=new ba((t=>{_y||(_y=!0,t(tf).toSelf().inSingletonScope(),t(tv).to(tf).inSingletonScope(),t(sv).toService(tv),t(Xu).toService(wm),Za(t,Xu))}));let by=!1;const xy=new ba((t=>{by||(by=!0,t(Cf).toSelf().inSingletonScope(),t(lv).to(Cf).inSingletonScope(),t(sv).toService(lv),t(Nm).toSelf(),t(Vm).toSelf(),t(ep).toService(Nm),t(ep).toService(Vm),t(ep).toService(wm),Za(t,ep))}));let Sy=!1;const Ay=new ba((t=>{Sy||(Sy=!0,t(hf).toSelf().inSingletonScope(),t(__).toSelf().inSingletonScope(),t(rv).to(hf).inSingletonScope(),t(sv).toService(rv))}));let ky=!1;const My=new ba((t=>{ky||(ky=!0,t(_f).toSelf().inSingletonScope(),t(ev).to(_f).inSingletonScope(),t(sv).toService(ev),t($u).toService(wm),Za(t,$u),t(b_).toSelf().inSingletonScope())}));let Ty=!1;const wy=new ba((t=>{Ty||(Ty=!0,t(Rf).toSelf().inSingletonScope(),t(hv).to(Rf).inSingletonScope(),t(sv).toService(hv),t(ip).toService(wm),Za(t,ip))}));let Cy=!1;const Ey=new ba((t=>{Cy||(Cy=!0,t(rf).toSelf().inSingletonScope(),t(iv).to(rf).inSingletonScope(),t(sv).toService(iv),t(qu).toService(wm),Za(t,qu))}));let Py=!1;const By=new ba((t=>{Py||(Py=!0,t(cv).to(jf).inSingletonScope(),t(sv).toService(cv),t(sp).toService(wm),Za(t,sp))}));let Ry=!1;const Ly=new ba((t=>{Ry||(Ry=!0,t(kf).toSelf().inSingletonScope(),t(av).to(kf).inSingletonScope(),t(sv).toService(av),t(Qu).toService(wm),Za(t,Qu))}));let Oy=!1;const Iy=new ba((t=>{Oy||(Oy=!0,t(ov).to(Kf).inSingletonScope(),t(sv).toService(ov),t(tp).toService(wm),Za(t,tp))}));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 Fy=class{constructor(){this.numberType=ou}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=Kh(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};Fy=Dy([La()],Fy);let jy=!1;const zy=new ba((t=>{jy||(jy=!0,t(uv).to(Fy).inSingletonScope(),t(sv).toService(uv))}));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},Vy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ny=class extends vm{constructor(){super(),this.numberType=gu,this.builtinContributions=[Of],this.init()}drawShape(t,e,i,s,n){const r=Kh(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=ju(o,l,!0),d=ju(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=Kh(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(),jm(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=Kh(t).richtext;this._draw(t,s,!1,i)}};Ny=Hy([La(),Vy("design:paramtypes",[])],Ny);let Gy=!1;const Wy=new ba((t=>{Gy||(Gy=!0,t(dv).to(Ny).inSingletonScope(),t(sv).toService(dv))}));let Uy=!1;const Yy=new ba((t=>{Uy||(Uy=!0,t(pv).to(Jf).inSingletonScope(),t(sv).toService(pv),t(Ju).toService(wm),Za(t,Ju))}));const Ky=(t,e)=>(d($y.warnHandler)&&$y.warnHandler.call(null,t,e),e?rt.getInstance().warn(`[VChart warn]: ${t}`,e):rt.getInstance().warn(`[VChart warn]: ${t}`)),Xy=(t,e,i)=>{if(!d($y.errorHandler))throw new Error(t);$y.errorHandler.call(null,t,e)},$y={silent:!1,warnHandler:!1,errorHandler:!1},qy=X_(),Zy=qy&&globalThis?globalThis.document:void 0;function Jy(t){return("desktop-browser"===t||"mobile-browser"===t)&&qy}function Qy(t){return tb(t)||"mobile-browser"===t}function tb(t){return t.includes("miniApp")||"lynx"===t||"wx"===t}let eb=0;function ib(){return eb>=9999999&&(eb=0),eb++}function sb(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function nb(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const rb=(t,e,i)=>(t.fields=e||[],t.fname=i,t),ab=t=>e=>R(e,t),ob=t=>{rt.getInstance().error(t)},lb=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||ob("Access path missing open bracket: "+t),o>0&&h(),o=0,s=n+1):n>s?h():s=n+1}return o&&ob("Access path missing closing bracket: "+t),a&&ob("Access path missing closing quote: "+t),n>s&&(n+=1,h()),e})(t),n=1===s.length?s[0]:t;return rb((i&&i.get||ab)(s),[n],e||n)},hb=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(y(t)){const s=t.map((t=>lb(t,e,i)));return t=>s.map((e=>e(t)))}return lb(t,e,i)};hb("id");const cb=rb((function(t){return t}),[],"identity"),db=rb((function(){return 0}),[],"zero");rb((function(){return 1}),[],"one"),rb((function(){return!0}),[],"true"),rb((function(){return!1}),[],"false"),rb((function(){return{}}),[],"emptyObject");const ub=(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=>pb(t,r,n)))))},gb=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t;function mb(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 fb(t,e,i,s,n){let r=0,a=0;return mb(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function vb(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;mb(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:fb(t,e,i,n,h)}}function _b(t){return"horizontal"===t}function yb(t){return"vertical"===t}const bb=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class xb extends Su{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,bb.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=>bb.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 $b=(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"},qb=(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 Zb 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=ec.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=ec.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||$b(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=qb(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=ec.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=qb(i,n),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=$b(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=ec.now()-i>this.config.press.time&&qb(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},Qb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const tx=[0,0,0];let ex=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({},pl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},ml),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},fl),{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 im.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&&(im.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(im.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&&Ku.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&&(U_(tx,[t,e,i],this.modelMatrix),t=tx[0],e=tx[1],i=tx[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&&(U_(tx,[t,e,i],this.modelMatrix),t=tx[0],e=tx[1],i=tx[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(U_(tx,[e,i,s],this.modelMatrix),e=tx[0],i=tx[1],s=tx[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]:Ol.global.measureTextMethod;var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Ol.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:fl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:fl.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&&(U_(tx,[e,i,s],this.modelMatrix),e=tx[0],i=tx[1],s=tx[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=xm(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=bm(this,l,this.dpr),r.strokeStyle=xm(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=lp(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=lp(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=>im.free(t))),this.stack.length=0}};ex.env="browser",ex=Jb([La(),Qb("design:paramtypes",[Object,Number])],ex);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},sx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let nx=class extends ay{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Ol.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new ex(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 rx(t,e){return new ba((i=>{i(ql).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Zl).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}nx.env="browser",nx=ix([La(),sx("design:paramtypes",[Object])],nx);const ax=rx(nx,ex);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)},hx=function(t,e){return function(i,s){e(i,s,t)}};let cx=class extends my{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=Ch.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 ux=class{constructor(){this.type="group",this.numberType=lu}contains(t,e,i){return!1}};ux=dx([La()],ux);const px=new ba(((t,e,i,s)=>{px.__vloaded||(px.__vloaded=!0,t(Yb).to(ux).inSingletonScope(),t(Kb).toService(Yb),Za(t,Kb))}));px.__vloaded=!1;var gx=px;const mx=new ba(((t,e,i,s)=>{i(cx)||t(cx).toSelf().inSingletonScope(),i(Bv)?s(Bv).toService(cx):t(Bv).toService(cx)}));var fx,vx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)};let yx=fx=class extends dy{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${fx.idprefix}_${fx.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Ol.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:fx.GenerateCanvasId(),canvasControled:!0};this.canvas=new nx(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 nx({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)}};yx.env="browser",yx.idprefix="visactor_window",yx.prefix_count=0,yx=fx=vx([La(),_x("design:paramtypes",[])],yx);const bx=new ba((t=>{t(yx).toSelf(),t(Rh).toDynamicValue((t=>t.container.get(yx))).whenTargetNamed(yx.env)}));var 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)};class Ax{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 kx(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 Mx=class extends ly{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 Ax(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 kx(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return kx(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}}};Mx=xx([La(),Sx("design:paramtypes",[])],Mx);const Tx=new ba((t=>{Tx.isBrowserBound||(Tx.isBrowserBound=!0,t(Mx).toSelf().inSingletonScope(),t(to).toService(Mx))}));function Cx(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Cx.__loaded||(Cx.__loaded=!0,t.load(Tx),t.load(ax),t.load(bx),e&&function(t){t.load(gx),t.load(mx)}(t))}Tx.isBrowserBound=!1,Cx.__loaded=!1;var Ex=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Bx=function(t,e){return function(i,s){e(i,s,t)}};let Rx=class extends my{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 iy(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}};Rx=Ex([La(),Bx(0,Ba($a)),Bx(0,Oa(Sb)),Bx(1,Ba($a)),Bx(1,Oa(Ov)),Px("design:paramtypes",[Object,Object])],Rx);const Lx=new ba((t=>{Lx.__vloaded||(Lx.__vloaded=!0,Za(t,Sb))}));Lx.__vloaded=!1;var Ox=Lx,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)},Fx=function(t,e){return function(i,s){e(i,s,t)}};let jx=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=su}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=Kh(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}};jx=Ix([La(),Fx(0,Ba(tv)),Dx("design:paramtypes",[Object])],jx);let zx=!1;const Hx=new ba(((t,e,i,s)=>{zx||(zx=!0,t(Ab).to(jx).inSingletonScope(),t(Sb).toService(Ab))}));var Vx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Gx=function(t,e){return function(i,s){e(i,s,t)}};let Wx=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=ru}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=Kh(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}};Wx=Vx([La(),Gx(0,Ba(ev)),Nx("design:paramtypes",[Object])],Wx);let Ux=!1;const Yx=new ba(((t,e,i,s)=>{Ux||(Ux=!0,t(kb).to(Wx).inSingletonScope(),t(Sb).toService(kb))}));var Kx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$x=function(t,e){return function(i,s){e(i,s,t)}};let qx=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=au}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=Kh(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}};qx=Kx([La(),$x(0,Ba(iv)),Xx("design:paramtypes",[Object])],qx);let Zx=!1;const Jx=new ba(((t,e,i,s)=>{Zx||(Zx=!0,t(Mb).to(qx).inSingletonScope(),t(Sb).toService(Mb))}));var Qx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},eS=function(t,e){return function(i,s){e(i,s,t)}};let iS=class{constructor(t){this.canvasRenderer=t,this.type="glyph",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=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}};iS=Qx([La(),eS(0,Ba(uv)),tS("design:paramtypes",[Object])],iS);let sS=!1;const nS=new ba(((t,e,i,s)=>{sS||(sS=!0,t(Lb).to(iS).inSingletonScope(),t(iS).toService(Lb))}));var rS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 aS=class{constructor(){this.type="image",this.numberType=hu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};aS=rS([La()],aS);let oS=!1;const lS=new ba(((t,e,i,s)=>{oS||(oS=!0,t(Tb).to(aS).inSingletonScope(),t(aS).toService(Tb))}));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="line",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=Kh(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}};uS=hS([La(),dS(0,Ba(rv)),cS("design:paramtypes",[Object])],uS);let pS=!1;const gS=new ba(((t,e,i,s)=>{pS||(pS=!0,t(wb).to(uS).inSingletonScope(),t(Sb).toService(wb))}));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="polygon",this.numberType=uu}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=Kh(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}};_S=mS([La(),vS(0,Ba(ov)),fS("design:paramtypes",[Object])],_S);let yS=!1;const bS=new ba(((t,e,i,s)=>{yS||(yS=!0,t(Rb).to(_S).inSingletonScope(),t(Sb).toService(Rb))}));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},SS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},AS=function(t,e){return function(i,s){e(i,s,t)}};let kS=class{constructor(t){this.canvasRenderer=t,this.type="path",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=Kh(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}};kS=xS([La(),AS(0,Ba(av)),SS("design:paramtypes",[Object])],kS);let MS=!1;const TS=new ba(((t,e,i,s)=>{MS||(MS=!0,t(Cb).to(kS).inSingletonScope(),t(Sb).toService(Cb))}));var wS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ES=function(t,e){return function(i,s){e(i,s,t)}};const PS=new Jt;let BS=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=pu}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=Kh(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;PS.setValue(i.x1,i.y1,i.x2,i.y2),PS.expand(-r/2),h=!PS.containsPoint(e)}}return s.highPerformanceRestore(),h}};BS=wS([La(),ES(0,Ba(lv)),CS("design:paramtypes",[Object])],BS);let RS=!1;const LS=new ba(((t,e,i,s)=>{RS||(RS=!0,t(Eb).to(BS).inSingletonScope(),t(Sb).toService(Eb))}));let OS=!1;const IS=new ba(((t,e,i,s)=>{OS||(OS=!0,t(Tb).to(aS).inSingletonScope(),t(aS).toService(Tb))}));var DS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},jS=function(t,e){return function(i,s){e(i,s,t)}};let zS=class{constructor(t){this.canvasRenderer=t,this.type="symbol",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=Kh(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}};zS=DS([La(),jS(0,Ba(hv)),FS("design:paramtypes",[Object])],zS);let HS=!1;const VS=new ba(((t,e,i,s)=>{HS||(HS=!0,t(Pb).to(zS).inSingletonScope(),t(Sb).toService(Pb))}));var NS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 GS=class{constructor(){this.type="text",this.numberType=fu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};GS=NS([La()],GS);let WS=!1;const US=new ba(((t,e,i,s)=>{WS||(WS=!0,t(Bb).to(GS).inSingletonScope(),t(Sb).toService(Bb))})),YS=new ba(((t,e,i,s)=>{i(Rx)||t(Rx).toSelf().inSingletonScope(),i(Bv)?s(Bv).toService(Rx):t(Bv).toService(Rx)}));var KS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let $S=class extends ex{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(){}};$S.env="node",$S=KS([La(),XS("design:paramtypes",[Object,Number])],$S);var qS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ZS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let JS=class extends ay{constructor(t){super(t)}init(){this._context=new $S(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};JS.env="node",JS=qS([La(),ZS("design:paramtypes",[Object])],JS);const QS=rx(JS,$S);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)},iA=function(t,e){return function(i,s){e(i,s,t)}};let sA=class extends dy{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 JS(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 JS({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){}};sA.env="node",sA=tA([La(),iA(0,Ba(eo)),eA("design:paramtypes",[Object])],sA);const nA=new ba((t=>{t(sA).toSelf(),t(Rh).toDynamicValue((t=>t.container.get(sA))).whenTargetNamed(sA.env)}));var rA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 aA=class extends ly{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 Ic.call(t)}}getCancelAnimationFrame(){return t=>{Ic.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};aA=rA([La()],aA);const oA=new ba((t=>{oA.isNodeBound||(oA.isNodeBound=!0,t(aA).toSelf().inSingletonScope(),t(to).toService(aA))}));function lA(t){lA.__loaded||(lA.__loaded=!0,t.load(oA),t.load(QS),t.load(nA))}oA.isNodeBound=!1,lA.__loaded=!1;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 ex{draw(){}createPattern(t,e){return null}};cA.env="wx",cA=hA([La()],cA);var dA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let pA=class extends ay{constructor(t){super(t)}init(){this._context=new cA(this,this._dpr)}release(){}};pA.env="wx",pA=dA([La(),uA("design:paramtypes",[Object])],pA);const gA=rx(pA,cA);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)},vA=function(t,e){return function(i,s){e(i,s,t)}};class _A{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 yA=class extends dy{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new _A}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 pA(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 pA({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()}};yA.env="wx",yA=mA([La(),vA(0,Ba(eo)),fA("design:paramtypes",[Object])],yA);const bA=new ba((t=>{t(yA).toSelf(),t(Rh).toDynamicValue((t=>t.container.get(yA))).whenTargetNamed(yA.env)}));var xA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},SA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},AA=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 kA=class extends ly{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 AA(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 Ic.call(t)}}getCancelAnimationFrame(){return t=>{Ic.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}};kA=xA([La(),SA("design:paramtypes",[])],kA);const MA=new ba((t=>{MA._isWxBound||(MA._isWxBound=!0,t(kA).toSelf().inSingletonScope(),t(to).toService(kA))}));function TA(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];TA.__loaded||(TA.__loaded=!0,t.load(MA),t.load(gA),t.load(bA),e&&function(t){t.load(Ox),t.load(YS),t.load(Hx),t.load(Yx),t.load(Jx),t.load(nS),t.load(lS),t.load(gS),t.load(bS),t.load(TS),t.load(LS),t.load(IS),t.load(VS),t.load(US)}(t))}MA._isWxBound=!1,TA.__loaded=!1;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},CA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},EA=function(t,e){return function(i,s){e(i,s,t)}};let PA=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=su}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=Kh(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=bm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};PA=wA([La(),EA(0,Ba(tv)),CA("design:paramtypes",[Object])],PA);let BA=!1;const RA=new ba(((t,e,i,s)=>{BA||(BA=!0,t(Ob).to(PA).inSingletonScope(),t(Kb).toService(Ob))}));var LA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},OA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IA=function(t,e){return function(i,s){e(i,s,t)}};const DA=new Jt;let FA=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=pu}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=Kh(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=bm(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;DA.setValue(i.x1,i.y1,i.x2,i.y2),DA.expand(-r/2),h=!DA.containsPoint(e)}}return s.highPerformanceRestore(),h}};FA=LA([La(),IA(0,Ba(lv)),OA("design:paramtypes",[Object])],FA);let jA=!1;const zA=new ba(((t,e,i,s)=>{jA||(jA=!0,t(Hb).to(FA).inSingletonScope(),t(Kb).toService(Hb))}));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 VA=class extends vm{};VA=HA([La()],VA);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},GA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},WA=function(t,e){return function(i,s){e(i,s,t)}};let UA=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="line",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;s.highPerformanceSave();const n=Kh(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=bm(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&sm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};UA=NA([La(),WA(0,Ba(rv)),GA("design:paramtypes",[Object])],UA);let YA=!1;const KA=new ba(((t,e,i,s)=>{YA||(YA=!0,t(jb).to(UA).inSingletonScope(),t(Kb).toService(jb))}));var XA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},qA=function(t,e){return function(i,s){e(i,s,t)}};let ZA=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=ru}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=Kh(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=bm(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h})),s.highPerformanceRestore(),h}};ZA=XA([La(),qA(0,Ba(ev)),$A("design:paramtypes",[Object])],ZA);let JA=!1;const QA=new ba(((t,e,i,s)=>{JA||(JA=!0,t(Ib).to(ZA).inSingletonScope(),t(Kb).toService(Ib))}));var tk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ik=function(t,e){return function(i,s){e(i,s,t)}};let sk=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=mu}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=Kh(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=bm(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&sm.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};sk=tk([La(),ik(0,Ba(hv)),ek("design:paramtypes",[Object])],sk);let nk=!1;const rk=new ba(((t,e,i,s)=>{nk||(nk=!0,t(Vb).to(sk).inSingletonScope(),t(Kb).toService(Vb))}));var ak=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ok=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lk=function(t,e){return function(i,s){e(i,s,t)}};let hk=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=au}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=Kh(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=bm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};hk=ak([La(),lk(0,Ba(iv)),ok("design:paramtypes",[Object])],hk);let ck=!1;const dk=new ba(((t,e,i,s)=>{ck||(ck=!0,t(Db).to(hk).inSingletonScope(),t(Kb).toService(Db))}));var uk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gk=function(t,e){return function(i,s){e(i,s,t)}};let mk=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=fu}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=Kh(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=cp(a,u,n),v=hp(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&&sm.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};mk=uk([La(),gk(0,Ba(cv)),pk("design:paramtypes",[Object])],mk);let fk=!1;const vk=new ba(((t,e,i,s)=>{fk||(fk=!0,t(Nb).to(mk).inSingletonScope(),t(Kb).toService(Nb))}));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},yk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bk=function(t,e){return function(i,s){e(i,s,t)}};let xk=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="path",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=Kh(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=bm(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&sm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};xk=_k([La(),bk(0,Ba(av)),yk("design:paramtypes",[Object])],xk);let Sk=!1;const Ak=new ba(((t,e,i,s)=>{Sk||(Sk=!0,t(zb).to(xk).inSingletonScope(),t(Kb).toService(zb))}));var kk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mk=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 wk=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=uu}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=Kh(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=bm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};wk=kk([La(),Tk(0,Ba(ov)),Mk("design:paramtypes",[Object])],wk);let Ck=!1;const Ek=new ba(((t,e,i,s)=>{Ck||(Ck=!0,t(Gb).to(wk).inSingletonScope(),t(Kb).toService(Gb))}));var Pk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rk=function(t,e){return function(i,s){e(i,s,t)}};let Lk=class{constructor(t){this.canvasRenderer=t,this.type="glyph",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=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}};Lk=Pk([La(),Rk(0,Ba(uv)),Bk("design:paramtypes",[Object])],Lk);let Ok=!1;const Ik=new ba(((t,e,i,s)=>{Ok||(Ok=!0,t(Ub).to(Lk).inSingletonScope(),t(Kb).toService(Ub))}));var Dk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Fk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jk=function(t,e){return function(i,s){e(i,s,t)}};let zk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=gu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};zk=Dk([La(),jk(0,Ba(dv)),Fk("design:paramtypes",[Object])],zk);let Hk=!1;const Vk=new ba(((t,e,i,s)=>{Hk||(Hk=!0,t(Wb).to(zk).inSingletonScope(),t(Kb).toService(Wb))}));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};let Gk=class{constructor(){this.type="image",this.numberType=hu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Gk=Nk([La()],Gk);let Wk=!1;const Uk=new ba(((t,e,i,s)=>{Wk||(Wk=!0,t(Fb).to(Gk).inSingletonScope(),t(Kb).toService(Fb))})),Yk=X_();function Kk(){Kk.__loaded||(Kk.__loaded=!0,um.RegisterGraphicCreator("arc",Kg),$l.load(yy),$l.load(Yk?RA:Hx))}Kk.__loaded=!1;const Xk=Kk;function $k(){$k.__loaded||($k.__loaded=!0,um.RegisterGraphicCreator("area",Wg),$l.load(My),$l.load(Yk?QA:Yx))}$k.__loaded=!1;const qk=$k;function Zk(){Zk.__loaded||(Zk.__loaded=!0,um.RegisterGraphicCreator("circle",op),$l.load(Ey),$l.load(Yk?dk:Jx))}Zk.__loaded=!1;const Jk=Zk;function Qk(){Qk.__loaded||(Qk.__loaded=!0,um.RegisterGraphicCreator("glyph",wg),$l.load(zy),$l.load(Yk?Ik:nS))}Qk.__loaded=!1;const tM=Qk;function eM(){eM.__loaded||(eM.__loaded=!0,um.RegisterGraphicCreator("group",Au))}eM.__loaded=!1;const iM=eM;function sM(){sM.__loaded||(sM.__loaded=!0,um.RegisterGraphicCreator("image",Rg),$l.load(Yy),$l.load(Yk?Uk:lS))}sM.__loaded=!1;const nM=sM;function rM(){rM.__loaded||(rM.__loaded=!0,um.RegisterGraphicCreator("line",Sg),$l.load(Ay),$l.load(Yk?KA:gS))}rM.__loaded=!1;const aM=rM;function oM(){oM.__loaded||(oM.__loaded=!0,um.RegisterGraphicCreator("path",Vg),$l.load(Ly),$l.load(Yk?Ak:TS))}oM.__loaded=!1;const lM=oM;function hM(){hM.__loaded||(hM.__loaded=!0,um.RegisterGraphicCreator("polygon",qg),$l.load(Iy),$l.load(Yk?Ek:bS))}hM.__loaded=!1;const cM=hM;function dM(){dM.__loaded||(dM.__loaded=!0,um.RegisterGraphicCreator("rect",Mg),$l.load(xy),$l.load(Yk?zA:LS))}dM.__loaded=!1;const uM=dM;function pM(){pM.__loaded||(pM.__loaded=!0,um.RegisterGraphicCreator("richtext",jg),$l.load(Wy),$l.load(Yk?Vk:IS))}pM.__loaded=!1;const gM=pM;function mM(){mM.__loaded||(mM.__loaded=!0,um.RegisterGraphicCreator("shadowRoot",Jg))}mM.__loaded=!1;const fM=mM;function vM(){vM.__loaded||(vM.__loaded=!0,um.RegisterGraphicCreator("symbol",yg),$l.load(wy),$l.load(Yk?rk:VS))}vM.__loaded=!1;const _M=vM;function yM(){yM.__loaded||(yM.__loaded=!0,um.RegisterGraphicCreator("text",gp),$l.load(By),$l.load(Yk?vk:US))}yM.__loaded=!1;const bM=yM;function xM(){iM(),uM()}const SM=-.5*Math.PI,AM=1.5*Math.PI,kM="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 MM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(MM||(MM={}));const TM={[MM.selectedReverse]:{},[MM.selected]:{},[MM.hover]:{},[MM.hoverReverse]:{}},wM={container:"",width:30,height:30,style:{}},CM={debounce:bt,throttle:xt};xM();let EM=class t extends xb{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"===E_.env?(E_.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),E_.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:CM[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"===E_.env?(E_.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),E_.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",CM[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 PM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&PM(t,e)}))}EM.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 BM=t=>!u(t)&&!1!==t.visible;function RM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function LM(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 IM=["#ffffff","#000000"];function DM(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 FM(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(...IM);for(const n of a)if(t!==n&&FM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function FM(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?jM(t,e)>s:"largeText"===i?jM(t,e)>3:jM(t,e)>4.5}function jM(t,e){const i=zM(t),s=zM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function zM(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 HM(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 VM(t,e){return[t[0]*e,t[1]*e]}function NM(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 GM=(t,e,i,s)=>new Je(Object.assign({defaultFontParams:Object.assign({fontFamily:kM,fontSize:14},s),getTextBounds:i?void 0:mm,specialCharSet:"-/: .,@%'\"~"+Je.ALPHABET_CHAR_SET+Je.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function WM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const s=mm({text:t,fontFamily:e.fontFamily||i.fontFamily||kM,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 UM(t){return"rich"===YM(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type")}function YM(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 KM(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 XM(t){const e=YM(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?um.richtext(KM(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)),um.text(t))}function $M(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 ZM(){iM(),uM(),_M(),gM(),bM()}var JM=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);nh&&(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,V=JM(a,["visible"]);if(m&&c(H)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},V),{visible:H&&!!s,x:I,y:D,width:k,height:M}),"rect");B(null==f?void 0:f.panel)||(t.states=f.panel),this._bgRect=t}}this._textShape=P}}QM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const tT={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}},eT={poptip:z({},tT)};var iT=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]]}}}}nT.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 rT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 aT=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,nT.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new nT(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,eT.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}))}};aT=rT([La()],aT);var oT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 lT=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)}};lT=oT([La()],lT);let hT=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)}};hT=oT([La()],hT);const cT=new ba(((t,e,i,s)=>{i(aT)||(t(aT).toSelf().inSingletonScope(),t(np).toService(aT)),i(lT)||(t(lT).toSelf(),t(Hv).toService(lT)),i(hT)||(t(hT).toSelf(),t(Hv).toService(hT))}));class dT extends xb{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}iM(),aM();class uT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},uT.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})}}uT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},iM(),uM();class pT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},pT.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})}}pT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},iM(),Xk();class gT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},gT.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)}}gT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},iM(),Xk();class mT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},mT.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=SM,endAngle:s=AM}=this.attribute,n=s-i,r=te(se(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}mT.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},iM(),lM();class fT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fT.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)}}fT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const vT=new Uint32Array(33),_T=new Uint32Array(33);_T[0]=0,vT[0]=~_T[0];for(let t=1;t<=32;++t)_T[t]=_T[t-1]<<1|1,vT[t]=~_T[t];function yT(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]&vT[31&l]&_T[1+(31&h)])return!0}else{if(i[c]&vT[31&l])return!0;if(i[d]&_T[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,vT[31&n]&_T[1+(31&r)]);else for(s(a,vT[31&n]),s(o,_T[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,_T[31&i]|vT[1+(31&s)]);else for(n(r,_T[31&i]),n(a,vT[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 bT(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 xT(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=bT(t,r),!(s&&e.outOfBounds(r)||e.getRange(r))}function ST(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 ST(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 ST(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 ST(t,e,n,s,h,c)}return!1}const kT=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],MT=["top","inside-top","inside"];function TT(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 wT={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 CT(t,e){var i,s;return null!==(s=null===(i=wT[e])||void 0===i?void 0:i.call(wT,t))&&void 0!==s?s:{from:{},to:{}}}const ET=(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 PT(t,e,i,s){t.attribute.text!==e.attribute.text&&k(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new Fc({text:t.attribute.text},{text:e.attribute.text},i,s))}const BT={mode:"same-time",duration:300,easing:"linear"};function RT(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 LT(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 OT(t){return 3===t||4===t}function IT(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 DT=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)}},FT=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 jT(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 zT(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)}}iM(),bM(),gM(),aM();class HT extends xb{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},HT.defaultAttributes,t)),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(MM.hover,!0),PM(this,(t=>{t===e||B(t.states)||t.addState(MM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(PM(this,(t=>{B(t.states)||(t.removeState(MM.hoverReverse),t.removeState(MM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void PM(this,(t=>{B(t.states)||(t.removeState(MM.selectedReverse),t.removeState(MM.selected))}));B(e.states)||(e.addState(MM.selected,!0),PM(this,(t=>{t===e||B(t.states)||t.addState(MM.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:[];(this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)]).forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(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[zT(g,m,c,d,a,o),zT(-g,-m,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds);if(i){const t=um.line({points:i});return e&&e.attribute.fill&&t.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&t.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(t),t}}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)),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 XM(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&&y.setRange(bT(v,t.AABBBounds,!0))}))),m.length>0&&m.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&&y.setRange(bT(v,t.AABBBounds,!0))})):t.AABBBounds&&y.setRange(bT(v,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 i=new Map,s=this._graphicToText||new Map,n=[],r=[],{visible:a}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{const o=this.getRelatedGraphic(t.attribute),l=t.attribute.id,h=this._isCollectionBase?l:o,c=(null==s?void 0:s.get(h))?"update":"enter";let d;if(a&&(d=this._createLabelLine(t,o)),"enter"===c){if(n.push(t),i.set(h,d?{text:t,labelLine:d}:{text:t}),o){const{from:i,to:s}=CT(t.attribute,"fadeIn");this.add(t),d&&(r.push(d),this.add(d)),this._syncStateWithRelatedGraphic(o),this._animationConfig.enter.duration>0&&o.once("animate-bind",(a=>{t.setAttributes(i),d&&d.setAttributes(i);const l=this._afterRelatedGraphicAttributeUpdate(t,n,d,r,e,o,s,this._animationConfig.enter);o.on("afterAttributeUpdate",l)}))}}else if("update"===c){const e=s.get(h);s.delete(h),i.set(h,e);const n=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&&PT(t,e,s,n))}i.forEach(((i,s)=>{const{duration:n,easing:r,increaseEffect:a=!0,channel:o}=i,{from:l,to:h}=ET(t,e,o,i.options);B(h)||t.animate().to(h,n,r),"text"in l&&"text"in h&&a&&PT(t,e,n,r)}))})(n,t,this._animationConfig.update),e.labelLine&&d&&e.labelLine.animate().to(d.attribute,r,a)}})),s.forEach((t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(CT(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=i}_renderWithOutAnimation(t){var e;const i=new Map,s=this._graphicToText||new Map,{visible:n}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach((t=>{const e=this.getRelatedGraphic(t.attribute),r=(null==s?void 0:s.get(e))?"update":"enter",a=this._isCollectionBase?t.attribute.id:e;let o;if(n&&(o=this._createLabelLine(t,e)),"enter"===r)i.set(a,o?{text:t,labelLine:o}:{text:t}),this.add(t),o&&this.add(o),this._syncStateWithRelatedGraphic(e);else if("update"===r){const e=s.get(a);s.delete(a),i.set(a,e),e.text.setAttributes(t.attribute),e.labelLine&&o&&e.labelLine.setAttributes(o.attribute)}})),s.forEach((t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)})),this._graphicToText=i}_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)}}VT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};class NT extends HT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},NT.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}}}NT.tag="rect-label",NT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};let GT=class t extends HT{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 jT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};GT.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class WT{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 UT extends HT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UT.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:"…"}),n=this._createLabelText(s),r=this.getGraphicBounds(n),a=r.x2-r.x1,o=e.map((t=>t.attribute)),l=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),o,i,a);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=LT(l.endAngle-d/2),p=RT(h.x,h.y,l.outerRadius,o),g=RT(h.x,h.y,a+e.line.line1MinLength,o),m=new WT(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);m.pointA=RT(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):OT(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=RT(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=OT(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=OT(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=OT(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?OT(t.quadrant)?"left":"right":OT(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*(OT(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;e1&&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 jT(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 extends HT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},KT.defaultAttributes,t)),this.name="line-data-label"}labeling(t,e){return DT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}KT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const XT={rect:NT,symbol:VT,arc:UT,line:GT,area:YT,"line-data":KT};class $T extends xb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},$T.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=yT(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(){iM(),aM(),cM(),_M()}function ZT(){iM(),aM(),Xk(),_M()}$T.defaultAttributes={pickable:!1},qT();class JT extends xb{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({},JT.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=um.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=um.line;Y(i)[0].cornerRadius&&(t=um.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=um.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}}JT.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}}},ZT();class QT extends JT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JT.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=um.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 tw,ew;!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"}(tw||(tw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(ew||(ew={}));const iw={[ew.selectedReverse]:{},[ew.selected]:{},[ew.hover]:{},[ew.hoverReverse]:{}},sw={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}}},nw=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 rw(t,e,i){return!gt(t,e,0,1e-6)&&!pt(t,i,0,1e-6)}function aw(t,e,i,s){const n=mm(Object.assign({text:i},s)),r=n.width(),a=n.height(),o=nw(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=rw(o,-l,-h)?((o+l)/c-.5)*r:rw(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=rw(o,-l,-h)?.5*-a:rw(o,h,l)?.5*a:Math.cos(o)>=0?(.5-(h-o)/c)*a:(.5-nw(o-l)/c)*a,{x:p,y:g-m}}function ow(t){const e={};return PM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function lw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function hw(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 VM(r,(s?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}const cw=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!B(s.states)?(s.addState(MM.hover,!0),PM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(MM.hoverReverse,!0)})),s):i},dw=(t,e,i)=>i?(PM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(MM.hoverReverse),t.removeState(MM.hover))})),null):i,uw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(MM.selected)?(PM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(MM.selectedReverse),t.removeState(MM.selected))})),null):s.name&&!B(s.states)?(s.addState(MM.selected,!0),PM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(MM.selectedReverse,!0)})),s):i};class pw extends xb{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=cw(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=dw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=uw(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=um.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&&ow(this._innerView),this.removeAllChild(!0),this._innerView=um.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=um.group({x:0,y:0,zIndex:1});if(a.name=tw.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=um.group({x:0,y:0,pickable:!1});t.name=tw.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=um.group({x:0,y:0,pickable:!1});i.name=tw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=um.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=tw.tick,r.id=this._getNodeId(t.id),B(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=TM;else{const t=this.data[s],e=z({},TM,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=um.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=tw.subTick,r.id=this._getNodeId(`${n}`),B(s.state))r.states=TM;else{const i=z({},TM,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=um.group({x:0,y:0,pickable:!1});return r.name=`${tw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=XM(this._getLabelAttribute(t,e,n,i));if(a.name=tw.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=TM;else{const s=z({},TM,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 QM(Object.assign({},e));i.name=tw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return lw(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({},sw.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 gw(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 mw(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 fw={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&&vw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function vw(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 _w(t,e){for(let i,s=1,n=t.length,r=t[0];s1&&e.height()>1}function bw(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Aw(t,e.attribute.angle)),{angle:Sw(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({},kw(t,e.attribute.angle)),{angle:Sw(e.attribute.angle)}))}))}(t,e),gw(e)}function Sw(){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 Aw(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=Sw(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 kw(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=Sw(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 Mw{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 VM([s[1],-1*s[0]],t*(e?1:-1)*i)}}function Tw(){iM(),aM(),gM(),bM()}var ww=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=NM(_,[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({},iw,c.text),shape:z({},iw,c.shape),panel:z({},iw,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 Aw(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return kw(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)})),xw(i,t),!bw(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(yw);if(B(i))return;let s;s=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i),gw(s);const{method:n="parity",separation:r=0}=e,a=d(n)?n:fw[n]||fw.parity;if(s.length>=3&&_w(s,r)){do{s=a(s,r)}while(s.length>=3&&_w(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&&vw(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=um.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=tw.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=WM(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}}Cw.defaultAttributes=sw,U(Cw,Mw);class Ew{isInValidValue(t){const{startAngle:e=SM,endAngle:i=AM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=SM,endAngle:i=AM,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 hw(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 Pw,Bw=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=um.circle(c);d.name=tw.line,d.id=this._getNodeId("line"),B(a.state)||(d.states=z({},iw,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=Bw(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({},iw,d.text),shape:z({},iw,d.shape),panel:z({},iw,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 aw(t,e,i,s)}}Rw.defaultAttributes=sw,U(Rw,Ew);class Lw extends gc{constructor(){super(...arguments),this.mode=Ao.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},PM(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{Iw[t]=!0}));const Hw=t=>-Math.log(-t),Vw=t=>-Math.exp(-t),Nw=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,Gw=t=>10===t?Nw:t===Math.E?Math.exp:e=>Math.pow(t,e),Ww=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Uw=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),Yw=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function Kw(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 Xw(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function $w(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),$w(t,i,s)*(e/(1-i))}function Zw(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function Jw(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 eC{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=Zw(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 iC=Symbol("implicit");class sC extends eC{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=Pw.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=iC}clone(){const t=(new sC).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!==iC)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 rC extends sC{constructor(t){super(),this.type=Pw.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:nC(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 nC(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 rC(!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:aC}=be;function oC(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=aC(ve.parseColorString(t),s);return t=>e(t).formatRgb()}return St(Number(t),Number(e))}return e instanceof _e?aC(t,e):e instanceof ve?aC(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 lC extends eC{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:zw,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zw;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=zw,this._piecewise=Xw,this._interpolate=oC}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?Jw:Xw,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:zw),this.rescale(i)):this._clamp!==zw}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 hC=Math.sqrt(50),cC=Math.sqrt(10),dC=Math.sqrt(2),uC=[1,2,5,10],pC=(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=vC(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?mC(0,-(e-1)/s,s):mC((e-1)/s,0,s)},gC=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 pC(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return pC(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=mC(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=mC(t,e,l);return n&&r.reverse(),r})),vC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=uC[0];return i>=hC?s=uC[3]:i>=cC?s=uC[2]:i>=dC&&(s=uC[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function _C(t,e,i){const s=(e-t)/Math.max(0,i);return vC(s)}function yC(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=_C(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 xC(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 SC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),AC=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})),kC=mt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=fC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?SC(t,e,n):SC(t,e,tC(n)),h=SC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),MC=mt(((t,e,i,s,n)=>yC(s(t),s(e),i).map((t=>tC(n(t))))));class TC extends lC{constructor(){super(...arguments),this.type=Pw.Linear}clone(){return(new TC).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 gC(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=fC(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 yC(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=xC(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=bC(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=bC(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=bC(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function wC(t){return e=>-t(-e)}function CC(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class EC extends lC{constructor(){super(Ww(10),Gw(10)),this.type=Pw.Log,this._limit=CC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new EC).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=Ww(this._base),s=Gw(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=wC(i),this._pows=wC(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=Hw,this.untransformer=Vw):(this._logs=i,this._pows=s,this._limit=CC(),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 zw}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 AC(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 kC(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 MC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return MC(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=xC(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=Qw(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 PC extends TC{constructor(){super(Uw(1),Yw(1)),this.type=Pw.Symlog,this._const=1}clone(){return(new PC).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=Uw(t),this.untransformer=Yw(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 AC(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 kC(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 MC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return MC(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=xC(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=Qw(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 BC{constructor(){this.type=Pw.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 BC).domain(this._domain).range(this._range).unknown(this._unknown)}}const RC=t=>t.map(((t,e)=>({index:e,value:t}))),LC=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 OC(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function IC(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=GM(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=DC(S,y,m[0],m[m.length-1]):a&&c&&s===e.length-1?T=DC(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=DC(A,b,m[0],m[m.length-1]):a&&d&&s===e.length-1?w=DC(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},jC=(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=GM(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=lw(o,hw(s,o,e,n));return aw(l,hw(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},zC={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&OC(i.AABBBounds,t.AABBBounds,e)||(i=t,0))))}},HC=(t,e,i,s)=>FC(t,e,i).map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),VC=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},NC=(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&&!VC(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?NC(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&&LC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},UC=(t,e)=>{if(Dw(t.type))return((t,e)=>{if(!Dw(t.type))return RC(t.domain());const i=t.range(),s=Math.abs(i[i.length-1]-i[0]);if(s<2)return RC([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=FC(t,h,e).map(((t,e)=>({AABBBounds:t,value:h[e]})));for(;n.length>=3&&IC(n,i);)n=zC.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 RC(h)})(t,e);if(jw(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?RC([s[s.length-1]]):RC([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=HC(t,s,e,c),l=Math.min(...n.map((t=>t[2]))),h=GC(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=HC(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 RC(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=jC(t,i,e),r=$(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=WC(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 RC(c)})(t,e)}return RC(t.domain())};function YC(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 KC(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 XC(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=YC(t,!!n),o=YC(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=KC(e,t,!1,!!n),o=KC(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=YC(t,!!n),o=YC(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class $C extends xb{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&ow(this._innerView),this.removeAllChild(!0),this._innerView=um.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 lw(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?`${tw.grid}-sub`:`${tw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=YC(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=KC(t,o,!1,!!a)}const u=um.path(Object.assign({path:c,z:l},d(r)?z({},this.skipDefault?null:$C.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=YC(o,!!a),f=Rt(o[0].x-o[1].x),v=Rt(o[0].y-o[1].y),_=um.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:$C.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,Mw);var ZC=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(JC,Ew);const QC="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",tE={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:QC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:QC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},eE={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 iE;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(iE||(iE={}));var sE=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=iE.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=iE.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=iE.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=iE.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=iE.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t),"browser"===E_.env&&(E_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),E_.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===iE.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===iE.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=iE.endHandler):h+=l:this._activeTag===iE.endHandler&&(c+l{t.preventDefault();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===iE.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"===E_.env&&(E_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),E_.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===iE.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===iE.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=sE(i,["formatMethod"]),{formatMethod:a}=s,o=sE(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:V={},brushSelect:N,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=V.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:N?"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),N&&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:N?"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:N?"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"},eE.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=V.symbolType)&&void 0!==y?y:"square"},eE.horizontal),V),{pickable:!G&&(null===(b=V.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},eE.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},eE.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"},eE.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=V.symbolType)&&void 0!==R?R:"square"},eE.vertical),V),{pickable:!G&&(null===(L=V.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},eE.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},eE.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 vy(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 QM(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 aE,oE,lE,hE;function cE(){iM(),ZM()}function dE(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 uE(t,e){const{dx:i,dy:s}=dE(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}rE.defaultAttributes=tE,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"}(aE||(aE={})),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"}(oE||(oE={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(lE||(lE={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(hE||(hE={}));class pE extends xb{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=cw(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=dw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=uw(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=um.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=um.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=um.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 gE(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 mE(t,e,i,s){t&&(gE(t.startSymbol,e,i,s),t.lines.forEach((t=>gE(t,e,i,s))),gE(t.line,e,i,s),gE(t.endSymbol,e,i,s))}function fE(t,e,i,s){t&&(gE(t.getTextShape(),e,i,s),gE(t.getBgRect(),e,i,s))}function vE(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 _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,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;gE(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)})),gE(t.endSymbol,s+r+a,o,n),gE(e.getTextShape(),s+r+a+o,l,n),gE(e.getBgRect(),s+r+a+o,l,n)}function xE(t,e,i,s,n){mE(t,s,i,n),fE(e,s,i,n)}function SE(t,e,i,s,n){gE(t,s,i,n),fE(e,s,i,n)}function AE(t,e,i,s,n){gE(t,s,i,n),fE(e,s,i,n)}function kE(t,e,i,s,n,r){var a;mE(t,n,s,r),gE(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?fE(i,n,s,r):gE(i,n,s,r)}function ME(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;gE(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)})),gE(e,n+o+l,h,r),gE(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(gE(i.getTextShape(),n+o+l+h+c,d,r),gE(i.getBgRect(),n+o+l+c,d,r)):gE(i,n+o+l+c,d,r)}function TE(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?bE(t,e,s,r,a):"fadeIn"===i&&xE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?bE(t,e,s,n,a):"fadeIn"===i&&xE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){_E(t,s,i,n),yE(e,s,i,n)}(t,e,i,s,n)}}function wE(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&&SE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&SE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){vE(t,s,i,n),yE(e,s,i,n)}(t,e,i,s,n)}}function CE(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&&AE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&AE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){vE(t,s,i,n),yE(e,s,i,n)}(t,e,i,s,n)}}function EE(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?kE(n,r,e,i,s,o):"callIn"===t&&ME(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?kE(n,r,e,i,s,a):"callIn"===t&&ME(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;_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)}(n,r,e,t,i,s)}}const PE={type:"clipIn",duration:500,easing:"linear",delay:0},BE={type:"fadeIn",duration:500,easing:"linear",delay:0},RE={type:"callIn",duration:500,easing:"linear",delay:0},LE={type:"fadeOut",duration:500,easing:"linear",delay:0};class OE extends pE{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=PE,this.defaultExitAnimation=LE}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;uE(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 QM(Object.assign(Object.assign({},e),{state:{panel:z({},TM,null==i?void 0:i.labelBackground),text:z({},TM,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({},TM,null==e?void 0:e.labelBackground),text:z({},TM,null==e?void 0:e.label)}})),this.setLabelPos())}}const IE=.001,DE={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:aE.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]}},FE={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"}}},jE={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:lE.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]}},zE={interactive:!0,label:{position:oE.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}},HE={interactive:!0,label:{position:lE.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}},VE={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"}},NE={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"}},GE={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 WE(){UE._animate=TE}cE(),qT();class UE extends OE{markerAnimate(t){UE._animate&&this._animationConfig&&UE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UE.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(RM(t)?t:t-Math.PI)+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}getTextStyle(t,e,i){return LM(Math.abs(e),Math.PI/2,IE)||LM(Math.abs(e),3*Math.PI/2,IE)?OM(i,e,t):RM(e)?FE.postiveXAxis[t]:FE.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new JT({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},TM,null==a?void 0:a.line),startSymbol:z({},TM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},TM,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({},TM,null==a?void 0:a.line),startSymbol:z({},TM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},TM,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 YE(){KE._animate=wE}UE.defaultAttributes=DE,cE(),cM();class KE extends pE{markerAnimate(t){KE._animate&&this._animationConfig&&KE._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({},KE.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=BE,this.defaultExitAnimation=LE}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({},NE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;uE(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=um.polygon(Object.assign({points:e},s));r.states=z({},TM,null==n?void 0:n.area),r.name="mark-area-polygon",this._area=r,t.add(r);const a=new QM(Object.assign(Object.assign({},i),{state:{panel:z({},TM,null==n?void 0:n.labelBackground),text:z({},TM,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({},TM,null==s?void 0:s.area)),this._label&&this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},e),{state:{panel:z({},TM,null==s?void 0:s.labelBackground),text:z({},TM,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}}KE.defaultAttributes=zE,cE(),ZT();class XE extends OE{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,{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 lE.arcInnerStart:l=s;case lE.arcOuterStart:l=s;break;case lE.arcInnerEnd:l=n;case lE.arcOuterEnd:l=n;break;case lE.center:case lE.arcInnerMiddle:case lE.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 VE[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 QT({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},TM,null==o?void 0:o.line),startSymbol:z({},TM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},TM,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({},TM,null==o?void 0:o.line),startSymbol:z({},TM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},TM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}}XE.defaultAttributes=jE,cE(),Xk();class $E extends pE{markerAnimate(t){$E._animate&&this._animationConfig&&$E._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({},$E.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcArea",this.defaultUpdateAnimation=BE,this.defaultExitAnimation=LE}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 lE.center:h=(i+s)/2,c=(n+r)/2;break;case lE.arcInnerStart:h=i,c=n;break;case lE.arcOuterStart:h=s,c=n;break;case lE.arcInnerEnd:h=i,c=r;break;case lE.arcOuterEnd:h=s,c=r;break;case lE.arcInnerMiddle:h=i,c=(n+r)/2;break;case lE.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({},VE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;uE(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=um.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));h.states=z({},TM,null==l?void 0:l.area),h.name="polar-mark-area-area",this._area=h,t.add(h);const c=new QM(Object.assign(Object.assign({},o),{state:{panel:z({},TM,null==l?void 0:l.labelBackground),text:z({},TM,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({},TM,null==o?void 0:o.area)),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},a),{state:{panel:z({},TM,null==o?void 0:o.labelBackground),text:z({},TM,null==o?void 0:o.label)}})),this.setLabelPos())}isValidPoints(){return!0}}function qE(){ZE._animate=EE}$E.defaultAttributes=HE,cE(),qT(),ZT(),_M(),nM(),aM();class ZE extends pE{markerAnimate(t){ZE._animate&&this._animationConfig&&ZE._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ZE.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=RE,this.defaultExitAnimation=LE,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return LM(Math.abs(s),Math.PI/2,IE)||LM(Math.abs(s),3*Math.PI/2,IE)?OM(t,s,n):RM(s)?GE.postiveXAxis[n]:GE.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=hE.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({},TM,null==m?void 0:m.textBackground),text:z({},TM,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({},TM,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({},TM,null==m?void 0:m.image));const y=RM(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=um.symbol(Object.assign(Object.assign({},i),r)),h.states=z({},TM,null==s?void 0:s.symbol)):"text"===n?h=new QM(Object.assign(Object.assign({},i),{state:{panel:z({},TM,null==s?void 0:s.textBackground),text:z({},TM,null==s?void 0:s.text)}})):"richText"===n?(h=um.richtext(Object.assign(Object.assign({},i),a)),h.states=z({},TM,null==s?void 0:s.richText)):"image"===n?(h=um.image(Object.assign(Object.assign({},i),o)),h.states=z({},TM,null==s?void 0:s.image)):"custom"===n&&l&&(h=l(),h.states=z({},TM,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=LM(c,0,IE)||LM(d,0,IE),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(aP.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(aP.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===aP.focus||"focus"===o){const s=a.hasState(nP.focus);a.toggleState(nP.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[nP.unSelected,nP.unSelectedHover,nP.focus],t),this._setLegendItemState(e,nP.selected,t)})):(this._setLegendItemState(a,nP.selected,t),this._removeLegendItemState(a,[nP.unSelected,nP.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[nP.selected,nP.selectedHover,nP.focus],t),this._setLegendItemState(e,nP.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(nP.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(nP.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(rP.legendItemClick,a,t);i?(this._removeLegendItemState(a,[nP.selected,nP.selectedHover],t),this._setLegendItemState(a,nP.unSelected,t)):(this._setLegendItemState(a,nP.selected,t),this._removeLegendItemState(a,[nP.unSelected,nP.unSelectedHover],t))}else this._setLegendItemState(a,nP.selected,t),this._removeLegendItemState(a,[nP.unSelected,nP.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[nP.selected,nP.selectedHover],t),this._setLegendItemState(e,nP.unSelected,t))}))}this._dispatchLegendEvent(rP.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,nP.selected),this._removeLegendItemState(e,[nP.unSelected,nP.unSelectedHover])):(this._removeLegendItemState(e,[nP.selected,nP.selectedHover]),this._setLegendItemState(e,nP.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=eP,spaceRow:h=iP}=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;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):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=um.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,aP.item,t,w)):(w=um.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,aP.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?nP.selected:nP.unSelected);const C=um.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=um.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,aP.itemShape,t,w,S.state),s.addState(e?nP.selected:nP.unSelected),C.add(s)}let O=0;if(d){const e=R(g,"size",10);E=um.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},g),{visible:!0,pickMode:"imprecise",boundsPadding:T})),this._appendDataToShape(E,aP.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=XM(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,aP.itemLabel,t,w,A.state),D.addState(e?nP.selected:nP.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=XM(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,aP.itemValue,t,w,k.state),r.addState(e?nP.selected:nP.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(),V=p(this.attribute.item.width)?this.attribute.item.width:z+T[1]+T[3],N=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=V,w.attribute.height=N,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 tP(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 tP(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 EM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:12},t),{width:e})):new EM(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=um.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=eP,spaceRow:a=iP}=s,o=this._itemsContainer,{space:l=sP,defaultCurrent:h=1}=n,c=cP(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 _=um.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(nP.selected)?this._setLegendItemState(t,nP.selectedHover,e):this._setLegendItemState(t,nP.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===aP.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(rP.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(nP.unSelectedHover)||t.hasState(nP.selectedHover))&&(i=!0),t.removeState(nP.unSelectedHover),t.removeState(nP.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(nP.unSelectedHover)&&!t.hasState(nP.selectedHover)||(i=!0),t.removeState(nP.unSelectedHover),t.removeState(nP.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===aP.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(rP.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(rP.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!==aP.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(rP.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!==aP.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(rP.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(nP.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({},dP,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(nP.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 pP;function gP(t){return y(t)?t:[t,t]}function mP(t){return t?"ew-resize":"ns-resize"}uP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:eP,spaceRow:iP,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:sP,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"}(pP||(pP={})),lP();class fP extends xb{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({},fP.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"===E_.env?(E_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),E_.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"===E_.env?(E_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),E_.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"===E_.env?(E_.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),E_.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"===E_.env?(E_.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),E_.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:gP(d)[0],endValue:gP(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const m=um.group({x:0,y:0});m.name=pP.innerView,this.add(m),this._innerView=m;let f,v=0;if(r&&r.visible){f=um.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=pP.startText,m.add(f);const e=p(r.space)?r.space:0;v+=(g?f.AABBBounds.width():f.AABBBounds.height())+e}const _=um.group({x:g?v:0,y:g?0:v});m.add(_);const y=um.group({x:0,y:0});let b;if(y.name=pP.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=um.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=pP.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=um.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=pP.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]=gP(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":mP(p)},r));if(v.name=pP.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=f,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=pP.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":mP(p)},r));if(i.name=pP.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(m,"end");e.name=pP.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=um.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=pP.trackContainer;const f=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===f?"pointer":mP(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=um.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=pP.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return um.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":mP(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),um.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=um.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=um.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===pP.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===pP.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===pP.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===pP.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}}}fP.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}}},hP(),lP();class vP extends oP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},vP.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 _P(){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`}vP.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"}}},hP(),lP(),lM();class yP extends oP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},yP.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=um.group({x:0,y:0});this._innerView.add(x);const S=new fP({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:_P(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=um.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))}}yP.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)"}},iM(),bM(),gM();let bP=class t extends xb{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,V,N,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},wM),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},wM),$),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!==(V=K.width)&&void 0!==V?V: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!==(N=$.width)&&void 0!==N?N: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"))}}}};bP.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 xP={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"}}};iM(),bM(),gM();let SP=class extends xb{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==e)return void(o&&o.hideAll());if(p(i))if(!1!==i.visible){const t=z({},R(xP,"title.style"),i.style);UM(t)?this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},KM(t)),{visible:i.visible,x:0,y:0}),"richtext"):this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},t),{lineHeight:p(t.lineHeight)?t.lineHeight:t.fontSize,visible:i.visible,x:0,y:0}),"text"),i.autoFit&&k(a)&&this._setLocalAutoFit(a,this._title,i),i.autoLimit&&k(r)&&this._title.setAttribute("maxLineWidth",a)}else{const t=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}if(p(s)){const t=Y(s),e=[];t.forEach(((t,s)=>{if(!1!==t.visible){const n=z({},R(xP,"content.style"),t.style);let l;l=UM(n)?o.createOrUpdateChild("indicator-content-"+s,Object.assign(Object.assign({},KM(n)),{visible:i.visible,x:0,y:0}),"richtext"):o.createOrUpdateChild("indicator-content-"+s,Object.assign(Object.assign({},n),{lineHeight:p(n.lineHeight)?n.lineHeight:n.fontSize,visible:t.visible,x:0,y:0}),"text"),t.autoFit&&k(a)&&this._setLocalAutoFit(a,l,t),t.autoLimit&&k(r)&&l.setAttribute("maxLineWidth",a),e.push(l)}else{const t=o.find((t=>t.name==="indicator-content-"+s),!1);t&&o.removeChild(t)}})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.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=WM(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 AP extends _g{constructor(t){super(t)}}var kP,MP;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(kP||(kP={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(MP||(MP={}));class TP extends xb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},TP.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"},TP.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"},TP.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},TP.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},TP.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 AP(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new AP(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new AP(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(kP.OnPlay)},this.pause=()=>{this._dispatchEvent(kP.OnPause)},this.forward=()=>{this._dispatchEvent(kP.OnForward)},this.backward=()=>{this._dispatchEvent(kP.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()}}TP.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},TP.defaultAttributes={[MP.Start]:{},[MP.Pause]:{},[MP.Backward]:{},[MP.Forward]:{}};const wP={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},CP=[200,10];var EP,PP;!function(t){t.Default="default",t.Reverse="reverse"}(EP||(EP={})),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"}(PP||(PP={}));const BP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===EP.Default&&s===i})({direction:e,maxIndex:i,dataIndex:n})||(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===EP.Reverse&&s===i})({direction:e,minIndex:s,dataIndex:n})},RP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===EP.Default&&s===i})({direction:e,minIndex:s,dataIndex:n})||(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===EP.Reverse&&s===i})({direction:e,maxIndex:i,dataIndex:n})},LP=t=>"top"===t||"bottom"===t;class OP extends xb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},OP.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(LP(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:CP[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:CP[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 fP(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 LP(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 TP(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=LP(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:CP[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?(LP(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:LP(this._orient)?t+s:(this._size.width-r)/2,y:LP(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:LP(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:LP(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:LP(this._orient)?t+s:(this._size.width-r)/2,y:LP(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 IP(){lP(),iM(),_M()}OP.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({},wP),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},wP),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},wP),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},wP),{key:"backward",position:"start"})}},IP();class DP extends OP{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:EP.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(kP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(kP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(kP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(kP.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(PP.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(BP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||RP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===EP.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(PP.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=E_.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(PP.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(PP.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=E_.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(),E_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(PP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,E_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(PP.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(PP.change),this.dispatchCustomEvent(PP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var FP,jP=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())}))};IP();class zP extends OP{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(kP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(kP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(kP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(kP.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(PP.change))},this.play=()=>jP(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(PP.play),this._rafId=E_.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=E_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,E_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(PP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,E_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(PP.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(PP.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(PP.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"}(FP||(FP={}));const HP={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}},VP=5;const NP={debounce:bt,throttle:xt};iM(),cM();let GP=class t extends xb{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:NP[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(FP.brushClear,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._container.incrementalClearChild(),this._brushMaskAABBBoundsDict={}):(this._activeDrawState&&this._dispatchEvent(FP.drawEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._activeMoveState&&this._dispatchEvent(FP.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=HP.trigger,updateTrigger:e=HP.updateTrigger,endTrigger:i=HP.endTrigger,resetTrigger:s=HP.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(FP.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(FP.moveStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_drawing(t){var e,i;const s=this.eventPosToStagePos(t),{sizeThreshold:n=VP,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(FP.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(FP.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=um.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)})},UP=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}},YP={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:kM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:kM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:kM,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},KP=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];iM(),uM(),_M(),bM(),gM();let XP=class t extends xb{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:BM(u)&&BM(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:BM(u)&&BM(u.value)},UP(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:BM(u)&&BM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:BM(u)&&BM(u.value)},UP(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},wM),u.value),visible:BM(u)&&BM(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=BM(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 _=BM(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(!BM(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)+(BM(n.key)?r+n.key.spacing:0)+(BM(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&&($M(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:BM(n.key)||"right"===c||(t="left"),m.setAttribute("textAlign",t),$M(c,m,t,u,a),m.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(BM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Dc(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(BM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},UP(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},UP(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},wM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(BM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},UP(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},UP(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=>KP.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)&&BM(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=BM(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=GM(u),y=GM(p);let b=0;if(BM(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(BM(p)){const{width:t,height:e}=y.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}f&&gg[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 WP({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return WP({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};XP.defaultAttributes=YP;const $P=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 ZP(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function JP(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function QP(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 tB(t,e){const i=QP(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 eB(t,e){const i=iB(t),s=iB(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 iB(t,e={x:0,y:0}){return $t.distancePP(t,e)}function sB(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 nB(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const rB=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var oB,lB;!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"}(oB||(oB={})),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.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(lB||(lB={}));const hB="__VCHART",cB=500,dB=500,uB=`${hB}_LABEL_LIMIT`,pB=`${hB}_LABEL_ALIGN`,gB=`${hB}_LABEL_TEXT`,mB=`${hB}_LABEL_VISIBLE`,fB=`${hB}_LABEL_X`,vB=`${hB}_LABEL_Y`,_B=`${hB}_ARC_TRANSFORM_VALUE`,yB=`${hB}_ARC_RATIO`,bB=`${hB}_ARC_START_ANGLE`,xB=`${hB}_ARC_END_ANGLE`,SB=`${hB}_ARC_K`,AB=`${hB}_ARC_MIDDLE_ANGLE`,kB=`${hB}_ARC_QUADRANT`,MB=`${hB}_ARC_RADIAN`,TB=-Math.PI/2,wB=3*Math.PI/2,CB=-90,EB=.6;var PB,BB,RB,LB,OB,IB,DB,FB,jB,zB,HB,VB,NB,GB,WB;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(PB||(PB={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(BB||(BB={})),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"}(RB||(RB={})),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"}(LB||(LB={})),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"}(OB||(OB={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(IB||(IB={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(DB||(DB={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(FB||(FB={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(jB||(jB={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(zB||(zB={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(HB||(HB={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(VB||(VB={})),t.VGRAMMAR_HOOK_EVENT=void 0,(NB=t.VGRAMMAR_HOOK_EVENT||(t.VGRAMMAR_HOOK_EVENT={})).BEFORE_EVALUATE_DATA="beforeEvaluateData",NB.AFTER_EVALUATE_DATA="afterEvaluateData",NB.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",NB.AFTER_EVALUATE_SCALE="afterEvaluateScale",NB.BEFORE_PARSE_VIEW="beforeParseView",NB.AFTER_PARSE_VIEW="afterParseView",NB.BEFORE_TRANSFORM="beforeTransform",NB.AFTER_TRANSFORM="afterTransform",NB.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",NB.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",NB.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",NB.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",NB.BEFORE_STAGE_RESIZE="beforeStageResize",NB.AFTER_STAGE_RESIZE="afterStageResize",NB.BEFORE_VRENDER_DRAW="beforeVRenderDraw",NB.AFTER_VRENDER_DRAW="afterVRenderDraw",NB.BEFORE_MARK_JOIN="beforeMarkJoin",NB.AFTER_MARK_JOIN="afterMarkJoin",NB.BEFORE_MARK_UPDATE="beforeMarkUpdate",NB.AFTER_MARK_UPDATE="afterMarkUpdate",NB.BEFORE_MARK_STATE="beforeMarkState",NB.AFTER_MARK_STATE="afterMarkState",NB.BEFORE_MARK_ENCODE="beforeMarkEncode",NB.AFTER_MARK_ENCODE="afterMarkEncode",NB.BEFORE_DO_LAYOUT="beforeDoLayout",NB.AFTER_DO_LAYOUT="afterDoLayout",NB.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",NB.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",NB.BEFORE_DO_RENDER="beforeDoRender",NB.AFTER_DO_RENDER="afterDoRender",NB.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",NB.AFTER_MARK_RENDER_END="afterMarkRenderEnd",NB.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",NB.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",NB.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",NB.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",NB.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",NB.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",NB.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",NB.BEFORE_ELEMENT_STATE="beforeElementState",NB.AFTER_ELEMENT_STATE="afterElementState",NB.BEFORE_ELEMENT_ENCODE="beforeElementEncode",NB.AFTER_ELEMENT_ENCODE="afterElementEncode",NB.ANIMATION_START="animationStart",NB.ANIMATION_END="animationEnd",NB.ELEMENT_ANIMATION_START="elementAnimationStart",NB.ELEMENT_ANIMATION_END="elementAnimationEnd",NB.ALL_ANIMATION_START="allAnimationStart",NB.ALL_ANIMATION_END="allAnimationEnd",function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(GB||(GB={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(WB||(WB={}));const UB="__vgrammar_scene_item__",YB=[RB.line,RB.area],KB=[RB.arc3d,RB.rect3d,RB.pyramid3d],XB="key",$B=[{}],qB=["key"],ZB=!0,JB=!0,QB=!1,tR=!0,eR="VGRAMMAR_IMMEDIATE_ANIMATION",iR=0,sR=1e3,nR=0,rR=0,aR=!1,oR=!1,lR="quintInOut",hR={stopWhenStateChange:!1,immediatelyApply:!0};function cR(t,e){return Y(t).reduce(((t,i)=>{const s=_(i)?e.getGrammarById(i):i;return s&&t.push(s),t}),[])}function dR(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 cR(t.dependency,e);var i;return[]}function uR(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function pR(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 gR(t,e){return mR(t)?t.output():e[t]}const mR=t=>t&&!u(t.grammarType),fR=t=>d(t)?t:e=>e[t];function vR(t){return!!(null==t?void 0:t.scale)}function _R(t){return!!(null==t?void 0:t.field)}function yR(t,e){if(!t)return[];let i=[];return t.scale&&(i=mR(t.scale)?[t.scale]:Y(e.getScaleById(t.scale))),i.concat(dR(t,e))}function bR(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 xR(t,e,i,s,n){i&&(uR(i)?e.forEach((e=>{const n=pR(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 RB.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case RB.group:case RB.rect:case RB.image:return["width","height","y1"].includes(e);case RB.path:case RB.shape:return["path","customPath"].includes(e);case RB.line:return"defined"===e;case RB.area:return["x1","y1","defined"].includes(e);case RB.rule:return["x1","y1"].includes(e);case RB.symbol:return"size"===e;case RB.polygon:return"points"===e;case RB.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(vR(l)){const t=gR(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?hb(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(_R(l)){const t=hb(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=pR(l,s,e.datum,t)}))})))}function SR(t,e,i,s){if(!t)return null;if(uR(t))return pR(t,s,e,i);const n={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(vR(h)){const t=gR(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?hb(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(_R(h)){const t=hb(h.field);n[r]=t(e)}else n[r]=pR(h,s,e,i)})),n}class AR{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 kR=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]}};kR._plotMarks={},kR._marks={},kR._components={},kR._graphicComponents={},kR._transforms={},kR._grammars={},kR._glyphs={},kR._animations={},kR._interactions={},kR._graphics={},kR.registerGlyph=(t,e,i,s,n)=>(kR._glyphs[t]=new AR(e,i,s,n),kR._glyphs[t]),kR.registerAnimationType=(t,e)=>{kR._animations[t]=e},kR.getAnimationType=t=>kR._animations[t],kR.registerInteraction=(t,e)=>{kR._interactions[t]=e},kR.registerGraphic=(t,e)=>{kR._graphics[t]=e},kR.getGraphicType=t=>kR._graphics[t],kR.createGraphic=(t,e)=>{const i=kR._graphics[t];return i?i(e):null};const MR=t=>!!RB[t];function TR(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var s;const n=kR.getGraphicType(e)?kR.createGraphic(e,i):kR.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 wR=t=>{t&&(t[UB]=null,t.release(),t.parent&&t.parent.removeChild(t))},CR=["fillOpacity"],ER=(t,e,i)=>{var s;return"fillOpacity"===e?(t.fillOpacity=null!==(s=i.fillOpacity)&&void 0!==s?s:1,["fillOpacity"]):[]};const PR={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"}],[RB.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"}],[RB.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"}],[RB.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 BR=(t,e,i,s)=>{const n={},r=e?Object.keys(e):[],a=_(t)?PR[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||(CR.includes(r)?ER(n,r,e):n[r]=e[r])}))}else r.forEach((t=>{CR.includes(t)?ER(n,t,e):n[t]=e[t]}));return n},RR=(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),LR=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],OR=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(LR);function IR(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)?OR:LR,r=[];let a=null;return t.forEach(((t,e)=>{a&&n.every((e=>RR(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=DR(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function DR(t){const e={};return t?(Object.keys(t).forEach((i=>{"x"!==i&&"y"!==i&&"x1"!==i&&"y1"!==i&&"defined"!==i&&"size"!==i&&"width"!==i&&"height"!==i&&"context"!==i&&(e[i]=t[i])})),e):e}let FR=class{constructor(t){this.data=null,this.states=[],this.diffState=BB.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:{}})));xR(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?BR(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[UB]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?BR(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t)))}updateGraphicItem(){if(!this.graphicItem)return;this.diffState===BB.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&&(wR(this.graphicItem),this.graphicItem[UB]=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=fR(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(pR(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===BB.unChange&&(this.diffState=BB.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&(this.mark.isCollectionMark()&&delete t.defined,Object.assign(e,t)),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==BB.enter&&this.diffState!==BB.update||!this.states.length||this.useStates(this.states),this.mark.markType===RB.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 hl))}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[PB.update],a=e[PB.enter],o=e[PB.exit],l=this.mark.isLargeMode()||n&&!this.mark.getSpec().enableSegments;this.diffState===BB.enter?(a&&xR(this,t,a,s,l),r&&xR(this,t,r,s,l)):this.diffState===BB.update?((n&&a||i)&&xR(this,t,a,s,l),r&&xR(this,t,r,s,l)):this.diffState===BB.exit&&o&&(i&&xR(this,t,a,s,l),xR(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)pb(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[RB.line,RB.area,RB.largeRects,RB.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(s=l.nextAttrs)||void 0===s?void 0:s.points)&&(!0===i||bR(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[PB.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=DR(h),e===RB.line||e===RB.area){const i=function(t,e,i,s){return t&&t.length&&(1!==t.length||e)?t.some((t=>bR(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===RB.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=IR(e.items,e.points,i);if(s)return void s.forEach((e=>{t.push(e)}))}const n=DR(e.items[0]);n.points=e.points,t.push(n)})),t}return s?IR(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=SR(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=IR(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t)}else h.points=i,h.segments=null}else e===RB.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===RB.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}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&&(wR(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 jR{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 zR=(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 HR extends jR{constructor(t,e){super(t,e),this.type=HR.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({},HR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=zR(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()}}HR.type="element-select",HR.defaultOptions={state:WB.selected,trigger:"click"};class VR extends jR{constructor(t,e){super(t,e),this.type=VR.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},VR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=zR(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 NR(t){if(t)return t.type===Pw.Band?t.bandwidth():t.type===Pw.Point?t.step():void 0}VR.type="element-highlight",VR.defaultOptions={highlightState:WB.highlight,blurState:WB.blur,trigger:"pointerover",triggerOff:"pointerout"};class GR{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 WR=()=>{U(HR,GR),kR.registerInteraction(HR.type,HR)},UR=()=>{U(VR,GR),kR.registerInteraction(VR.type,VR)},YR=(t,e)=>mR(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,KR=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,s)=>{const n=t[s];return i[s]=YR(n,e),i}),{}):t.map((t=>YR(t,e))):t;let XR=-1;class $R extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++XR}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(dR(this.spec[e],this.view)),this.spec[e]=t,this.attach(dR(t,this.view)),this.commit(),this}}const qR=(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=dR(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}},ZR=(t,e)=>{const i=kR.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(cR(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(y(e)){const s=e.map((e=>qR(t,e,i)));return{references:s.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:s.map((t=>t.value))}}return qR(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}},JR=(t,e)=>{if(null==t?void 0:t.length){const i=[];let s=[];return t.forEach((t=>{var n;const r=ZR(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},QR={csv:Ur,dsv:Wr,tsv:Yr,json:function(t){if(!_(t))return Y(t);try{return Y(JSON.parse(t))}catch(t){return[]}}};class tL extends $R{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||!QR[e.type])return Y(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return QR[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?dR(t.format,this.view)[0]:null;if(s&&e.push(s),t.values){const s=dR(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=dR(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=mR(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=JR(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=JR(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 eL="window",iL="view",sL={trap:!1},nL="width",rL="height",aL="viewWidth",oL="viewHeight",lL="padding",hL="viewBox",cL="autoFit";function dL(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 uL(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,dL(t,e,n,s)}class pL{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 dL(this.nodes,e,0,this.compare),uL(this.nodes,e,null,this.compare)}return this.nodes.push(t),dL(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)),dL(this.nodes,e,0,this.compare),uL(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,uL(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class gL{constructor(t){this.list=[],this.ids={},this.idFunc=t||cb}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 mL{constructor(){this.grammars=[],this.logger=rt.getInstance(),this._curRank=0,this._committed=new gL((t=>t.uid)),this._heap=new pL(((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 gL((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 fL=(t,e,i,s,n)=>{const r=t=>{if(n||!t||s&&!s(t)||i.call(null,t),t.markType===RB.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}n&&(!t||s&&!s(t)||i.call(null,t))};r(t)};class vL{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 Xd(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Ol.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 Z_(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 Xb(o)),null===(r=this._eventConfig)||void 0===r?void 0:r.gesture){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new Zb(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 _L(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 yL(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 bL(t,e,i,s,n){if(n===eL){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{yL(t,_L(t),!1)}))}));const e=_L(t);yL(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e}class xL extends $R{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?pR(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}},ML=(t,e)=>e&&e.debounce?bt(t,e.debounce):e&&e.throttle?xt(t,e.throttle):t;class TL extends FR{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 xR(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[UB]=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?BR(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);this.graphicItem||this.initGraphicItem(),this.diffState===BB.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==BB.enter&&this.diffState!==BB.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.diffState===BB.enter&&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=BR(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=PR[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===RB.shape&&(o.datum=d[0].datum)})),s}}_generateGlyphItems(t,e,i){const s=e.map((t=>Object.assign({},t,{nextAttrs:i})));return YB.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)pb(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[UB]=null})),this.glyphGraphicItems=null),super.release()}}const wL=t=>t.markType===RB.glyph?new TL(t):new FR(t);function CL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(XB,i?t.slice().sort(i):t.slice()),{keys:qB,data:s};const n=fR(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 EL{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?CL(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 PL=(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=bR(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=bR(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 BL=(t,e,i,s,n)=>d(i)?i(t.getDatum(),t,n):i;class RL extends gc{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 LL extends gc{getEndProps(){return this.to}onBind(){var t;const e=null!==(t=this.target.constructor.NOWORK_ANIMATE_ATTR)&&void 0!==t?t:Dd,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)}}fc.mode|=Ao.SET_ATTR_IMMEDIATELY;let OL=0;const IL=t=>!u(t)&&(t.prototype instanceof gc||"onBind"in t.prototype&&"onStart"in t.prototype&&"onEnd"in t.prototype&&"onUpdate"in t.prototype);class DL{constructor(t,e,i){this.id=OL++,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||!kR.getAnimationType(e.type))return null;const r=kR.getAnimationType(e.type)(t,n,i);return PL(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?BL(t,0,n[i].from,0,s):void 0,e.to[i]=l?BL(t,0,n[i].to,0,s):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),PL(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=IL(o);return u(o)||IL(o)?h?new o(r.from,r.to,a,t.easing,l):r.to?new LL(r.from,r.to,a,t.easing):void 0:new RL(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 Wc(a,e))}r>0&&t.wait(r)}}function FL(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(jL(i,t[i]))})),e}function jL(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:iR,totalTime:h.totalTime,oneByOne:null!==(i=h.oneByOne)&&void 0!==i?i:oR,loop:null!==(s=h.loop)&&void 0!==s?s:aR,controlOptions:z({},hR,null!==(n=h.controlOptions)&&void 0!==n?n:{}),timeSlices:[{duration:null!==(r=h.duration)&&void 0!==r?r:sR,delay:null!==(a=h.delay)&&void 0!==a?a:nR,delayAfter:null!==(o=h.delayAfter)&&void 0!==o?o:rR,effects:[{type:h.type,channel:h.channel,custom:h.custom,easing:null!==(l=h.easing)&&void 0!==l?l:lR,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:iR,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:oR,loop:null!==(d=t.loop)&&void 0!==d?d:aR,controlOptions:z({},hR,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:nR,delayAfter:null!==(i=t.delayAfter)&&void 0!==i?i:rR,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:lR,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 zL(t,e,i){return d(t)?t.call(null,e.getDatum(),e,i):t}class HL{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 VL{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=FL(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=FL(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!==BB.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 HL(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=jL(eR,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 HL(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===BB.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 DL(s,i,e);if(l.animate(n,r),!l.isAnimating)return;s.diffState===BB.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=pR(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,s,n){const r=[],a=zL(t.startTime,e,n),o=zL(t.totalTime,e,n),l=zL(t.oneByOne,e,n),h=zL(t.loop,e,n);let c=0;t.timeSlices.forEach((t=>{var i;const a=zL(t.delay,e,n),l=zL(t.delayAfter,e,n),h=null!==(i=zL(t.duration,e,n))&&void 0!==i?i:o/s,d=Y(t.effects).map((t=>Object.assign({},t,{customParameters:zL(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===BB.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===BB.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===eR,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===BB.exit&&0===o[BB.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 NL extends $R{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new VL(this,{}),this.differ=new EL([]),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===BB.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(e,i){var s;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===VB.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:$B,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===RB.group)return;const e=CL(null!=t?t:$B,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(BB.update,t,e,i)}encodeState(t,e,i,s){if(t===BB.enter&&(this._isReentered=!0),this.spec.encode[t]){const n=this.spec.encode[t];if(uR(n))this.detach(yR(n,this.view));else{const r=_(e);r&&s||!r&&i?(Object.keys(n).forEach((t=>{this.detach(yR(n[t],this.view))})),this.spec.encode[t]={}):r?this.detach(yR(n[e],this.view)):Object.keys(e).forEach((t=>{this.detach(yR(n[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),_(e)?(this.spec.encode[t][e]=i,this.attach(yR(i,this.view))):uR(e)?(this.spec.encode[t]=e,this.attach(yR(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(yR(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=JR(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=JR(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 YB.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!==BB.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===GB.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&&!uR(n)&&Object.keys(n).forEach((t=>{vR(n[t])&&(e[t]=gR(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];uR(s)||Object.keys(s).forEach((t=>{_R(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[UB];if((null==s?void 0:s.mark)===this){const i=bL(this.view,t,s,0,iL);this.emitGrammarEvent(e,i,s)}},this.initEvent()),this.animate||(this.animate=new VL(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=gR(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!==RB.group){if(!this.graphicItem){const t=TR(this,RB.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||KB.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||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==RB.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=fR(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:()=>XB),a=fR(null!==(n=this.spec.groupBy)&&void 0!==n?n:()=>XB),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===BB.enter))),c=[];this.differ.setCallback(((t,e,i)=>{const s=t;let n;if(u(e))n=this.elementMap.get(s),n&&(n.diffState=BB.exit);else if(u(i)){n=this.elementMap.has(s)?this.elementMap.get(s):wL(this),n.diffState===BB.exit&&(n.diffState=BB.enter,this.animate.getElementAnimators(n,BB.exit).forEach((t=>t.stop("start")))),n.diffState=BB.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=BB.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:$B;l||this.differ.setCurrentData(CL(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]=SR(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[PB.group],s);e.forEach((t=>{this.markType===RB.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._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:TR(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!==RB.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=fR(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:()=>XB),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=wL(this);e.diffState=BB.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=wL(this);i.diffState=BB.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!==RB.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=TR(this,RB.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!==BB.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:PR[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=BB.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&&wR(this.graphicItem),this.detachAll(),super.release()}}let GL=class extends NL{constructor(t,e){super(t,RB.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===RB.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 PR.rect}evaluateJoin(t){if(!this.elements.length){const t=wL(this);t.updateData(XB,$B,(()=>""),this.view),this.elements=[t],this.elementMap.set(XB,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 xR(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[PB.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:TR(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 WL(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 UL(t,e){return Math.min(t<0?t+e:t-1,e)}function YL(t,e,i){let s=UL(t,i),n=UL(e,i);if(k(t)||k(e)?k(t)?k(e)||(s=UL(Math.max(0,n-1),i)):n=UL(s+1,i):(s=1,n=2),s>n){const t=n;n=s,s=t}return{start:s,end:n}}const KL=(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=>WL(t,i))),u=l.map((t=>WL(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}=YL(e,i,r),{start:h,end:c}=YL(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()}))},XL={[LB.axis]:0,[LB.legend]:1,[LB.slider]:2,[LB.player]:3,[LB.datazoom]:4},$L=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=XL[t.componentType])&&void 0!==s?s:1/0},qL=(t,e,i,s)=>{const n=i.clone(),r=t.getSpec().layout,a=gb(r.maxChildWidth,n.width()),o=gb(r.maxChildHeight,n.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=kL(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&&d$L(t)-$L(e)));for(let t=0,e=f.length;t{null==t||t.forEach((t=>{var s;if(t.markType!==RB.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=qL(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(aL,o),i.updateSignal(oL,l),i.updateSignal(lL,h)}else qL(t,n,a,e);else"grid"===r.display&&KL(t,n,a);ZL(n,e,i)}}))};class JL extends NL{constructor(t,e,i){super(t,RB.glyph,i),this.glyphType=e,this.glyphMeta=kR.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(!kR.getGraphicType(RB.glyph))return;const s=kR.createGraphic(RB.glyph,i),n=e.getMarks(),r=Object.keys(n).map((t=>{if(kR.getGraphicType(n[t])){const e=kR.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 QL=Symbol.for("key");class tO{diffGrammar(t,e){return function(t,e,i){const s={enter:[],exit:[],update:[]},n=new EL(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(CL(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!==RB.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==RB.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=CL(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=CL(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=fR(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 EL(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(CL(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:QL})),r=CL(e,(t=>{var e;return null!==(e=s(t))&&void 0!==e?e:QL}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==QL){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=pR(i.animation.delay,n,o,l),d=pR(i.animation.duration,n,o,l),u=pR(i.animation.oneByOne,n,o,l),p=pR(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)?Md:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Td)(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);xd(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)?Md:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Td)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>vd(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>yd(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 bd({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:xc,null!==(l=i.easing)&&void 0!==l?l:Sc))}))}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 Sd({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:xc,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Sc))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):xd(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 eO{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 iO extends eO{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===RB.group&&s.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===RB.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=>{const s=t.mark;s.markType===RB.group&&s.includesChild(e,!1)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===RB.group&&e.includesChild(s,!1)&&(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 sO{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 nO extends NL{addGraphicItem(t,e){const i=t&&t.limitAttrs,s=TR(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?RB.richtext:RB.text,t);return super.addGraphicItem(t,e,s)}release(){super.release()}}nO.markType=RB.text;const rO={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)"}}},aO={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},oO=Object.assign({},rO);oO.axis=Object.assign({},oO.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),oO.circleAxis=Object.assign({},oO.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),oO.grid=Object.assign({},oO.grid,{style:{stroke:"#404349"}}),oO.circleGrid=Object.assign({},oO.circleGrid,{style:{stroke:"#404349"}}),oO.rectLabel=Object.assign({},oO.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),oO.lineLabel=Object.assign({},oO.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),oO.symbolLabel=Object.assign({},oO.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),oO.title=Object.assign({},oO.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const lO={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:aO,components:oO},hO={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:aO,components:rO};let cO=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")}};cO._themes=new Map,cO.registerTheme("default",hO),cO.registerTheme("dark",lO);class dO extends NL{constructor(t,e,i,s){super(t,RB.component,i),this._componentDatum={[XB]: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:kR.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,XB)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[XB]+=1}evaluateJoin(t){return this.spec.key=XB,t?(t[XB]=this._componentDatum[XB],this._componentDatum=t):this._componentDatum={[XB]:this._componentDatum[XB]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}class uO 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[UB],n=bL(0,t,s,0,iL);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(mR(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)):MR(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 xL(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 tL(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=kR.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=kR.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 RB.group:n=new GL(this,s);break;case RB.glyph:n=new JL(this,null==i?void 0:i.glyphType,s);break;case RB.component:n=kR.hasComponent(null==i?void 0:i.componentType)?kR.createComponent(null==i?void 0:i.componentType,this,s,null==i?void 0:i.mode):new dO(this,null==i?void 0:i.componentType,s,null==i?void 0:i.mode);break;case RB.text:n=new nO(this,t,s);break;default:n=kR.hasMark(t)?kR.createMark(t,this,s):new NL(this,t,s)}return this.grammars.record(n),this._dataflow.add(n),n}group(t){return this.mark(RB.group,t)}glyph(t,e){return this.mark(RB.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(RB.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(RB.component,t,{componentType:LB.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(RB.component,t,{componentType:LB.grid,mode:e})}legend(t){return this.mark(RB.component,t,{componentType:LB.legend})}slider(t){return this.mark(RB.component,t,{componentType:LB.slider})}label(t){return this.mark(RB.component,t,{componentType:LB.label})}datazoom(t){return this.mark(RB.component,t,{componentType:LB.datazoom})}player(t){return this.mark(RB.component,t,{componentType:LB.player})}title(t){return this.mark(RB.component,t,{componentType:LB.title})}scrollbar(t){return this.mark(RB.component,t,{componentType:LB.scrollbar})}customized(t,e){const i=kR.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&&AL.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&(wR(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_"+ ++SL;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(cO.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(nL,t.width),this.updateSignal(rL,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=kR.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=VB.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var s,n,r,a,o;return[{id:nL,value:null!==(s=t[nL])&&void 0!==s?s:0},{id:rL,value:null!==(n=t[rL])&&void 0!==n?n:0},{id:lL,value:kL(null!==(a=null!==(r=t[lL])&&void 0!==r?r:e[lL])&&void 0!==a?a:null==i?void 0:i.padding)},{id:aL,update:{callback:(t,e)=>{const i=kL(e[lL]);return e[nL]-i.left-i.right},dependency:[nL,lL]}},{id:oL,update:{callback:(t,e)=>{const i=kL(e[lL]);return e[rL]-i.top-i.bottom},dependency:[rL,lL]}},{id:hL,update:{callback:(t,e)=>{const i=kL(e[lL]);return(t||new Zt).setValue(i.left,i.top,i.left+e[aL],i.top+e[oL])},dependency:[aL,oL,lL]}},{id:cL,value:null!==(o=t[cL])&&void 0!==o?o:e[cL]}]})(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===RB.glyph?{glyphType:t.glyphType}:t.type===RB.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=cO.getTheme(t))&&void 0!==e?e:cO.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(nL);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(rL);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(aL);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(oL);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(lL);if(arguments.length){const i=kL(t);return this.updateSignal(e,i),i}return kL(e.output())}autoFit(t){const e=this.getSignalById(cL);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(hL);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=VB.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===RB.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var e;const i=this._options.doLayout||ZL;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=>{fL(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),fL(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=ZB,morph:o=JB,morphAll:l=QB,animation:h={},enableExitAnimation:c=tR}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:lR,delay:null!==(i=h.delay)&&void 0!==i?i:nR,duration:null!==(s=h.duration)&&void 0!==s?s:sR,oneByOne:null!==(n=h.oneByOne)&&void 0!==n?n:oR,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=VB.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=VB.reevaluate,this._dataflow.evaluate()),this._layoutState=VB.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=>!AL.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 fL(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(nL,t)),e!==this.height()&&(s=!0,this.updateSignal(rL,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]:iL;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):MR(t)?(i.markType=t,i.source=e):i.source=t===eL?eL: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=cR(l,this),v=ML(((t,e)=>{const s=c===iL&&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===eL&&(t=bL(0,t,e,0,eL));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===iL){if(function(t,e,i){const s=null==t?void 0:t[e];return!(!1===s||g(s)&&!s[i])}(this._eventConfig,iL,d))return this.addEventListener(d,v,sL),()=>{this.removeEventListener(d,v)}}else if(c===eL)return E_.addEventListener(d,v),this._eventListeners.push({type:d,source:E_,handler:v}),()=>{E_.removeEventListener(d,v);const t=this._eventListeners.findIndex((t=>t.type===d&&t.source===E_&&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=kR.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 vL(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e;this.grammars=new eO((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new iO((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 mL,this.animate=new sO(this),this._morph=new tO,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,[iL,eL]),e}(this._options.eventConfig),this._theme=this._options.disableTheme?null:cO.getDefaultTheme(),this.parseBuiltIn(),(e=this._options).mode&&E_.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=VB.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!==RB.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=E_.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&E_.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(),kR.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 pO=()=>{fM(),lM(),kR.registerGraphic(RB.path,Vg)},gO=()=>{fM(),uM(),kR.registerGraphic(RB.rect,Mg)},mO=()=>{fM(),aM(),kR.registerGraphic(RB.rule,Sg)},fO=()=>{fM(),_M(),kR.registerGraphic(RB.symbol,yg)},vO=()=>{fM(),bM(),gM(),kR.registerGraphic(RB.text,gp)},_O=()=>{fM(),tM(),kR.registerGraphic(RB.glyph,wg)},yO=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},bO=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},xO=(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(_b(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},SO=(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&&_b(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},AO=yO(xO),kO=bO(xO);const MO=(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(_b(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},TO=(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&&_b(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},wO=yO(MO),CO=bO(MO);const EO=(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`},PO=(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`},BO=(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)?PO:EO,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)}}:{}},RO=(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}},LO=(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})}},OO=(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 IO extends dO{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 DO=(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 FO extends IO{constructor(t,e,i){super(t,LB.axis,e),this.spec.componentType=LB.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=kR.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=SR(n,e,i,s);const h=pR(this.spec.inside,s,e,i),c=pR(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(DO(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=pR(this.spec.tickCount,s,e,i);switch(this._getAxisComponentType()){case IB.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 IB.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?IB.circleAxis:IB.lineAxis,this._axisComponentType}}FO.componentType=LB.axis;let jO=class extends dO{constructor(t,e){super(t,LB.label,e),this.spec.componentType=LB.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=pR(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=pR(s,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case RB.line:case RB.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case RB.rect:case RB.rect3d:case RB.interval:g=p.rectLabel;break;case RB.symbol:case RB.circle:case RB.cell:g=p.symbolLabel;break;case RB.arc:case RB.arc3d:g=p.arcLabel;break;case RB.polygon:case RB.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=SR(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=SR(i,t,e,d);m.push(z({},f,s))}));else{const t=SR(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}};jO.componentType=LB.label;const zO=()=>{kR.registerGraphicComponent(LB.label,(t=>new $T(t))),kR.registerComponent(LB.label,jO)};class HO extends IO{constructor(t,e,i){super(t,LB.grid,e),this.spec.componentType=LB.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=kR.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=SR(s,t,e,i);const d=pR(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 DB.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 DB.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=pR(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(DO(h,n,s,d,this.spec.layout,!0),c))}this._getGridComponentType()===DB.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=pR(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case DB.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 DB.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=DB.circleAxisGrid:this._gridComponentType=DB.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case IB.circleAxis:this._gridComponentType=DB.circleAxisGrid;break;case IB.lineAxis:default:this._gridComponentType=DB.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()?DB.lineAxisGrid:DB.circleAxisGrid:DB.lineAxisGrid}else this._gridComponentType=DB.lineAxisGrid;return this._gridComponentType}}HO.componentType=LB.grid;const VO=(t,e,i)=>e.filter((e=>t.callback(e,i))),NO=(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 GO(t){return t.reduce(((t,e)=>t+e),0)}const WO={min:$,max:X,average:function(t){return 0===t.length?0:GO(t)/t.length},sum:GO};function UO(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 YO(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 KO(t,e,i,s){return YO(t,e,i,"min",s)}function XO(t,e,i,s){return YO(t,e,i,"max",s)}function $O(t,e,i,s){return YO(t,e,i,"average",s)}function qO(t,e,i,s){return YO(t,e,i,"sum",s)}const ZO=(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=UO;if("min"===n?l=KO:"max"===n?l=XO:"average"===n?l=$O:"sum"===n&&(l=qO),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[]},JO="_mo_hide_";const QO=(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(JO)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(JO,!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(JO,!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},tI=()=>{kR.registerTransform("filter",{transform:VO,markPhase:"beforeJoin"},!0)},eI=()=>{kR.registerTransform("map",{transform:NO,markPhase:"beforeJoin"},!0)},iI=()=>{kR.registerTransform("sampling",{transform:ZO,markPhase:"afterEncode"},!0)},sI=()=>{kR.registerTransform("markoverlap",{transform:QO,markPhase:"afterEncode"},!0)},nI=(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}}},rI=(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}}},aI=(t,e,i)=>{var s,n,r,a;const o=null!==(s=t.getFinalGraphicAttributes())&&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}}},oI=(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}}},lI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("y",!1),i=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1),n=t.getGraphicAttribute("y",!1),r=t.getGraphicAttribute("y1",!1),a=t.getGraphicAttribute("height",!1),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}}}}},hI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("y",!1),i=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("x1",!1),n=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicAttribute("height",!1),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 cI=(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.getGraphicAttribute("x",!1),r=t.getGraphicAttribute("x1",!1),a=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);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 dI=(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.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);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 uI=(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.getGraphicAttribute("y",!1),r=t.getGraphicAttribute("y1",!1),a=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("y",!1),n=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);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 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.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("y",!1),n=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);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)},gI=(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.getFinalGraphicAttributes();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.getFinalGraphicAttributes();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)},mI=(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.getFinalGraphicAttributes();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)},fI=(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.getFinalGraphicAttributes(),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.getFinalGraphicAttributes();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)},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=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.getFinalGraphicAttributes();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)},_I=(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((()=>Object.assign(n)))},yI=(t,e,i)=>({from:{points:_I(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),bI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:_I(t,e)}}),xI=(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),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}})),SI=(t,e,i)=>({from:{points:xI(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),AI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:xI(t,e,i)}}),kI=(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),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,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)=>{var s,n;const{offset:r=0,orient:a,direction:o,point:l}=null!=e?e:{};let h=0,c=0;"negative"===a&&(i.group?(h=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),c=null!==(n=i.groupHeight)&&void 0!==n?n:i.group.getBounds().height(),i.groupWidth=h,i.groupHeight=c):(h=i.width,c=i.height)),h+=r,c+=r;const u=d(l)?l.call(null,t.getDatum(),t,i):l,p=u&&k(u.x)?u.x:h,g=u&&k(u.y)?u.y:c,m=t.getFinalGraphicAttributes();switch(o){case"x":return{from:{x:p},to:{x:null==m?void 0:m.x}};case"y":return{from:{y:g},to:{y:null==m?void 0:m.y}};default:return{from:{x:p,y:g},to:{x:null==m?void 0:m.x,y:null==m?void 0:m.y}}}},CI=(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}}}},EI=(t,e,i)=>{var s,n,r,a;const o=t.getFinalGraphicAttributes();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}}}},PI=(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}}}},BI={symbol:["_mo_hide_","visible"]},RI=(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=BI[t.mark.markType])&&r.forEach((t=>{delete s[t],delete n[t]})),Object.keys(n).forEach((t=>{pb(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}},LI=(t,e,i)=>{var s,n;const r=null!==(n=null===(s=t.getFinalGraphicAttributes())||void 0===s?void 0:s.angle)&&void 0!==n?n:0;let a=0;return a=ut(r/(2*Math.PI),0)?Math.round(r/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(r/(2*Math.PI))*Math.PI*2:Math.floor(r/(2*Math.PI))*Math.PI*2,{from:{angle:a},to:{angle:r}}},OI=(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}}},II=()=>{kR.registerAnimationType("clipIn",nI)},DI=()=>{kR.registerAnimationType("clipOut",rI)},FI=()=>{kR.registerAnimationType("fadeIn",aI)},jI=()=>{kR.registerAnimationType("fadeOut",oI)},zI=()=>{kR.registerAnimationType("growCenterIn",lI)},HI=()=>{kR.registerAnimationType("growCenterOut",hI)},VI=()=>{kR.registerAnimationType("growHeightIn",uI)},NI=()=>{kR.registerAnimationType("growHeightOut",pI)},GI=()=>{kR.registerAnimationType("growWidthIn",cI)},WI=()=>{kR.registerAnimationType("growWidthOut",dI)},UI=()=>{kR.registerAnimationType("growPointsIn",yI)},YI=()=>{kR.registerAnimationType("growPointsOut",bI)},KI=()=>{kR.registerAnimationType("growPointsXIn",SI)},XI=()=>{kR.registerAnimationType("growPointsXOut",AI)},$I=()=>{kR.registerAnimationType("growPointsYIn",MI)},qI=()=>{kR.registerAnimationType("growPointsYOut",TI)},ZI=()=>{kR.registerAnimationType("growAngleIn",gI)},JI=()=>{kR.registerAnimationType("growAngleOut",mI)},QI=()=>{kR.registerAnimationType("growRadiusIn",fI)},tD=()=>{kR.registerAnimationType("growRadiusOut",vI)},eD=()=>{kR.registerAnimationType("moveIn",wI)},iD=()=>{kR.registerAnimationType("moveOut",CI)},sD=()=>{kR.registerAnimationType("scaleIn",EI)},nD=()=>{kR.registerAnimationType("scaleOut",PI)},rD=()=>{kR.registerAnimationType("rotateIn",LI)},aD=()=>{kR.registerAnimationType("rotateOut",OI)},oD=()=>{kR.registerAnimationType("update",RI)};class lD extends NL{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=uR(e)?null:Object.keys(e).reduce(((t,s)=>(vR(e[s])&&(t[s]=gR(e[s].scale,i)),t)),{});this._encoders[t]={callback:(t,i,n)=>{const r=SR(e,t,i,n);if(u(r.size)){const t=s.x?NR(s.x):void 0,e=s.y?NR(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(PR.symbol)}release(){super.release(),this._encoders=null}}lD.markType=RB.cell;const hD=["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 cD,dD,uD;t.ChartEvent=void 0,(cD=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",cD.rendered="rendered",cD.renderFinished="renderFinished",cD.animationFinished="animationFinished",cD.regionSeriesDataFilterOver="regionSeriesDataFilterOver",cD.afterInitData="afterInitData",cD.afterInitEvent="afterInitEvent",cD.afterInitMark="afterInitMark",cD.rawDataUpdate="rawDataUpdate",cD.viewDataFilterOver="viewDataFilterOver",cD.viewDataUpdate="viewDataUpdate",cD.viewDataStatisticsUpdate="viewDataStatisticsUpdate",cD.markDeltaYUpdate="markDeltaYUpdate",cD.viewDataLabelUpdate="viewDataLabelUpdate",cD.scaleDomainUpdate="scaleDomainUpdate",cD.scaleUpdate="scaleUpdate",cD.dataZoomChange="dataZoomChange",cD.drill="drill",cD.layoutStart="layoutStart",cD.layoutEnd="layoutEnd",cD.layoutRectUpdate="layoutRectUpdate",cD.playerPlay="playerPlay",cD.playerPause="playerPause",cD.playerEnd="playerEnd",cD.playerChange="playerChange",cD.playerForward="playerForward",cD.playerBackward="playerBackward",cD.scrollBarChange="scrollBarChange",cD.brushStart="brushStart",cD.brushChange="brushChange",cD.brushEnd="brushEnd",cD.brushClear="brushClear",cD.legendSelectedDataChange="legendSelectedDataChange",cD.legendFilter="legendFilter",cD.legendItemClick="legendItemClick",cD.legendItemHover="legendItemHover",cD.legendItemUnHover="legendItemUnHover",cD.tooltipShow="tooltipShow",cD.tooltipHide="tooltipHide",cD.tooltipRelease="tooltipRelease",cD.afterResize="afterResize",cD.afterRender="afterRender",cD.afterLayout="afterLayout",t.Event_Source_Type=void 0,(dD=t.Event_Source_Type||(t.Event_Source_Type={})).chart="chart",dD.window="window",dD.canvas="canvas",t.Event_Bubble_Level=void 0,(uD=t.Event_Bubble_Level||(t.Event_Bubble_Level={})).vchart="vchart",uD.chart="chart",uD.model="model",uD.mark="mark";const pD=`${hB}_waterfall_default_seriesField`,gD=`${hB}_CORRELATION_X`,mD=`${hB}_CORRELATION_Y`,fD=`${hB}_CORRELATION_SIZE`,vD=`${hB}_MEASURE_CANVAS_ID`,_D=`${hB}_DEFAULT_DATA_INDEX`,yD=`${hB}_DEFAULT_DATA_KEY`,bD=`${hB}_DEFAULT_DATA_SERIES_FIELD`,xD=`${hB}_DEFAULT_SERIES_STYLE_NAME`;var SD;t.AttributeLevel=void 0,(SD=t.AttributeLevel||(t.AttributeLevel={}))[SD.Default=0]="Default",SD[SD.Theme=1]="Theme",SD[SD.Chart=2]="Chart",SD[SD.Base_Series=3]="Base_Series",SD[SD.Series=4]="Series",SD[SD.Mark=5]="Mark",SD[SD.User_Chart=6]="User_Chart",SD[SD.User_Series=7]="User_Series",SD[SD.User_Mark=8]="User_Mark",SD[SD.Built_In=99]="Built_In";const AD=`${hB}_STACK_KEY`,kD=`${hB}_STACK_START`,MD=`${hB}_STACK_END`,TD=`${hB}_STACK_START_PERCENT`,wD=`${hB}_STACK_END_PERCENT`,CD=`${hB}_STACK_START_OffsetSilhouette`,ED=`${hB}_STACK_END_OffsetSilhouette`,PD=`${hB}_STACK_TOTAL`,BD=`${hB}_STACK_TOTAL_PERCENT`,RD=`${hB}_STACK_TOTAL_TOP`,LD=`${hB}_SEGMENT_START`,OD=`${hB}_SEGMENT_END`;var ID,DD;t.LayoutZIndex=void 0,(ID=t.LayoutZIndex||(t.LayoutZIndex={}))[ID.Axis_Grid=50]="Axis_Grid",ID[ID.CrossHair_Grid=100]="CrossHair_Grid",ID[ID.Region=450]="Region",ID[ID.Mark=300]="Mark",ID[ID.Node=400]="Node",ID[ID.Axis=100]="Axis",ID[ID.MarkLine=500]="MarkLine",ID[ID.MarkArea=100]="MarkArea",ID[ID.MarkPoint=500]="MarkPoint",ID[ID.DataZoom=500]="DataZoom",ID[ID.ScrollBar=500]="ScrollBar",ID[ID.Player=500]="Player",ID[ID.Legend=500]="Legend",ID[ID.CrossHair=500]="CrossHair",ID[ID.Indicator=500]="Indicator",ID[ID.Title=500]="Title",ID[ID.Label=500]="Label",ID[ID.Brush=500]="Brush",ID[ID.CustomMark=500]="CustomMark",ID[ID.Interaction=700]="Interaction",t.LayoutLevel=void 0,(DD=t.LayoutLevel||(t.LayoutLevel={}))[DD.Indicator=10]="Indicator",DD[DD.Region=20]="Region",DD[DD.Axis=30]="Axis",DD[DD.DataZoom=40]="DataZoom",DD[DD.Player=40]="Player",DD[DD.ScrollBar=40]="ScrollBar",DD[DD.Legend=50]="Legend",DD[DD.Title=70]="Title",DD[DD.CustomMark=70]="CustomMark";const FD=["linear","radial","conical"],jD={x0:0,y0:0,x1:1,y1:1},zD={x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},HD={x:.5,y:.5,startAngle:0,endAngle:2*Math.PI},VD={linear:jD,radial:zD,conical:HD},ND={label:{name:"label",type:"text"}},GD=`${hB}_rect_x`,WD=`${hB}_rect_x1`,UD=`${hB}_rect_y`,YD=`${hB}_rect_y1`,KD=Object.assign(Object.assign({},ND),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),XD=Object.assign(Object.assign({},ND),{bar3d:{name:"bar3d",type:"rect3d"}}),$D={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},qD=Object.assign(Object.assign({},ND),$D),ZD=Object.assign(Object.assign({},ND),{point:{name:"point",type:"symbol"}}),JD=Object.assign(Object.assign(Object.assign({},ND),$D),{area:{name:"area",type:"area"}}),QD=Object.assign(Object.assign(Object.assign({},ND),$D),{area:{name:"area",type:"area"}}),tF=Object.assign(Object.assign({},ND),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),eF=Object.assign(Object.assign({},ND),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}}),iF=Object.assign(Object.assign({},ND),{rose:{name:"rose",type:"arc"}}),sF=Object.assign(Object.assign({},ND),{area:{name:"area",type:"path"}}),nF=Object.assign(Object.assign({},ND),{group:{name:"group",type:"group"}}),rF=Object.assign(Object.assign({},nF),{track:{name:"track",type:"arc"},progress:{name:"progress",type:"arc"}}),aF=Object.assign(Object.assign({},ND),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),oF=Object.assign(Object.assign({},ND),{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"}}),lF=Object.assign(Object.assign({},ND),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"}}),hF=Object.assign(Object.assign({},ND),{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"}}),cF=Object.assign(Object.assign({},ND),{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"}}),dF=Object.assign(Object.assign({},ND),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),uF=Object.assign(Object.assign({},KD),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),pF=Object.assign(Object.assign({},ND),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),gF=Object.assign(Object.assign({},ND),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),mF=Object.assign(Object.assign({},ND),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}}),fF=Object.assign(Object.assign({},nF),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),vF=Object.assign(Object.assign({},ND),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),_F=Object.assign(Object.assign({},ND),{sunburst:{name:"sunburst",type:"arc"}}),yF=Object.assign(Object.assign({},KD),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),bF=Object.assign(Object.assign({},XD),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),xF=Object.assign(Object.assign({},ND),{circlePacking:{name:"circlePacking",type:"arc"}}),SF=Object.assign(Object.assign({},ND),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}}),AF=Object.assign(Object.assign({},ND),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),kF=Object.assign({},JD),MF=Object.assign(Object.assign({},ND),{liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"symbol"}}),TF=Object.assign(Object.assign({},ND),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});var wF;!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"}(wF||(wF={}));const CF={[oB.bar]:KD,[oB.bar3d]:XD,[oB.line]:qD,[oB.scatter]:ZD,[oB.area]:JD,[oB.radar]:QD,[oB.pie]:tF,[oB.pie3d]:eF,[oB.rose]:iF,[oB.geo]:ND,[oB.map]:sF,[oB.circularProgress]:rF,[oB.link]:aF,[oB.dot]:oF,[oB.wordCloud]:lF,[oB.wordCloud3d]:lF,[oB.funnel]:hF,[oB.funnel3d]:cF,[oB.linearProgress]:dF,[oB.waterfall]:uF,[oB.boxPlot]:pF,[oB.treemap]:gF,[oB.sankey]:mF,[oB.gauge]:fF,[oB.gaugePointer]:vF,[oB.sunburst]:_F,[oB.rangeColumn]:yF,[oB.rangeColumn3d]:bF,[oB.circlePacking]:xF,[oB.heatmap]:SF,[oB.correlation]:AF,[oB.rangeArea]:kF,[oB.liquid]:MF,[oB.venn]:TF};function EF(t){var e,i;const{type:s}=t;return s===oB.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}const PF={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},BF={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function RF(t,e){var i;if(!t)return[];const s=zF(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?FF(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>DF(i)?OF(t,i,e):i)).filter(p)}))):i.map((i=>DF(i)?OF(t,i,e):i)).filter(p):[]}return[]}function LF(t,e){var i,s;return FF(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 OF(t,e,i){var s;const n=zF(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=PF[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=BF[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 IF=(t,e,i)=>{if(e&&DF(t)){const s=OF(e,t,i);if(s)return s}return t};function DF(t){return t&&"palette"===t.type&&!!t.key}function FF(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function jF(t){return y(t)?{dataScheme:t}:t}function zF(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=EF(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 HF extends sC{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(!FF(this._range))return void super.range(this._range);const t=LF(this._range,this._domain);super.range(t)}}const VF={linear:TC,band:rC,point:class extends rC{constructor(t){super(!1),this.type=Pw.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:sC,threshold:BC,colorOrdinal:HF};function NF(t){const e=VF[t];return e?new e:null}function GF(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 WF(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function UF(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function YF(t){return!!_(t)&&(!!t.endsWith("%")&&sb(t.substring(0,t.length-1)))}function KF(t,e,i,s=0){var n,r;return S(t)?t:YF(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 XF(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]=KF(t[s],e.size,i)}))})),o}function $F(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)||YF(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 qF(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const ZF=(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},JF=[{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"]}],QF={default:{dataScheme:JF,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"}}},tj="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",ej={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:tj,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:tj,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:CB,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"}}}}},ij={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}}},sj=Object.assign(Object.assign({},ij),{label:{space:0}}),nj={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}}}}},rj="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;",aj={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:rj,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:rj,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}}}},oj={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}},lj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}},hj={horizontal:Object.assign(Object.assign({},oj),{rail:{width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:lj}),vertical:Object.assign(Object.assign({},oj),{rail:{width:8,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:lj})},cj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}},dj={horizontal:Object.assign(Object.assign({},oj),{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:cj}),vertical:Object.assign(Object.assign({},oj),{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:cj})},uj={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"}}}}},pj={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"}}}}},gj={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 mj(t,e){return t&&e.key in t?t[e.key]:e.default}function fj(t){return t&&"token"===t.type&&!!t.key}const vj={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%"},_j={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:QF,token:vj,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:ej,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},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:hj,sizeLegend:dj,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:ij,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:sj,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:pj,markArea:uj,markPoint:gj,polarMarkLine:pj,polarMarkArea:uj,polarMarkPoint:gj,geoMarkPoint:gj,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",textAlign:"left",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"},textAlign:"left",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:aj,crosshair:nj,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},yj={name:"dark",colorScheme:{default:{dataScheme:JF,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"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},bj=(t,e)=>t===e||!d(t)&&!d(e)&&(y(t)&&y(e)?e.every((e=>t.some((t=>bj(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>bj(t[i],e[i])))),xj=(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]={}),xj(t[s],e.slice(1),i))};function Sj(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]=Sj(n,e)}return s}function Aj(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])?kj(t,e,r,i):Mj(t,r,s[r])}}}}function kj(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?Tj({},t[n][e.index],i):i):t[n]=s?Tj({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?Tj({},t[n][r],i):i)}else t.id===e&&(t[n]=s?Tj({},t[n],i):i)}))}function Cj(t,...e){return Tj(Ej(t),...e.map(Ej))}function Ej(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]=jF(s),e}),{}));return t}(t.colorScheme),{series:s}=t,{mark:n,markByName:r}=t;let a;return(n||r)&&(a=Object.keys(CF).reduce(((t,e)=>{var i;const a=null!==(i=null==s?void 0:s[e])&&void 0!==i?i:{};return t[e]=Pj(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 Pj(t,e,i,s){if(!CF[e])return t;const n={};return Object.values(CF[e]).forEach((({type:e,name:r})=>{n[r]=Tj({},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 Bj=["animationThreshold","colorScheme","name","padding"];function Rj(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];Bj.includes(r)?n[r]=a:f(a)?DF(a)?n[r]=IF(a,e,s):fj(a)?n[r]=mj(i,a):n[r]=Rj(a,e,i,s):n[r]=a})),n}const Lj={[_j.name]:_j},Oj=_j.name,Ij=new Map(Object.keys(Lj).map((t=>[t,Lj[t]]))),Dj=new Map(Object.keys(Lj).map((t=>[t,Rj(Lj[t])]))),Fj=new Map(Object.keys(Lj).map((t=>[t,t===Oj]))),jj=(t,e)=>{if(!t)return;const i=Nj(e);Ij.set(t,i),Dj.set(t,Rj(i)),Fj.set(t,!0)},zj=(t=Oj,e=!1)=>(Fj.has(t)&&!Fj.get(t)&&jj(t,Ij.get(t)),e?Dj.get(t):Ij.get(t)),Hj=t=>Ij.delete(t)&&Dj.delete(t)&&Fj.delete(t),Vj=t=>!!_(t)&&Ij.has(t),Nj=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:Oj;return Cj({},zj(i),t)};class Gj{static registerInstance(t){Gj.instances.set(t.id,t)}static unregisterInstance(t){Gj.instances.delete(t.id)}static getInstance(t){return Gj.instances.get(t)}static instanceExist(t){return Gj.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return Gj.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}Gj.instances=new Map;class Wj{static registerTheme(t,e){jj(t,e)}static getTheme(t,e=!1){return zj(t,e)}static removeTheme(t){return Hj(t)}static themeExist(t){return Vj(t)}static getDefaultTheme(){return Wj.themes.get(Oj)}static setCurrentTheme(t){Wj.themeExist(t)&&(Wj._currentThemeName=t,Gj.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return Wj.getTheme(Wj._currentThemeName,t)}static getCurrentThemeName(){return Wj._currentThemeName}}function Uj(t,e){return _(t)?Wj.themeExist(t)?Wj.getTheme(t,e):{}:g(t)?t:{}}function Yj(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]=Yj(t[s],e)}return i}return y(t)?t.map((t=>Yj(t,e))):t}function Kj(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]=Kj(t[s],e)}return i}return y(t)?t.map((t=>Kj(t,e))):t}Wj.themes=Ij,Wj._currentThemeName=Oj;function Xj(t,e){for(let i=0;it.key===e))}function qj(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 Zj(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:{}},iz(t,a,n[o],l,e,r))})),s?Jj(n):n}function Jj(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))):Jj(t[e].nodes);return t}function Qj(t,e){if("values"in t&&t.values.length){const i=JP(t.values,e),s=ZP(t.values,wD);t.values.forEach((t=>{t[PD]=i,t[BD]=s,delete t[RD]}));const n=t.values.reduce(((t,e)=>e[MD]>t[MD]?e:t));n[RD]=!0}else for(const i in t.nodes)Qj(t.nodes[i],e)}function tz(t){if(!t.values.length)return;const e=t.values[t.values.length-1][MD]/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[kD]=s,s+=r[MD],r[MD]=s):(r[kD]=n,n+=r[MD],r[MD]=n),r[AD]=t.key}if(i)for(let i=0;i=0?s:n;r=a>=0?1:-1,l[TD]=0===h?0:Math.min(1,l[kD]/h)*r,l[wD]=0===h?0:Math.min(1,l[MD]/h)*r}}for(const s in t.nodes)ez(t.nodes[s],e,i)}function iz(t,e,i,s,n,r,a){if("values"in e)if(n&&e.values.forEach((t=>t[MD]=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}),iz(t,e.nodes[o],i.nodes[o],s,n,r,l)}}const sz=(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]=rz(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function az(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>lz(t.style(e,i,s,n)):B(t.style)||(e.style=lz(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>lz(t.state[e](i,s,n,r)):B(t.state[e])||(i[e]=lz(t.state[e]))})),e.state=i}return e}function oz(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>lz(t[i](e,s,n,r)):B(t[i])||(e[i]=lz(t[i]))})),e}function lz(t){return(null==t?void 0:t.angle)&&(t.angle=Qt(t.angle)),t}class hz{static registerChart(t,e){hz._charts[t]=e}static registerSeries(t,e){hz._series[t]=e}static registerComponent(t,e,i){hz._components[t]={cmp:e,alwaysCheck:i}}static registerMark(t,e){hz._marks[t]=e}static registerRegion(t,e){hz._regions[t]=e}static registerTransform(t,e){hz.transforms[t]=e}static registerLayout(t,e){hz._layout[t]=e}static registerAnimation(t,e){hz._animations[t]=e}static registerImplement(t,e){hz._implements[t]=e}static registerChartPlugin(t,e){hz._chartPlugin[t]=e}static registerComponentPlugin(t,e){hz._componentPlugin[t]=e}static createChart(t,e,i){if(!hz._charts[t])return null;return new(0,hz._charts[t])(e,i)}static createChartSpecTransformer(t,e){if(!hz._charts[t])return null;const i=hz._charts[t];return new(0,i.transformerConstructor)(Object.assign({seriesType:i.seriesType},e))}static createRegion(t,e,i){if(!hz._regions[t])return null;return new(0,hz._regions[t])(e,i)}static createRegionSpecTransformer(t,e){if(!hz._regions[t])return null;return new(0,hz._regions[t].transformerConstructor)(e)}static createSeries(t,e,i){if(!hz._series[t])return null;return new(0,hz._series[t])(e,i)}static createSeriesSpecTransformer(t,e){if(!hz._series[t])return null;return new(0,hz._series[t].transformerConstructor)(e)}static createMark(t,e,i){if(!hz._marks[t])return null;const s=new(0,hz._marks[t])(e,i);return"group"===s.type&&s.setInteractive(!1),s}static getComponents(){return Object.values(hz._components)}static getComponentInKey(t){return hz._components[t].cmp}static getLayout(){return Object.values(hz._layout)}static getLayoutInKey(t){return hz._layout[t]}static getSeries(){return Object.values(hz._series)}static getSeriesInType(t){return hz._series[t]}static getRegionInType(t){return hz._regions[t]}static getAnimationInKey(t){return hz._animations[t]}static getImplementInKey(t){return hz._implements[t]}static getSeriesMarkMap(t){return hz._series[t]?hz._series[t].mark:{}}static getChartPlugins(){return Object.values(hz._chartPlugin)}static getComponentPlugins(){return Object.values(hz._componentPlugin)}static getComponentPluginInType(t){return hz._componentPlugin[t]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}}hz._charts={},hz._series={},hz._components={},hz._marks={},hz._regions={},hz._animations={},hz._implements={},hz._chartPlugin={},hz._componentPlugin={},hz.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}},hz.dataParser={csv:Ur,dsv:Wr,tsv:Yr},hz._layout={};const cz=(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))},dz=(t,e,i,s)=>{var n;const r=jw(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:uz(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("_")}`,pz=(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},gz=(t,e)=>{if(!t)return null;if(!rB(t.getRegionsInIndex(),"polar"))return null;const{x:i,y:s}=e,n=pz(t,(t=>"angle"===t.getOrient()),e),r=pz(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&&jw(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=eB({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=iB(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=dz(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&&jw(r.type)){const h=t.getCenter(),c={x:i-t.getLayoutStartPoint().x-h.x,y:s-t.getLayoutStartPoint().y-h.y};let d=eB({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=iB(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 _=dz(f,t,"polar",o);a.push({index:v,value:f,position:r.scale(f),axis:t,data:_})}})),a.length?a:null};function mz(t){return"bottom"===t||"top"===t}function fz(t){return"left"===t||"right"===t}function vz(t){return"z"===t}function _z(t,e){return UF(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function yz(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function bz(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?mz(t)?"linear":"band":mz(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const xz=t=>t.fieldX[0],Sz=t=>t.fieldY[0],Az=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},kz=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},Mz=(t,e)=>t?e?xz:Az:e?Sz:kz,Tz=(t,e,i)=>{var s,n;if(!t)return null;if(!rB(t.getRegionsInIndex(),"cartesian"))return null;const{x:r,y:a}=e,o=null!==(s=pz(t,(t=>mz(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=pz(t,(t=>fz(t.getOrient())),e))&&void 0!==n?n:[],h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{jw(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=wz(s,i,t,Mz(e,jw(s.getScale().type)));n&&u.push(n)}}else{const n=h.size>0;if((n?h:c).has(s)){const r=wz(s,i,t,Mz(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},wz=(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 Cz(t,a,s)},Cz=(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=dz(e,t,"cartesian",null!=i?i:mz(t.getOrient())?xz:Sz);return{index:n,value:e,position:s.scale(e),axis:t,data:r}};class Ez{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:Xy)("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:Xy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s;const n=null!==(i=Tz(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(s=gz(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=>jw(t.getScale().type))),r=n.length?n:s.filter((t=>{const e=t.getOrient();return mz(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=Cz(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var Pz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Pz||(Pz={}));const Bz={[Pz.dimensionHover]:class extends Ez{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)=>!cz(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}),Qy(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}),Qy(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[Pz.dimensionClick]:class extends Ez{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 Rz=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(Bz[t]){const e=new Bz[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(Bz[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}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class Lz{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}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const Oz={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 Iz{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 Lz);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}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 Oz[a]&&(a=Oz[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.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 hD.includes(e)||Object.values(t.VGRAMMAR_HOOK_EVENT).includes(e)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&kR.hasInteraction(e)}}function Dz(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function Fz(t,e,i){t.getParser(e)||t.registerParser(e,i)}const jz=new Map;let zz;function Hz(){zz||(zz=new fa,Fz(zz,"geojson",ca),Fz(zz,"topojson",ua),Dz(zz,"simplify",Br))}function Vz(t,e,i={type:"geojson",centroid:!0}){jz.has(t)&&Ky(`map type of '${t}' already exists, will be overwritten.`),Hz();const s=new _a(zz),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}),jz.set(t,s)}function Nz(t){jz.has(t)?jz.delete(t):Ky(`map type of '${t}' does not exists.`)}function Gz(t,e=!1){let i=e;return t.latestData instanceof _a&&(i=!1),i?I(t.latestData):t.latestData.slice()}const Wz=(t,e)=>0===t.length?[]:1===t.length?Gz(t[0],null==e?void 0:e.deep):t.map((t=>Gz(t,null==e?void 0:e.deep)));function Uz(t,e,i){Dz(e=e instanceof fa?e:t.dataSet,"copyDataView",Wz);const s=new _a(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:Xz.copyDataView}),s}function Yz(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:Xy)(`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:Xy)(`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([]),Ky("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 Kz(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var Xz;!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"}(Xz||(Xz={}));const $z=(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 uO(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:tH(this._option.mode),autoFit:!1,eventConfig:{gesture:Qy(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())}clear(t,e=!1){const{chart:i}=t;i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=E_.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this._nextRafId&&(E_.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null),this._isRunning||(this.initView(),this._view&&(this._isRunning=!0,null===(e=this._view)||void 0===e||e.run(t),this._isRunning=!1,this._nextRafId&&(E_.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,this._isRunning=!0,null===(i=this._view)||void 0===i||i.run(t),this._isRunning=!1))))}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.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 Jy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function iH(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:Xy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function sH(t){t.crosshair=Y(t.crosshair||{}).map((e=>Tj({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function nH(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&&Jy(e.mode)){let t;t=_(h)?null===document||void 0===document?void 0:document.getElementById(h):h;const{width:e,height:s}=ei(t,i.width,i.height);a=e,o=s}else if(tb(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 rH(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")}),t}function aH(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"}(Jz||(Jz={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(Qz||(Qz={}));class oH{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({},oH.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]))))}}oH.defaultMarkInfo={};class lH{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new oH,this._markReverse=new oH,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement(Jz.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement(Jz.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement(Jz.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement(Jz.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement(Jz.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(Jz.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[Jz.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[Jz.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(Pz.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 hH={};Object.values(Jz).forEach((t=>{hH[t]=!0}));const cH={[Jz.STATE_HOVER]:Jz.STATE_HOVER_REVERSE,[Jz.STATE_SELECTED]:Jz.STATE_SELECTED_REVERSE,[Jz.STATE_DIMENSION_HOVER]:Jz.STATE_DIMENSION_HOVER_REVERSE};function dH(t){return cH[t]}class uH{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=dH(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=dH(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=dH(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=dH(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 pH{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 gH extends pH{constructor(){super(...arguments),this.id=ib(),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 mH extends gH{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,s){super(t),this.grammarType=Zz.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 fH extends pH{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 mH(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 vH extends fH{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 _H extends vH{constructor(){super(...arguments),this.id=ib(),this.stateKeyToSignalName=t=>`${hB}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===qz.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===qz.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?qz.none:qz.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?qz.exit:qz.appear}}}}class yH{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=>Tj({},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 bH extends pH{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=yH,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new oH,this._lastLayoutRect=null,this.id=ib(),this.userId=t.id,this._spec=t,this.effect={},this.event=new Rz(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=`${hB}_${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=hz.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 xH{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=XF($F(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:KF(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:KF(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:KF(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:KF(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:KF(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:KF(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=KF(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=KF(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]=KF(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 SH extends bH{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 xH(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 AH extends yH{_initTheme(t,e){return{spec:t,theme:this._theme}}}class kH extends SH{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=AH,this.modelType="region",this.specKey="region",this.type=kH.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.interaction=new uH,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 _H({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 lH(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 Qz)B(t.stateStyle[Qz[e]])||this.interaction.registerMark(Qz[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 MH(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 TH(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 wH(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 CH(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),wH(c,!0,u,o),s&&TH(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function EH(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),wH(c,!1,u,a),s&&TH(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function BH(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}=MH(t);s.length&&CH(s,e,i,!1,"left"),n.length&&CH(n,e,i,!0,"left"),r.length&&EH(r,e,0,"left")}(e,this,a),s.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=MH(t);s.length&&PH(s,e,i,!1,"top"),n.length&&PH(n,e,i,!0,"top"),r.length&&BH(r,e,0,"top")}(s,this,r),i.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=MH(t);s.length&&CH(s,e,i,!1,"right"),n.length&&CH(n,e,i,!0,"right"),r.length&&EH(r,e,0,"right")}(i,this,a),n.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=MH(t);s.length&&PH(s,e,i,!1,"bottom"),n.length&&PH(n,e,i,!0,"bottom"),r.length&&BH(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:Xy)("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}}}RH.type="base";const LH=["line","area","trail"];function OH(t){return LH.includes(t)}class IH extends vH{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(OH)?s:!t.mark||OH(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=>!!hH[t])).map((t=>[t,10])),s=!t.mark||OH(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(hB)));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(hB)));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(Dw(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 DH extends gH{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=Zz.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 FH extends DH{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${hB}_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 jH extends gH{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=Zz.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 IH(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 Rz(s.getOption().eventDispatcher,s.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new FH(t)}stateKeyToSignalName(t){return`${hB}_${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=Jz.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=Jz.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===qz.appear&&this.runAnimationByState(qz.normal)})):this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,(()=>{this.runAnimationByState(qz.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),this._morph&&this._morphKey&&(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 zH extends jH{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].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))}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&&Tj(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(Fw(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=NF(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()):FD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Fw(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=LF(RF(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({},VD[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)FD.includes(null===(o=n.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(n.stroke)(t,e));else{const e=LF(RF(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 HH extends zH{constructor(){super(...arguments),this.type=HH.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)?(Ky("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?(Ky("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})}))}}HH.type="group";const VH=()=>{fM(),iM(),kR.registerGraphic(RB.group,Au),hz.registerMark(HH.type,HH)},NH={type:"clipIn"},GH={type:"fadeIn"};function WH(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 GH;default:return NH}}const UH={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"}},YH={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},KH={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},XH=()=>{hz.registerAnimation("scaleInOut",(()=>YH))},$H=()=>{hz.registerAnimation("fadeInOut",(()=>KH))},qH=(t,e)=>({appear:WH(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:zc,duration:UH.update.duration,easing:UH.update.easing}],disappear:{type:"clipOut"}}),ZH=()=>{hz.registerAnimation("line",qH)},JH=()=>{uO.useRegisters([UI,YI,KI,XI,$I,qI,II,DI])},QH={measureText:(t,e,i,s)=>((t,e,i)=>GM(t,e,i,{fontFamily:vj.fontFamily,fontSize:vj.fontSize}))(e,i,s).measure(t)};class tV{static instance(){return tV.instance_||(tV.instance_=new tV),tV.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 eV{constructor(){this.id=ib(),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))?Ky("不要重复添加相同的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 iV extends eV{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 sV{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>hz.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>hz.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>hz.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return hz.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>hz.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){hz.registerTransform(t,e)}static registerFunction(t,e){t&&e&&tV.instance().registerFunction(t,e)}static unregisterFunction(t){t&&tV.instance().unregisterFunction(t)}static getFunction(t){return t?tV.instance().getFunction(t):null}static getFunctionList(){return tV.instance().getFunctionNameList()}static registerMap(t,e,i){const s=hz.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=hz.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,jz.get(e);var e}static hideTooltip(t=[]){Gj.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,c;this.id=ib(),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 d=this._option,{dom:u,renderCanvas:p,mode:g,stage:m,poptip:f}=d,v=e(d,["dom","renderCanvas","mode","stage","poptip"]),y=Jy(g);y&&u&&(this._container=_(u)?null===document||void 0===document?void 0:document.getElementById(u):u),p&&(this._canvas=p),m&&(this._stage=m),"node"===g||this._container||this._canvas||this._stage?(y?Cx($l):"node"===g&&lA($l),this._viewBox=this._option.viewBox,this._currentThemeName=Wj.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new eH({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:p},Object.assign(Object.assign({mode:this._option.mode,stage:m,pluginList:!1!==f?["poptipForText"]:[]},v),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new Iz(this,this._compiler),this._event=new Rz(this._eventDispatcher,g),this._compiler.initView(),null===(o=this.getStage())||void 0===o||o.setTheme({text:{fontFamily:null===(l=this._currentTheme)||void 0===l?void 0:l.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!y&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),Gj.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=Tj({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=Yj(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;sV.getFunctionList()&&sV.getFunctionList().length&&(t=Kj(t,sV)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=hz.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=hz.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=hz.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 nH(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:cB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:dB})}_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,Fz(this._dataSet,"dataview",pa),Fz(this._dataSet,"array",s),Dz(this._dataSet,"stackSplit",$z),Dz(this._dataSet,"copyDataView",Wz);for(const t in hz.transforms)Dz(this._dataSet,t,hz.transforms[t]);for(const t in hz.dataParser)Fz(this._dataSet,t,hz.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),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;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,null===(s=this._compiler)||void 0===s||s.releaseGrammar(!1===(null===(n=this._option)||void 0===n?void 0:n.animation)||!1===(null===(r=this._spec)||void 0===r?void 0:r.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.reCompile&&(null===(a=this._compiler)||void 0===a||a.clear({chart:this._chart,vChart:this},!this._option.animation||!this._spec.animation),null===(o=this._compiler)||void 0===o||o.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(){var t,e;this._option.animation&&(null===(t=this._chart)||void 0===t||t.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(qz.update,!0)})),null===(e=this._chart)||void 0===e||e.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(qz.update,!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,Gj.unregisterInstance(this)}updateData(t,e,s){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s)}))}_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){return u(this._dataSet)?this:this._chart?(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){if(this._chart)return this._chart.updateFullData(t),e&&this._compiler.render(),this;const i=Y(this._spec.data);return Y(t).forEach((t=>{var e;const{id:s,values:n,parser:r,fields:a}=t,o=i.find((t=>t.name===s));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 s=Yz(t,this._dataSet,i,{onError:null===(e=this._option)||void 0===e?void 0:e.onError});y(this._spec.data)&&this._spec.data.push(s)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i){const s=this._updateSpec(t,e);return s?(this.updateCustomConfigAndRerender(s,!0,{morphConfig:i,transformSpec:s.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){var i,s;const n=this._spec;if(!this._setNewSpec(t,e))return;G(n.theme,this._spec.theme)||this._setCurrentTheme();const r=this._shouldChartResize(n);return null===(s=null===(i=this._compiler)||void 0===i?void 0:i.getVGrammarView())||void 0===s||s.updateLayoutTag(),this._spec.type!==n.type?{reTransformSpec:!0,change:!0,reMake:!0,reCompile:!1,reSize:r}:(this._initChartSpec(this._spec,"render"),rH(this._chart.updateSpec(this._spec),{reTransformSpec:!1,change:r,reMake:!1,reCompile:!1,reSize:r}))}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)||wj(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)||wj(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=Tj({},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=Uj(this._currentThemeName,!0);else if(_(s)&&(!n||_(n))||_(n)&&(!s||_(s))){const t=Cj({},Uj(this._currentThemeName,!0),Uj(s,!0),Uj(n,!0));this._currentTheme=t}else{const t=Cj({},Uj(this._currentThemeName),Uj(s),Uj(n));this._currentTheme=Rj(t)}var r;r=R(this._currentTheme,"component.poptip"),z(eT.poptip,tT,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=!!Jy(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?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return Uj(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){if(!Wj.themeExist(t))return this;const e=this._setCurrentTheme(t);return yield this.updateCustomConfigAndRerender(e,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){if(!Wj.themeExist(t))return this;const e=this._setCurrentTheme(t);return this.updateCustomConfigAndRerender(e,!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}}_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 iH(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(!Jy(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)?null===document||void 0===document?void 0:document.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?qF(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 Ky("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?qF(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Ky("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return tV.instance().getFunction(t)}registerFunction(t,e){t&&e&&tV.instance().registerFunction(t,e)}unregisterFunction(t){t&&tV.instance().unregisterFunction(t)}getFunctionList(){return tV.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}_initChartPlugin(){const t=hz.getChartPlugins();t.length>0&&(this._chartPlugin=new iV(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}}}sV.InstanceManager=Gj,sV.ThemeManager=Wj,sV.globalConfig={uniqueTooltip:!0},sV.Utils=QH,sV.vglobal=E_;hz.registerRegion("region",kH),hz.registerLayout("base",RH),VH(),uO.useRegisters([tI,eI]),uO.useRegisters([sD,nD,FI,jI,eD,iD,rD,aD,oD]),UR(),WR(),jj(yj.name,yj),rt.getInstance(nt.Error);const nV=(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(oB).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=hz.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=hz.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},rV=(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=nV(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):bj(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const m=Tj({},i),f=d(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:Tj(m,f),hasChanged:!0};const i=Tj({},t,f);xj(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 aV{constructor(t){this.id=ib(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}const oV=t=>{hz.registerChartPlugin(t.type,t)};class lV extends aV{constructor(){super(lV.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[lV.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[lV.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=Sj(this._option.globalInstance.getSpec(),["data",lV.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=Sj(this._baseChartSpec,["data",lV.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=rV(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=Sj(i,["data",lV.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()}}lV.pluginType="chart",lV.specKey="media",lV.type="MediaQueryPlugin";const hV=/\{([^}]+)\}/,cV=/\{([^}]+)\}/g,dV=/:/;class uV extends aV{constructor(){super(uV.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[uV.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)),hz.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=hV.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(cV,((t,i)=>{if(!dV.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}}uV.pluginType="chart",uV.specKey="formatter",uV.type="formatterPlugin";function pV(t){return 2===t.length&&k(t[0])&&k(t[1])&&t[1]>=t[0]}function gV(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 mV(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 fV(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 vV(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 _V(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 yV=(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 RC(v)};class bV extends aV{constructor(){super(bV.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!Dw(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&&pV(c)&&pV(d)))return;const u=gV(t,c),p=gV(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(!fV(u,p))return}else if(0===y&&0===b){if(!fV(p,u))return}else if(_||A)if(_&&!A){if(!mV(u,p))return}else if(A&&!_){if(!mV(p,u))return}else{if(m===b)return;if(m>b){if(!vV(u,p))return}else if(!vV(p,u))return}else{if(0===m&&0===y){if(!_V(u,p))return}else if(0===b&&0===g&&!_V(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){Dz(e.getOption().dataSet,"tickAlign",yV);const t={targetAxis:()=>s,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}bV.pluginType="component",bV.type="AxisSyncPlugin";const xV=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,SV=(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},gm||(gm=um.CreateGraphic("richtext",{})),gm.setAttributes(a),gm.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}},AV="vchart-tooltip-container",kV={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}};function MV(t,e){return R(e,`component.${t}`)}function TV(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=hz.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const wV={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function CV(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 EV(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 PV(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function BV(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}const RV=(t,e,i)=>{var s;const n=null!==(s="band"===e?MV("axisBand",i):["linear","log","symlog"].includes(e)?MV("axisLinear",i):{})&&void 0!==s?s:{},r=mz(t)?MV("axisX",i):fz(t)?MV("axisY",i):MV("axisZ",i);return Tj({},MV("axis",i),n,r)},LV=(t,e,i)=>{var s;const n=null!==(s="band"===e?MV("axisBand",i):"linear"===e?MV("axisLinear",i):{})&&void 0!==s?s:{},r=MV("angle"===t?"axisAngle":"axisRadius",i);return Tj({},MV("axis",i),n,r)},OV=t=>"band"===t||"ordinal"===t||"point"===t;function IV(t,e){return{id:t,label:t,value:e,rawValue:t}}function DV(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 FV(t,e,i,s){let n=0,r=t.length-1;for(;n<=r;){const a=Math.floor((n+r)/2),o=t[a];if(o[i]<=e&&o[s||i]>=e)return o;o[i]>e?r=a-1:n=a+1}return null}const jV=(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(jw(a.type))A=a.bandwidth(),0===A&&a.step&&(M=a.step());else if(Dw(a.type)){const s=e.fieldX[0],r=e.fieldX2,a=FV(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=CV(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(jw(r.type))k=r.bandwidth(),0===k&&r.step&&(T=r.step());else if(Dw(r.type)){const s=e.fieldY[0],r=e.fieldY2,a=FV(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=CV(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(HV(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&&zV(t,"top",r.label),e.visible&&zV(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(HV(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&&zV(t,"left",a.label),e.visible&&zV(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}},zV=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=TV(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},HV=(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)}))}))},VV=(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=GV(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},NV=(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=GV(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},GV=(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},WV=(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},UV={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"]},YV=(t,e)=>{var i,s;return null!==(s=null===(i=UV[t])||void 0===i?void 0:i[0])&&void 0!==s?s:e},KV=(t,e)=>{var i,s;return null!==(s=null===(i=UV[t])||void 0===i?void 0:i[1])&&void 0!==s?s:e},XV=(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}=jV(3,e,i,s,n,r,a);return o?VV(r,o,d,h):l?NV(a,l,u,c):void 0},$V={fontFamily:vj.fontFamily,spacing:10,wordBreak:"break-word"};function qV(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:$V),{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 ZV=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},JV=(t,e)=>p(e)?t.map((t=>e[t])):void 0,QV=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),tN=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function eN(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=iN(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=>QV(i,s)(t)&&QV(n,r)(t)&&(u(a)||QV([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 sV.globalConfig.uniqueTooltip&&sV.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 sV.globalConfig.uniqueTooltip&&sV.hideTooltip(u.id),d}return"none"}const iN=(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=JV(c,t);let _=JV(d,t);const y=tN(_),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(QV(c,v));if(!y&&(_=JV(d,i),!tN(_)))return;const n=e.type===oB.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=jw(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(QV(c,n));f.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=JV(d,o),!tN(_))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(QV(c,n));if(!y&&(_=JV(d,r),!tN(_)))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===oB.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(QV(c,v))).find((t=>t[g]===m));f.forEach((n=>{if(_=JV(d,i),!tN(_))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},sN=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 nN=(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 rN{constructor(){this.activeTriggerSet={mark:new Set,dimension:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set,dimension:new Set,group:new Set}}}class aN extends rN{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:lN(e.title,{seriesId:this.series.id},!0),content:hN(e.content,{seriesId:this.series.id},!0)}))})),this.spec=a,this.activeType=sN(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 oN=(t,e,i)=>{const s=d(e)?e(t):e;return i?Object.assign(Object.assign({},t),s):Object.assign(Object.assign({},s),t)},lN=(t,e,i)=>p(t)?d(t)?(...s)=>oN(t(...s),e,i):oN(t,e,i):void 0,hN=(t,e,i)=>{const s=p(t)?Y(t).map((t=>d(t)?(...s)=>Y(t(...s)).map((t=>oN(t,e,i))):oN(t,e,i))):void 0;return s},cN=(t,e,i)=>{var s;let n={};switch(t){case"mark":case"group":e&&(n=null!==(s=nN(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=nN(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},dN=(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=uN(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)&&sN(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},uN=mt((t=>t.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(p))),[]))),pN=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},gN=(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}=TV(void 0,s,t,e);i&&r&&(n=i(...r))}return n},fN=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;class vN{}vN.dom=`${hB}_TOOLTIP_HANDLER_DOM`,vN.canvas=`${hB}_TOOLTIP_HANDLER_CANVAS`;const _N=20,yN={key:"其他",value:"..."},bN=(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)},xN=(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=fN(t.title,e,i),{visible:h,value:c,valueTimeFormat:p,valueTimeFormatMode:g,valueStyle:m,hasShape:f,valueFormatter:v}=null!=l?l:{},_=!1!==mN(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:bN(mN(c,t,i,v),p,g),valueStyle:mN(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=_N}=t,x=t.othersLine?Object.assign(Object.assign({},yN),t.othersLine):yN,S=t=>{if(null==t?void 0:t.length)for(const e of t)for(const t of null!=y?y:[]){const s=SN(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=SN(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},SN=(t,e,i)=>{const s=bN(mN(e.key,t,i,e.keyFormatter),e.keyTimeFormat,e.keyTimeFormatMode),n=bN(mN(e.value,t,i,e.valueFormatter),e.valueTimeFormat,e.valueTimeFormatMode),r=!1!==mN(e.visible,t,i)&&(p(s)||p(n)),a=mN(e.isKeyAdaptive,t,i),o=mN(e.spaceRow,t,i),l=mN(e.shapeType,t,i),h=mN(e.shapeColor,t,i),c=mN(e.shapeFill,t,i),d=mN(e.shapeStroke,t,i),u=mN(e.shapeLineWidth,t,i),g=mN(e.shapeHollow,t,i),m=mN(e.keyStyle,t,i),f=mN(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 AN extends aV{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=fN(x.position,b,e),M=null!==(n=fN(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:cB,R=null!==(o=null==P?void 0:P.height)&&void 0!==o?o:dB;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(Jy(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=xV(t,e),j=xV(T,D)}}else O.width=B,O.height=R;const z=j/F;let H,V,N,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=XV(e.dimensionInfo,rB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.x,a=t.end.x)}else W=t;if(L)switch(YV(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=XV(e.dimensionInfo,rB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.y,a=t.end.y)}else U=t;if(L)switch(KV(t)){case"top":V=r-C*z-_;break;case"bottom":V=a+_;break;case"center":V=(r+a)/2-C*z/2;break;case"centerTop":V=(r+a)/2-C*z-_;break;case"centerBottom":V=(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=WV(t,c),V=WV(i,c),N=WV(e,c),G=WV(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=WV(t,c):Y(t),S(e)||d(e)?V=WV(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(N))$=B-w*z-N;else{const t=Z;switch(YV(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(V))q=V;else if(k(G))q=R-C*z-G;else{const t=J;switch(KV(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,Jy(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"===YV(A,"right")?$+=v+w/2:$+=2*v+w)},at=()=>{et()&&($=-D.x/j)},ot=()=>{it()&&(L?$=(Q-D.x)/j-w:"center"===YV(A,"right")?$-=v+w/2:$-=2*v+w)},lt=()=>{it()&&($=(Q-D.x)/j-w)},ht=()=>{st()&&(L?q=-D.y/j:"center"===KV(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"===KV(A,"bottom")?q-=_+C/2:q-=2*_+C)},ut=()=>{nt()&&(q=(tt-D.y)/j-C)};switch(YV(A,"right")){case"center":case"centerLeft":case"centerRight":et()?(rt(),lt()):(ot(),at());break;case"left":rt(),lt();break;case"right":ot(),at()}switch(KV(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({},kV),{offsetX:null!==(t=null==i?void 0:i.x)&&void 0!==t?t:kV.offsetX,offsetY:null!==(e=null==i?void 0:i.y)&&void 0!==e?e:kV.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:_}=l,y=ti(d.padding),b=$F(d.padding),x=qV(u,i),S=qV(m,i),A=qV(f,i),k={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},M={panel:ZV(d),padding:y,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,maxContentHeight:_,enterable:h,transitionDuration:c},{title:T={},content:w=[]}=t;let C=b.left+b.right,E=b.top+b.bottom,P=b.top+b.bottom,B=0;const R=w.filter((t=>(t.key||t.value)&&!1!==t.visible)),L=!!R.length;let O=0,I=0,D=0,F=0;if(L){const t=[],e=[],i=[],s=[];let n=0;M.content=R.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:M,shapeColor:T}=r,w={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=Tj({},S,qV(b,void 0,{})),{width:s,height:n,text:r}=SV(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=Tj({},A,qV(x,void 0,{})),{width:e,height:s,text:n}=SV(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;M?t.stroke=e:t.fill=e,t.stroke=null!=u?u:e,t.lineWidth=g,w.shape=t;const i=null!=m?m:k.size;o=Math.max(i,o),s.push(i)}else w.shape={visible:!1};return w.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(V){U=Tj({},x,qV(G,void 0,{})),Y()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:L?Math.ceil(B):void 0);const{text:t,width:e,height:i}=SV(N,U);M.title.value=Object.assign(Object.assign({width:Y()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),j=M.title.value.width,z=M.title.value.height,H=z+(L?M.title.spaceRow:0)}return E+=H,P+=H,M.title.width=j,M.title.height=z,Y()?C+=B||j:C+=Math.max(j,B),L&&M.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=C-b.left-b.right-F-O-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),M.valueWidth=Math.max(M.valueWidth,i.width))})),M.panel.width=C,M.panel.height=E,M.panelDomHeight=P,M})(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(Jy(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=xV(t,s),u=xV(l,c)}return s*=d,n*=d,Jy(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()}}AN.specKey="tooltip";const kN=(t,e)=>p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",MN=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 TN;const wN=(t=document.body)=>{if(u(TN)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),TN=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return TN};function CN(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}=null!=t?t:{},{fill:m,shadow:f,shadowBlur:v,shadowColor:_,shadowOffsetX:y,shadowOffsetY:b,shadowSpread:x,cornerRadius:S,stroke:A,lineWidth:k=0,width:M=0}=n,{value:T={}}=o,{shape:w={},key:C={},value:E={}}=l,P=function(t,e){if(!t)return;const{size:i}=Tj({},e,t),s={};return s.width=kN(i),s}(w),B=EN(C),R=EN(E),{bottom:L,left:O,right:I,top:D}=$F(h);return{panel:{width:kN(M+2*k),minHeight:kN(g+2*k),paddingBottom:kN(L),paddingLeft:kN(O),paddingRight:kN(I),paddingTop:kN(D),borderColor:A,borderWidth:kN(k),borderRadius:kN(S),backgroundColor:m?`${m}`:"transparent",boxShadow:f?`${y}px ${b}px ${v}px ${x}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)?kN(null==r?void 0:r.spaceRow):"0px"},EN(Tj({},T,null==r?void 0:r.value))),content:{},shapeColumn:{common:P,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 PN.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=PN.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==Zy?void 0:Zy.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(PN.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}}PN.type="tooltipModel";const BN={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},RN={boxSizing:"border-box"},LN={display:"inline-block",verticalAlign:"top"},ON={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},IN={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},DN={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},FN={lineHeight:"normal",boxSizing:"border-box"};class jN extends PN{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,l;if(!(null==t?void 0:t.hasShape)||!t.symbolType)return"";const{symbolType:h,fill:c,stroke:d,hollow:u=!1}=t,p=t.size?e(t.size):"8px",m=t.lineWidth?e(t.lineWidth)+"px":"0px";let f="currentColor";const v=()=>d?e(d):f,y=MN(p),b=t=>new _g({symbolType:t,size:y,fill:!0});let x=b(null!==(i=zN[h])&&void 0!==i?i:h);const S=x.getParsedPath();S.path||(x=b(S.pathStr));const A=x.getParsedPath().path,k=A.toString(),M=A.bounds;let T=`${M.x1} ${M.y1} ${M.width()} ${M.height()}`;if("0px"!==m){const[t,e,i,s]=T.split(" ").map((t=>Number(t))),n=Number(m.slice(0,-2));T=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}if(!c||_(c)||u)return f=u?"none":c?e(c):"currentColor",`\n \n \n \n `;if(g(c)){f=null!==(s="gradientColor"+t.index)&&void 0!==s?s:"";let i="";const h=(null!==(n=c.stops)&&void 0!==n?n:[]).map((t=>``)).join("");return"radial"===c.gradient?i=`\n ${h}\n `:"linear"===c.gradient&&(i=`\n ${h}\n `),`\n \n ${i}\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=""}}const zN={star:"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"};class HN extends PN{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 VN={overflowWrap:"normal",wordWrap:"normal"};class NN extends PN{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(Tj({},LN,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=Tj({},o?IN:ON,Object.assign(Object.assign(Object.assign({height:kN(l)},VN),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 Tj({},DN,Object.assign(Object.assign(Object.assign({height:kN(s)},VN),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 Tj({},FN,Object.assign(Object.assign({height:kN(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 GN extends PN{init(){this.product||(this.product=this.createElement("div",["container-box"])),this.shapeBox||this._initShapeBox(),this.keyBox||this._initKeyBox(),this.valueBox||this._initValueBox()}_initShapeBox(){const t=new NN(this.product,this._option,"shape-box",0);t.init(),this.shapeBox=t,this.children[t.childIndex]=t}_initKeyBox(){const t=new NN(this.product,this._option,"key-box",1);t.init(),this.keyBox=t,this.children[t.childIndex]=t}_initValueBox(){const t=new NN(this.product,this._option,"value-box",2);t.init(),this.valueBox=t,this.children[t.childIndex]=t}setStyle(t){super.setStyle(Tj(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+MN(e)),0);return Object.assign(Object.assign({},t),{width:`${a+wN(this._option.getContainer())}px`,maxHeight:kN(s),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class WN extends PN{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{title:e}=t;(null==e?void 0:e.hasShape)&&(null==e?void 0:e.shapeType)?this.shape||this._initShape():this.shape&&this._releaseShape(),this.textSpan||this._initTextSpan()}_initShape(){const t=new jN(this.product,this._option,0);t.init(),this.shape=t,this.children[t.childIndex]=t}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(){const t=new HN(this.product,this._option,1);t.init(),this.textSpan=t,this.children[t.childIndex]=t}setStyle(t){var e,i,s,n;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),{title:o}=a;super.setStyle(Tj({},BN,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 UN="99999999999999";class YN extends PN{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:UN,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 WN(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 GN(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(Tj({},RN,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 KN=t=>{hz.registerComponentPlugin(t.type,t)};class XN extends AN{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(XN.type),this.type=vN.dom,this._tooltipContainer=null==Zy?void 0:Zy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(Zy&&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=CN(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()}))}}XN.type=vN.dom;class $N extends AN{constructor(){super($N.type),this.type=vN.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 XP({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()}}$N.type=vN.canvas;const qN=()=>{KN($N)},ZN=(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},JN={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}},QN=(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=Xj([],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 tG(a,n,o)},tG=(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)=>{sb(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=>{sb(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]=JN[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},eG=(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=>{sb(t[e])||(t[e]=0)}))})),t};class iG extends DH{_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 sG=`${hB}_HIERARCHY_DEPTH`,nG=`${hB}_HIERARCHY_ROOT`,rG=`${hB}_HIERARCHY_ROOT_INDEX`;function aG(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function oG(t,e,i){t&&(i.needDefaultSeriesField&&(t[bD]=i.defaultSeriesField),t[_D]=e,t[yD]=i.getKey(t,e,i))}function lG(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function hG(t,e,i,s=0,n,r){void 0===r&&(r=e),oG(t,e,i),t[sG]=s,t[nG]=n||t[i.categoryField],t[rG]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>hG(e,s,i,t[sG]+1,t[nG],r)))}const cG=["appear","enter","update","exit","disappear","normal"];function dG(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 fG(n)&&delete n.type,n.oneByOne&&(n=pG(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:gG,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=Tj({},o[e],a);return fG(n)&&delete n.type,n.oneByOne&&(n=pG(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:gG,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s.state=s.update,s}function uG(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),vG(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 pG(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 gG(t,e){var i,s;return null!==(i=null==t?void 0:t[_D])&&void 0!==i?i:null===(s=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===s?void 0:s.elementIndex}function mG(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 fG(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function vG(t,e){if(y(t))t.forEach(((i,s)=>{t[s]=e(t[s],s),vG(t[s],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),vG(t[i],e)}class _G extends yH{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=EF(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=Pj(R(a,`series.${h}`),h,l,o),d=R(a,`series.${h}_${r}`);return Tj({},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),c(t.stackOffsetSilhouette)&&(this.stack=t.stackOffsetSilhouette||this.stack),p(t.stackValue)&&(this.stack=!0),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=Tj({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>Tj({},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 yG extends bH{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:`${hB}_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=_G,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=function(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)}(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)&&(Dz(this._rawData.dataSet,"invalidTravel",eG),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=Yz(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=Uz(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=Uz(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new iG(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;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){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];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):this._rawStatisticsCache[t]=tG(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t]}}return e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))&&(this._rawStatisticsCache[t].min=$(this._rawStatisticsCache[t].values),this._rawStatisticsCache[t].max=X(this._rawStatisticsCache[t].values)),this._rawStatisticsCache[t]}_statisticViewData(){Dz(this._dataSet,"dimensionStatistics",QN);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&&Xj(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){Dz(this._dataSet,"dimensionStatistics",QN);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=Xj(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&Xj(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)&&(Dz(this._rawData.dataSet,"addVChartProperty",ZN),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:aG.bind(this),call:oG}},!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=dG({},uG(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"}}:Qy(s)||tb(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=Tj(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=Tj(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:Jz.STATE_HOVER_REVERSE,highlightState:Jz.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:Jz.STATE_SELECTED_REVERSE,state:Jz.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 t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:bD;this.getMarksWithoutRoot().forEach((t=>{const s={},n={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(s[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{n[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:xD,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][i]]:!0===s[t[i]]});const a={};Object.keys(n).forEach((e=>{a[e]=s=>{var n,a;let o;if(Array.isArray(s)){if(0===s.length)return;o=null===(n=r[s[0][i]])||void 0===n?void 0:n[e]}return o=null===(a=r[s[i]])||void 0===a?void 0:a[e],o||t.getAttribute(e,s)}})),this.setMarkStyle(t,a,xD)}))}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 aN(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=null!=i?i:{data:!0}).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((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||Kz(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()}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:bD,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new HF).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return RF(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:bD}}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()}`),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,Tj({},h,d||a[T.name]))}return T}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:yD}_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!==MD&&t!==wD&&t!==kD&&t!==TD||(t=this.getStackValueField()),null!==(e=qj(this.getRawData(),t))&&void 0!==e?e:t}getMarkInfoList(){var t;const e=super.getMarkInfoList();return e.length?e:Object.values(null!==(t=CF[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=>sb(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:bD]}}function bG(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();Dw(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 xG(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}}}yG.mark=ND,yG.transformerConstructor=_G;class SG extends yG{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);Dw(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:`${hB}_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(MD),this.setFieldX2(kD)):(this.setFieldY(MD),this.setFieldY2(kD))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(wD),this.setFieldX2(TD)):(this.setFieldY(wD),this.setFieldY2(TD))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(ED),this.setFieldX2(CD)):(this.setFieldY(ED),this.setFieldY2(CD))}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)&&(bG("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 AG="monotone",kG="linear";class MG{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($D.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:kG,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===AG?"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($D.point,{morph:mG(this._spec,$D.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:`${hB}_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(Pz.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:Jz.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[$D.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(Pz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,Tj({},this._spec[$D.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:Jz.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 TG extends zH{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)&&(Fw(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);let c=this._styleConvert(h);a&&"angle"===l&&(c=this.convertAngleToRadian(c)),this.setAttribute(l,c,e,i,s)})),o&&this.setEnableSegments(o)}}class wG extends TG{constructor(){super(...arguments),this.type=wG.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)===oB.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}wG.type="line";const CG=()=>{hz.registerMark(wG.type,wG),fM(),aM(),kR.registerGraphic(RB.line,Sg),JH()};class EG extends zH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class PG extends EG{constructor(){super(...arguments),this.type=PG.type}}PG.type="symbol";const BG=()=>{hz.registerMark(PG.type,PG),fO()};class RG extends _G{_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 LG extends eV{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function OG(t,e,i,s){switch(t){case r.cartesianBandAxis:return RV(_z(i,["z"]),"band",e);case r.cartesianLinearAxis:return RV(_z(i,["z"]),"linear",e);case r.cartesianLogAxis:return RV(_z(i,["z"]),"log",e);case r.cartesianSymlogAxis:return RV(_z(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return RV(_z(i),void 0,e);case r.polarBandAxis:return LV(i.orient,"band",e);case r.polarLinearAxis:return LV(i.orient,"linear",e);case r.polarAxis:return LV(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=MV(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>mz(t.orient)));let d;d=p(c)?Tj({},OV(c.type)?a:o,l):l;const u=n.find((t=>fz(t.orient)));let g;return g=p(u)?Tj({},jw(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=MV(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>"angle"===t.orient));let d;d=p(c)?Tj({},OV(c.type)?a:o,l):l;const u=n.find((t=>"radius"===t.orient));let g;return g=p(u)?Tj({},jw(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 IG(i,MV(t,e));default:return MV(t,e)}}const IG=(t,e)=>{var i;const s=Tj({},e,e[yz(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class DG extends yH{getTheme(t,e){return OG(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({},$F(e)),{[s]:0}))}}class FG extends SH{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 LG(this)}constructor(e,i){super(e,i),this.name="component",this.modelType="component",this.transformerConstructor=DG,this._delegateEvent=(e,i,s,n=null,r=null)=>{var a,o;i instanceof tc||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 _H({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}}}FG.transformerConstructor=DG;class jG extends zH{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(RB.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}jG.type="component";const zG=()=>{hz.registerMark(jG.type,jG)},HG=t=>t;class VG extends FG{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()?DB.circleAxisGrid:DB.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=dG(null===(o=hz.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 DH(this._option,t)]}collectData(t,e){const i=[];return sB(this._regions,(s=>{var n;let r=this.collectSeriesField(t,s);if(r=y(r)?Dw(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 sB(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=nB(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()})),sB(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(sB(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;tthis._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=az(s=t.domainLine)).startSymbol=az(s.startSymbol),s.endSymbol=az(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 lz(Tj({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:lz(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)=>lz(t[i](e.rawValue,s,e,n,r)):B(t[i])||(e[i]=lz(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 lz(Tj({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:lz(t.tick.style)),t.tick.state&&(i.tick.state=oz(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 lz(Tj({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:lz(t.subTick.style)),t.subTick.state&&(i.subTick.state=oz(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=wV[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?Qt(p):null,textStyle:Tj({},d,lz(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:lz(h.style)}),h.state&&(i.title.state.shape=oz(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:lz(o.style)}),o.state&&(i.title.state.background=oz(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=oz(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=lz(t.background.style)),t.background.state&&(i.panel.state=oz(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 lz(Tj({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:lz(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:lz(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=TV(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){Fz(this._option.dataSet,"scale",HG),Dz(this._option.dataSet,"ticks",UC);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)}}VG.specKey="axes";const NG=()=>{kR.registerGraphicComponent(IB.lineAxis,((t,e)=>new Cw(t,e))),kR.registerGraphicComponent(IB.circleAxis,(t=>new Rw(t))),kR.registerComponent(LB.axis,FO),kR.registerGraphicComponent(DB.lineAxisGrid,((t,e)=>new qC(t,e))),kR.registerGraphicComponent(DB.circleAxisGrid,((t,e)=>new JC(t,e))),kR.registerComponent(LB.grid,HO),zG(),hz.registerAnimation("axis",(()=>({appear:{custom:Ow},update:{custom:Lw},exit:{custom:Gc}})))},GG=[bV];class WG extends VG{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),sB(this._regions,(t=>{const e=this.getOrient();mz(e)?t.setXAxisHelper(this.axisHelper()):fz(e)?t.setYAxisHelper(this.axisHelper()):vz(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=Tj({x:t.x,y:t.y},this._axisStyle,n);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(Tj({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=mz(this.getOrient()),n=t=>{var e;return(s?!mz(t.getOrient()):mz(t.getOrient()))&&Dw(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=_z(i,["z"]),vz(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(!PV(e))return null;const{axisType:t,componentName:s}=bz(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=>fz(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(!PV(t))return;const{axisType:s,componentName:n}=bz(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=hz.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=[];mz(this.getOrient())?k(e)&&(o=this._inverse?[e-n,s]:[s,e-n]):vz(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(GG.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){mz(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&&!mz(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),!vz(this.getOrient())&&this._spec.innerOffset){const t=this._spec;fz(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=KF(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=KF(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=mz(this.getOrient())?t.fieldX:vz(this.getOrient())?t.fieldZ:t.fieldY,Dw(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:Dw(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&&(mz(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=mz(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 sB(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]:mz(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:vz(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();sB(this._regions,(e=>{mz(t)?(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):fz(t)?(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):vz(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=mz(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=mz(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=Tj(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 IV(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}=EV(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>=UG?10:n>=YG?5:n>=KG?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 $G extends WG{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new TC}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}}$G.type=r.cartesianLinearAxis,$G.specKey="axes",U($G,XG);const qG=()=>{NG(),hz.registerComponent($G.type,$G)};class ZG{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=IV(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=>IV(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 JG extends WG{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new rC}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{NG(),hz.registerComponent(JG.type,JG)};class tW extends $G{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),sB(this._regions,(t=>{mz(this.getOrient())?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=Tj({},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 DH(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=>IV(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=>IV(e.value,this._getNormalizedValue([e.value],t))))),s}transformScaleDomain(){}}tW.type=r.cartesianTimeAxis,tW.specKey="axes";class eW extends $G{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new EC}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(){}}eW.type=r.cartesianLogAxis,eW.specKey="axes",U(eW,XG);class iW extends $G{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new PC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}transformScaleDomain(){}}iW.type=r.cartesianSymlogAxis,iW.specKey="axes",U(iW,XG);class sW extends SG{constructor(){super(...arguments),this.type=oB.line,this.transformerConstructor=RG,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(dG(null===(i=hz.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),uG("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=xG(this);this._symbolMark.setAnimationConfig(dG(null===(s=hz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),uG("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]}}sW.type=oB.line,sW.mark=qD,sW.transformerConstructor=RG,U(sW,MG);class nW{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)=>{Kz(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 rW{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)=>{nb(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{Xj(e,[{key:t,operations:Dw(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&&Xj(e,[{key:i.field,operations:Dw(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?NF("colorOrdinal"):NF(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(nb(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),nb(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(!nb(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=Dw(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=Dw(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;Dw(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(Dw(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=Dw(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)));Dw(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 aW{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=Zj(t,!0);for(const e in a)for(const i in a[e].nodes)ez(a[e].nodes[i],t.getStackInverse(),n);if(r)for(const t in a)for(const e in a[t].nodes)tz(a[t].nodes[e]);s&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&Qj(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 oW extends pH{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=ib(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:cB,height:dB},this._viewRect={width:cB,height:dB},this._viewBox={x1:0,y1:0,x2:cB,y2:dB},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=$F(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new Rz(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new nW(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._spec.background&&"object"==typeof this._spec.background&&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 aW(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=function(t){if(!t)return null;if("string"==typeof t)return{fill:t,fillOpacity:1};if("object"!=typeof t)return null;const e=H(t,["x","y","width","height","x1","y1","image"]);return e.background=t.image,e}(this._spec.background);t&&(this._backgroundMark=hz.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({},t),{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=hz.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 bH)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 zH))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof zH)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&&Kz(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=nH(this._spec,this._option,{width:cB,height:dB})),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=RF(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new rW(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){rH(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=RF(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{rH(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{var s,n;const r=i.specKey||i.type,a=null!==(s=this._spec[r])&&void 0!==s?s:{};y(a)?(e[r]=e[r]||{specCount:a.length,componentCount:0},e[r].componentCount++,rH(t,i.updateSpec(null!==(n=a[i.getSpecIndex()])&&void 0!==n?n:{},a))):rH(t,i.updateSpec(a))}));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()];rH(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=XF(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(Jz.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(Jz.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(Jz.STATE_SELECTED)}clearHovered(){this.clearState(Jz.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===Pz.dimensionHover||s===Pz.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>jw(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=>{r?i[t.series.fieldY[0]]=s:i[t.series.fieldX[0]]=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 lW=(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 hW{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);xj(t,r,l.spec),xj(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}));xj(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=lW(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=lW(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(hz.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(hz.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=hz.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=hz.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=hz.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 cW extends hW{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")&&Tj(i,aH(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 dW extends cW{_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),sH(t)}}class uW extends oW{constructor(){super(...arguments),this.transformerConstructor=dW,this.type="line",this.seriesType=oB.line,this._canStack=!0}}uW.type="line",uW.seriesType=oB.line,uW.transformerConstructor=dW;class pW extends TG{constructor(){super(...arguments),this.type=pW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}pW.type="area";const gW=()=>{hz.registerMark(pW.type,pW),fM(),qk(),kR.registerGraphic(RB.area,Wg),JH()};class mW extends aN{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 fW=()=>{hz.registerAnimation("area",qH),ZH(),XH()};class vW extends RG{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=Tj({},m.style,g.style),l.state=Tj({},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 _W extends SG{constructor(){super(...arguments),this.type=oB.area,this.transformerConstructor=vW,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(_W.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===AG?"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 GF(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 GF(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(dG(null===(e=hz.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),uG("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(dG(null===(i=hz.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),uG("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=xG(this);this._symbolMark.setAnimationConfig(dG(null===(s=hz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),uG("point",this._spec,this._markAttributeContext),t))}}initTooltip(){this._tooltipHelper=new mW(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}}}_W.type=oB.area,_W.mark=JD,_W.transformerConstructor=vW,U(_W,MG);class yW extends cW{_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),sH(t)}}class bW extends oW{constructor(){super(...arguments),this.transformerConstructor=yW,this.type="area",this.seriesType=oB.area,this._canStack=!0}}bW.type="area",bW.seriesType=oB.area,bW.transformerConstructor=yW;function xW(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 SW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:xW(t,e)}),AW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:xW(t,e)}),kW={type:"fadeIn"},MW={type:"growCenterIn"};function TW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return kW;case"scaleIn":return MW;default:return SW(t)}}class wW extends zH{constructor(){super(...arguments),this.type=wW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}wW.type="rect";const CW=()=>{hz.registerMark(wW.type,wW),gO(),uO.useRegisters([VI,NI,GI,WI,zI,HI])};function EW(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[GD]):this._spec.barMinHeight?this._calculateRectPosition(t,!1):GF(this._dataToPosX(t),e),this._getBarXEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[WD]):GF(this._dataToPosX1(t),e),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[UD]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):GF(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[YD]):GF(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({},RW.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{morph:mG(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(RW.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(Dz(this._option.dataSet,"addVChartProperty",ZN),s){const t=([t],{scaleDepth:e})=>{var i;let s=[{}];const n=this.getDimensionField(),r=u(e)?n.length:Math.min(n.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};Dz(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:aG.bind(this),call:oG}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new iG(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=YD,s=UD,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=WD,s=GD,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=Zj(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)EW(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=GF(this[n](t),o),d=GF(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[kD],n=t[MD],r=t[TD],h=t[wD];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]),{[kD]:i,[MD]:s}),a?{[TD]:o,[wD]:l}:void 0);t.push(Mg(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=>GF(this._dataToPosY(t),a),y1:t=>GF(this._dataToPosY1(t),a)}:{y:t=>GF(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=>GF(this._dataToPosX(t),r),x1:t=>GF(this._dataToPosX1(t),r)}:{x:t=>GF(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=xG(this);this._barMark.setAnimationConfig(dG(null===(e=hz.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),uG(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;if(void 0!==this._spec.barWidth&&r===n)return ZF(this._spec.barWidth,a);const o=void 0!==this._spec.barMinWidth,l=void 0!==this._spec.barMaxWidth;let h=a;return o&&(h=Math.max(h,ZF(this._spec.barMinWidth,a))),l&&(h=Math.min(h,ZF(this._spec.barMaxWidth,a))),h}_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=ZF(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=Dw(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}}RW.type=oB.bar,RW.mark=KD,RW.transformerConstructor=BW;const LW=()=>{iI(),CW(),hz.registerAnimation("bar",((t,e)=>({appear:TW(t,e),enter:SW(t,!1),exit:AW(t,!1),disappear:AW(t)}))),QG(),qG(),hz.registerSeries(RW.type,RW)};class OW extends cW{_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),sH(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 IW extends oW{constructor(){super(...arguments),this.transformerConstructor=OW,this.type="bar",this.seriesType=oB.bar,this._canStack=!0}}IW.type="bar",IW.seriesType=oB.bar,IW.transformerConstructor=OW;class DW extends zH{constructor(){super(...arguments),this.type=DW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}DW.type="rect3d";class FW extends RW{constructor(){super(...arguments),this.type=oB.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d"}}FW.type=oB.bar3d,FW.mark=XD;class jW extends OW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}class zW extends IW{constructor(){super(...arguments),this.transformerConstructor=jW,this.type="bar3d",this.seriesType=oB.bar3d}}zW.type="bar3d",zW.seriesType=oB.bar3d,zW.transformerConstructor=jW;const HW=[10,20],VW=Pw.Linear,NW="circle",GW=Pw.Ordinal,WW=["circle","square","triangle","diamond","star"],UW=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class YW extends _G{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class KW extends SG{constructor(){super(...arguments),this.type=oB.scatter,this.transformerConstructor=YW,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=`${hB}_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=`${hB}_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:VW,defaultRange:HW},"size")}getShapeAttribute(t,e){return u(e)?NW:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:GW,defaultRange:WW},"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(KW.mark.point,{morph:mG(this._spec,KW.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=xG(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(dG(null===(i=hz.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),uG("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:NW},Jz.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},Jz.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},Jz.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},Jz.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},Jz.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]}}KW.type=oB.scatter,KW.mark=ZD,KW.transformerConstructor=YW;const XW=()=>{BG(),hz.registerAnimation("scatter",((t,e)=>Object.assign({appear:UW(0,e)},YH))),QG(),qG(),hz.registerSeries(KW.type,KW)};class $W extends cW{_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 qW extends oW{constructor(){super(...arguments),this.transformerConstructor=$W,this.type="scatter",this.seriesType=oB.scatter,this._canStack=!0}}qW.type="scatter",qW.seriesType=oB.scatter,qW.transformerConstructor=$W;Rn();const ZW={},JW=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function QW(t,e){t&&_(t)||ob("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(ZW[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 JW.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}(i,e)),ZW[i]||null}const tU={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(tU).forEach((t=>{QW(t,tU[t])}));const eU="Feature",iU="FeatureCollection";function sU(t){const e=Y(t);return 1===e.length?e[0]:{type:iU,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===iU?t.features:Y(t).filter((t=>!u(t))).map((t=>t.type===eU?t:{type:eU,geometry:t}))}(e))),[])}}const nU=JW.concat(["pointRadius","fit","extent","size"]);function rU(t,e){let i=[];return t?(Object.keys(t).forEach((s=>{nU.includes(s)&&(i=i.concat(dR(t[s],e)))})),i):i}let aU=class extends $R{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(dR(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(dR(t,this.view)),this.commit(),this}size(t){return u(this.spec.size)||this.detach(dR(this.spec.size,this.view)),this.spec.size=t,this.attach(dR(t,this.view)),this.commit(),this}extent(t){return u(this.spec.extent)||this.detach(dR(this.spec.extent,this.view)),this.spec.extent=t,this.attach(dR(t,this.view)),this.commit(),this}fit(t){return u(this.spec.fit)||this.detach(dR(this.spec.fit,this.view)),this.spec.fit=t,this.attach(dR(t,this.view)),this.commit(),this}configure(t){return this.detach(rU(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(rU(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=QW((t||"mercator").toLowerCase());return e||ob("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),JW.forEach((t=>{u(this.spec[t])||function(t,e,i){d(t[e])&&t[e](i)}(this.projection,t,pR(this.spec[t],e,QW))})),u(this.spec.pointRadius)||this.projection.path.pointRadius(pR(this.spec.pointRadius,e,QW)),!(u(this.spec.fit)||u(this.spec.extent)&&u(this.spec.size))){const t=sU(pR(this.spec.fit,e,QW));this.spec.extent?this.projection.fitExtent(pR(this.spec.extent,e,QW),t):this.spec.size&&this.projection.fitSize(pR(this.spec.size,e,QW),t)}return this.projection}output(){return this.projection}};const oU=(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 lU extends yG{constructor(){super(...arguments),this.type=oB.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=`${hB}_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 hU=`${hB}_MAP_LOOK_UP_KEY`,cU=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[_D]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[hU]=e.nameMap[n]:t[hU]=n})),t.features);class dU extends aN{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 uU extends zH{constructor(){super(...arguments),this.type=uU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}uU.type="path";const pU=()=>{hz.registerMark(uU.type,uU),pO()};class gU{constructor(t){this.projection=QW(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 mU{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 fU{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 vU(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:mU}:Qy(e)||tb(e)?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:fU}:null}const _U={debounce:bt,throttle:xt};class yU{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=Qy(this._renderMode)||tb(this._renderMode),vU(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return vU(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;u(n)||Ie({x:r,y:a},this._getRegionOrSeriesLayout(e),!1)&&(i&&i({zoomDelta:n,zoomX:r,zoomY:a},s),this._eventObj.emit("zoom",{scale:s.zoomDelta,scaleCenter:{x:s.zoomX,y:s.zoomY},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,_U[o]((t=>{this._zoomableTrigger.clearZoom()}),l)),h.on(...c,_U[o]((t=>{this._zoomEventDispatch(t,i,s)}),l))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||vU(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||vU(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,_U[o]((t=>{this._zoomableTrigger.clearScroll()}),l)),h.on(...c,_U[o]((t=>this._scrollEventDispatch(t,i,s)),l))}initScrollEventOfSeries(t,e,i){vU(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||vU(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||vU(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||vU(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=_U[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)}),l),_=_U[o]((t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1;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 bU(t,e){return`${hB}_${e}_${t}`}class xU extends FG{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:bU(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),e&&(e.zoomDelta=l),this.zoom(l,[t.zoomX,t.zoomY]),l},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=Tj(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},s=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,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 gU(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===oB.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),sB(this._regions,(t=>{var e;if(t.type===oB.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===oB.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[hU],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}}xU.type=r.geoCoordinate,U(xU,yU);const SU=()=>{hz.registerComponent(xU.type,xU)};class AU extends _G{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class kU extends lU{constructor(){super(...arguments),this.type=oB.map,this.transformerConstructor=AU,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 !`),jz.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),Dz(this._dataSet,"copyDataView",Wz),Dz(this._dataSet,"map",cU),Dz(this._dataSet,"lookup",oU);const i=jz.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:Xz.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:hU,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 iG(this._option,s)}initMark(){this._pathMark=this._createMark(kU.mark.area,{morph:mG(this._spec,kU.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:bD])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:bD]):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(dG(null===(t=hz.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),uG("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new dU(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[_D]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[_D],{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 _D}getActiveMarks(){return[this._pathMark]}}kU.type=oB.map,kU.mark=sF,kU.transformerConstructor=AU;const MU=()=>{kR.registerGrammar("projection",aU,"projections"),SU(),pU(),hz.registerSeries(kU.type,kU),hz.registerImplement("registerMap",Vz),hz.registerImplement("unregisterMap",Nz),$H()},TU=(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,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},a=o[t];if(null==a||a.forEach(((t,e)=>{e===a.length-1?t[RD]=!0:delete t[RD]})),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=wU([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}=CU(m,i,s,n,u);i.start=f,i.end=v;let _=v-f;return p.forEach((t=>{t[c]=+f,t[d]=Yt(t[c],+t[h]),f=t[d],_=Kt(_,+t[h])})),g.forEach((t=>{t[c]=+f,t[d]=Yt(t[c],_),t[h]=_})),Object.assign(Object.assign({},i),{lastIndex:e})}(a,t,n,r,h,l,i,e,o),void r.push(n)}h=wU(a,t,n,r,h,l,i,e),r.push(n)})),r};function wU(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}=CU(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);e||(t[h]=+i.end,t[c]=Yt(t[h],+t[l]),i.end=t[c]),i.isTotal=e,(u(p)||p===pD)&&(t[pD]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function CU(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?Ky("total.collectCountField error"):n=e[a].start;o<0?Ky("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 EU=(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},PU={type:"fadeIn"},BU={type:"growCenterIn"};function RU(t,e){switch(e){case"fadeIn":return PU;case"scaleIn":return BU;default:return SW(t,!1)}}class LU extends zH{constructor(){super(...arguments),this.type=LU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}LU.type="rule";const OU=()=>{hz.registerMark(LU.type,LU),mO()},IU=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:DU(t.map((t=>t.latestData)).flat(),e.fields,i)}};function DU(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)=>DU(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class FU{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"}),Dz(e,"dimensionTree",IU),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 jU extends BW{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel")}}const zU={rect:WU,symbol:NU,arc:YU,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=NU(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1);return e},stackLabel:KU,line:XU,area:XU,rect3d:WU,arc3d:YU,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function HU(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}=TV(i,s,o.text,e);return h&&(o.text=h(...c,{series:a})),o}function VU(t){return d(t)?e=>t(e.data):t}function NU(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=VU(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:GU(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function GU(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function WU(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=VU(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:UU(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function UU(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 YU(t){var e;const{labelSpec:i}=t,s=null!==(e=VU(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 KU(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=HU(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),gp(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 XU(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 $U extends RW{constructor(){super(...arguments),this.type=oB.waterfall,this.transformerConstructor=jU,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 FU(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=pD)}getSeriesKeys(){return this._seriesField===pD?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),Dz(this._dataSet,"waterfallFillTotal",EU),Dz(this._dataSet,"waterfall",TU),(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=Uz(this.getViewData(),this._dataSet,{name:`${hB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new iG(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:kD,endAs:MD,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=xG(this);this._barMark.setAnimationConfig(dG(null===(i=hz.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),uG("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(dG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),uG("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($U.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){if(!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible))return super.initLabelMarkStyle(t),void(this._labelMark=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 KU(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?GF(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):GF(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))}}$U.type=oB.waterfall,$U.mark=uF,$U.transformerConstructor=jU;const qU=()=>{OU(),CW(),hz.registerAnimation("waterfall",((t,e)=>({appear:RU(t,e),enter:SW(t,!1),exit:AW(t,!1),disappear:AW(t,!1)}))),$H(),QG(),qG(),hz.registerSeries($U.type,$U)},ZU=`${hB}_BOX_PLOT_OUTLIER_VALUE`;var JU;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(JU||(JU={}));const QU=(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={[ZU]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class tY extends aN{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===JU.OUTLIER)return this.series.getOutliersField();if(t===JU.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case JU.MIN:return this.series.getMinField();case JU.MAX:return this.series.getMaxField();case JU.MEDIAN:return this.series.getMedianField();case JU.Q1:return this.series.getQ1Field();case JU.Q3:return this.series.getQ3Field();case JU.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===JU.OUTLIER)return e[ZU];if(t===JU.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case JU.MIN:return e[this.series.getMinField()];case JU.MAX:return e[this.series.getMaxField()];case JU.MEDIAN:return e[this.series.getMedianField()];case JU.Q1:return e[this.series.getQ1Field()];case JU.Q3:return e[this.series.getQ3Field()];case JU.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[ZU])}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.getContentKey(JU.OUTLIER),value:this.getContentValue(JU.OUTLIER),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(JU.MAX),value:this.getContentValue(JU.MAX),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(JU.Q3),value:this.getContentValue(JU.Q3),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(JU.MEDIAN),value:this.getContentValue(JU.MEDIAN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(JU.Q1),value:this.getContentValue(JU.Q1),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(JU.MIN),value:this.getContentValue(JU.MIN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(JU.SERIES_FIELD),value:this.getContentValue(JU.SERIES_FIELD),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]}}}class eY extends zH{constructor(){super(...arguments),this.type=eY.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}}eY.type="boxPlot";const iY=()=>{hz.registerMark(eY.type,eY),kR.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(SO).registerChannelEncoder("x",((t,e,i,s,n,r)=>r&&_b(r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,s,n,r)=>r&&_b(r.direction)?{shaft:{y:e,y1:e}}:null)).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&_b(r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&_b(r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&_b(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&&_b(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&&_b(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&&_b(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}}))),kR.registerAnimationType("boxplotScaleIn",AO),kR.registerAnimationType("boxplotScaleOut",kO),_O(),gO(),mO(),kR.registerGlyph("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(TO).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&_b(r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&_b(r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&_b(r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&_b(r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&_b(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}}))),kR.registerAnimationType("barBoxplotScaleIn",wO),kR.registerAnimationType("barBoxplotScaleOut",CO),_O(),gO(),mO()};class sY extends SG{constructor(){super(...arguments),this.type=oB.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(sY.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(sY.mark.outlier,{progressive:t,key:_D,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,Jz.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"},Jz.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=>GF(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>GF(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>GF(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>GF(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>GF(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},Jz.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=>GF(e(this.getDatumPositionValues(t,ZU),{bandPosition:this._bandPosition}),s)}:{x:this.dataToPositionX.bind(this),y:t=>GF(e(this.getDatumPositionValues(t,ZU),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,Jz.STATE_NORMAL,t.AttributeLevel.Series)}}initData(){if(super.initData(),!this._data)return;Dz(this._dataSet,"foldOutlierData",QU),Dz(this._dataSet,"addVChartProperty",ZN);const t=new _a(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${hB}_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:aG.bind(this),call:oG}},!1),this._outlierDataView=new iG(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=xG(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=hz.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(uG("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(dG(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(dG(null===(a=hz.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new tY(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]}}sY.type=oB.boxPlot,sY.mark=pF;class nY extends zH{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=nY.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})}}nY.type="text";const rY=()=>{hz.registerMark(nY.type,nY),vO(),fM(),gM(),kR.registerGraphic(RB.richtext,jg)};function aY(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 oY extends aN{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 lY=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),hY={type:"fadeIn"},cY=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function dY(t,e){return"fadeIn"===e?hY:lY(t)}class uY extends BW{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 pY extends RW{constructor(){super(...arguments),this.type=oB.rangeColumn,this._barMarkType="rect",this._barName=oB.bar,this.transformerConstructor=uY}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(pY.mark.bar,{morph:mG(this._spec,pY.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(pY.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(pY.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}});aY(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}});aY(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=xG(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(dG(null===(i=hz.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),uG("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(dG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),uG("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(dG(null===(n=hz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),uG("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new oY(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)}}pY.type=oB.rangeColumn,pY.mark=yF,pY.transformerConstructor=uY;const gY=()=>{CW(),rY(),hz.registerAnimation("rangeColumn",((t,e)=>({appear:dY(t,e),enter:lY(t),exit:cY(t),disappear:cY(t)}))),$H(),QG(),qG(),hz.registerSeries(pY.type,pY)};class mY extends pY{constructor(){super(...arguments),this.type=oB.rangeColumn3d,this._barMarkType="rect3d",this._barName=oB.bar3d}}mY.type=oB.rangeColumn3d,mY.mark=bF;class fY extends aN{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 vY extends _W{constructor(){super(...arguments),this.type=oB.rangeArea}initMark(){var t;const{customShape:e,stateSort:i}=null!==(t=this._spec.area)&&void 0!==t?t:{};this._areaMark=this._createMark(vY.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 fY(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))}}vY.type=oB.rangeArea,vY.mark=kF;class _Y extends yG{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=EB,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:[]};Dw(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:[]};Dw(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)&&bG(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 yY=(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[_B],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[_B]*t;g(e,b,i),b+=i}))}return 0!==m&&(i[i.length-1][l]=r),i};function bY(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const xY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:bY(t,!0,qz.appear)}),SY={type:"fadeIn"},AY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:bY(t,!0,qz.enter)}),kY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:bY(t,!0,qz.exit)}),MY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:bY(t,!0,qz.exit)});function TY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return SY;case"growRadius":return xY(Object.assign(Object.assign({},t),{growField:"radius"}));default:return xY(Object.assign(Object.assign({},t),{growField:"angle"}))}}class wY extends zH{constructor(t,e){super(t,e),this.type=CY.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[AB])[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 CY extends wY{constructor(){super(...arguments),this.type=CY.type}}CY.type="arc";const EY=()=>{fM(),Xk(),kR.registerGraphic(RB.arc,Kg),uO.useRegisters([QI,tD,ZI,JI]),hz.registerMark(CY.type,CY)};class PY extends _G{_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=Tj({},this._theme,i,t);const n=(t,e)=>Tj({},"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 BY extends _Y{constructor(){super(...arguments),this.transformerConstructor=PY,this._pieMarkName="pie",this._pieMarkType="arc",this._startAngle=TB,this._endAngle=wB,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this.dataToCentralPosition=t=>{const e=t[AB];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;Dz(this._dataSet,"pie",yY),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:bB,asEndAngle:xB,asRatio:yB,asMiddleAngle:AB,asRadian:MB,asQuadrant:kB,asK:SB}},!1);const e=new _a(this._dataSet,{name:`${hB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new iG(this._option,e)}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},BY.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{morph:mG(this._spec,this._pieMarkName),defaultMorphElementKey:this._seriesField,key:yD,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 aB(bB)(t)}endAngleScale(t){return aB(xB)(t)}initMarkStyle(){const e=this._pieMark;e&&this.setMarkStyle(e,{x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:WF(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:WF(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:aB(mB).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[AB];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===qz.appear)return this._startAngle;if(i===qz.disappear)return this._endAngle;const n=[qz.disappear,qz.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[_D];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[_D]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[_D])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[_D])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+ie({x:0,y:0},a,e[AB]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+ie({x:0,y:0},a,e[AB]).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[AB]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+ie({x:0,y:0},a,e[AB]).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]}}BY.transformerConstructor=PY,BY.mark=tF;class RY extends BY{constructor(){super(...arguments),this.type=oB.pie}}RY.type=oB.pie;const LY=()=>{EY(),hz.registerAnimation("pie",((t,e)=>({appear:TY(t,e),enter:AY(t),exit:kY(t),disappear:MY(t)}))),hz.registerSeries(RY.type,RY)};class OY extends wY{constructor(){super(...arguments),this.type=OY.type,this._support3d=!0}}OY.type="arc3d";class IY extends PY{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class DY extends BY{constructor(){super(...arguments),this.type=oB.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=IY}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[AB];return"inside"===i.position?te(e):0},this.setMarkStyle(e,Object.assign(Object.assign({},s),{z:100}),void 0,t.AttributeLevel.Mark)}}DY.type=oB.pie3d,DY.mark=eF,DY.transformerConstructor=IY;const FY=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)=>e.getGraphicAttribute("innerRadius")},outerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("outerRadius")}}}},jY={type:"fadeIn"},zY=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),HY=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),VY=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function NY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return jY;case"growAngle":return FY(Object.assign(Object.assign({},t),{growField:"angle"}));default:return FY(Object.assign(Object.assign({},t),{growField:"radius"}))}}class GY extends _Y{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(MD),this.setInnerRadiusField(kD)}setValueFieldToPercent(){this.setRadiusField(wD),this.setInnerRadiusField(TD)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}class WY extends _G{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}const UY=(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:CB,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:EB,layoutRadius:e.layoutRadius}};class YY extends VG{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(!BV(e))return null;const{axisType:i,componentName:s,startAngle:n,endAngle:r,center:a,outerRadius:o,layoutRadius:l}=UY(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(!BV(e))return;const{axisType:a,componentName:o,startAngle:l,endAngle:h,center:c,outerRadius:d,layoutRadius:u}=UY(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=hz.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=TB,this._endAngle=wB,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),sB(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:CV(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(){sB(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 Dw(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:Dw(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:KF(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:KF(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=>IV(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=EB,e=0;const i=this.getChart().getSpec();return sB(this.getRegions(),(s=>{const n=s;if(r=n.type,[oB.rose,oB.radar,oB.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(Tj({},this._axisStyle,s)),this._gridMark){this._gridMark.getProduct().encode(Tj({},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)}}YY.type=r.polarAxis,YY.specKey="axes";class KY extends YY{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new TC}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}}KY.type=r.polarLinearAxis,KY.specKey="axes",U(KY,XG);const XY=()=>{NG(),hz.registerComponent(KY.type,KY)};class $Y extends YY{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new rC}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(){}}$Y.type=r.polarBandAxis,$Y.specKey="axes",U($Y,ZG);const qY=()=>{NG(),hz.registerComponent($Y.type,$Y)};class ZY extends GY{constructor(){super(...arguments),this.type=oB.rose,this.transformerConstructor=WY,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(ZY.mark.rose,{morph:mG(this._spec,ZY.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=>GF(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=GF(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(dG(null===(i=hz.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),uG("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}ZY.type=oB.rose,ZY.mark=iF,ZY.transformerConstructor=WY;const JY=()=>{hz.registerSeries(ZY.type,ZY),EY(),hz.registerAnimation("rose",((t,e)=>({appear:NY(t,e),enter:zY(t),exit:HY(t),disappear:VY(t)}))),qY(),XY()};class QY extends gc{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);k(t*e)||(this.valid=!1),this._fromAngle=t,this._fromRadius=e;const{angle:i,radius:s}=this._pointToCoord(this.to);k(i*s)||(this.valid=!1),this._toAngle=i,this._toRadius=s}onUpdate(t,e,i){if(!1!==this.valid)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 tK extends zc{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}),r=ne(s.angle),a=ne(n.angle),o=this._pointToCoord(e),l=this._pointToCoord({x:e.x1,y:e.y1}),h=ne(o.angle),c=ne(l.angle),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 eK=t=>({type:"in"===t?"fadeIn":"fadeOut"});function iK(t,e,i){return"fadeIn"===e?eK(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function sK(t,e,i){return"fadeIn"===e?eK(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 nK=(t,e)=>({custom:Vc,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 rK extends GY{constructor(){super(...arguments),this.type=oB.radar,this.transformerConstructor=RG,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(rK.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:kG,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):TB,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(dG(null===(s=hz.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),uG("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=hz.getAnimationInKey(e);t.setAnimationConfig(dG(null==i?void 0:i(n,r),uG(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}}}rK.type=oB.radar,rK.mark=QD,rK.transformerConstructor=RG,U(rK,MG);const aK=()=>{hz.registerSeries(rK.type,rK),sI(),gW(),CG(),BG(),hz.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:iK(t,e,"in"),enter:iK(t,e,"in"),exit:iK(t,e,"out"),disappear:"clipIn"===e?void 0:iK(t,e,"out"),update:[{options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:tK,customParameters:t,duration:UH.update.duration,easing:UH.update.easing}]}))),hz.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:sK(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:sK(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:QY,customParameters:t,duration:UH.update.duration,easing:UH.update.easing}]}))),hz.registerAnimation("radarGroup",((t,e)=>({appear:nK(t,"in"),disappear:nK(t,"out")}))),Xk(),qY(),XY()};class oK extends aN{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 lK=(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},hK={fill:"#bbb",fillOpacity:.2};class cK extends SG{constructor(){super(...arguments),this.type=oB.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]])),Dz(this._option.dataSet,"objFlat",lK),Dz(this._option.dataSet,"copyDataView",Wz),Fz(this._option.dataSet,"dataview",pa),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:Xz.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(Tj(hK,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(cK.mark.group),this._containerMark=this._createMark(cK.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(cK.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(cK.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(cK.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(cK.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(cK.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(cK.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:bD}}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 HF).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:bD}}initTooltip(){this._tooltipHelper=new oK(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]}}cK.type=oB.dot,cK.mark=oF;class dK extends aN{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 uK=(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 pK extends SG{constructor(){super(...arguments),this.type=oB.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(),Dz(this._option.dataSet,"linkDotInfo",uK),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:Xz.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(pK.mark.group),this._containerMark=this._createMark(pK.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(pK.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(pK.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:bD}}initInteraction(){const t=[];this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new dK(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]}}pK.type=oB.link,pK.mark=aF;class gK extends _Y{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()?kD:LD],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()?MD: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):TB;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?Qt(r):wB,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=GF(this.angleAxisHelper.dataToPosition([t[kD]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=GF(this.angleAxisHelper.dataToPosition([t[MD]]),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(gK.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 Kg(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[Mg({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 vK=()=>{hz.registerAnimation("circularProgress",((t,e)=>({appear:fK(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class _K extends _G{constructor(){super(...arguments),this._supportStack=!0}}class yK extends gK{constructor(){super(...arguments),this.type=oB.circularProgress,this.transformerConstructor=_K,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(yK.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(yK.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()?kD:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?MD: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(dG(null===(i=hz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),uG("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(dG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),uG("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}yK.type=oB.circularProgress,yK.mark=rF,yK.transformerConstructor=_K;function bK(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const xK=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:bK(t)}),SK={type:"fadeIn"};function AK(t,e){return!1===e?{}:"fadeIn"===e?SK:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:bK(t)}))(t)}class kK extends aN{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 MK extends SG{constructor(){super(...arguments),this.type=oB.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(MK.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 GF(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 GF(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 GF(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 GF(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(MK.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 GF(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 GF(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(MK.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=GF(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(Mg({x:i,y:0,height:r,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=GF(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(Mg({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(dG(null===(i=hz.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),uG("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(dG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),uG("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new kK(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}MK.type=oB.linearProgress,MK.mark=dF;const TK=()=>{CW(),hz.registerAnimation("linearProgress",((t,e)=>({appear:AK(t,e),enter:{type:"grow"},disappear:xK(t)}))),$H(),hz.registerSeries(MK.type,MK)},wK=[0],CK=[20,40],EK=[200,500],PK={shrink:!1,enlarge:!1,fontSizeLimitMin:0},BK=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],RK=`${hB}_WORD_CLOUD_WEIGHT`,LK=`${hB}_WORD_CLOUD_TEXT`;class OK extends yG{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=CK}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:EK,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:wK,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)?LK:this._nameField,this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:PK},this._spec.wordCloudConfig),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:wK,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=!BK.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(OK.mark.word,{key:yD,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(dG(hz.getAnimationInKey("wordCloud")(n,s),uG("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 HF).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:bD])}}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 TC,o=this._fontWeightRange;if(r){const[e,i]=ub(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:RK,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:LK,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:Jy(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[r,a],shape:this._maskShape,dataIndexKey:yD,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:RK}: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:yD,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:RK}: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)}}OK.mark=lF;function IK(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)||UH.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 FK(){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 jK(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 zK=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function HK(t){return d(t)?t:function(){return t}}class VK{constructor(t){var e,i,s;switch(this.options=z({},VK.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=(s=this.options.shape,DK[s]?DK[s]():DK.circle()),this.getText=null!==(e=HK(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=HK(this.options.fontWeight),this.getTextFontSize=HK(this.options.fontSize),this.getTextFontStyle=HK(this.options.fontStyle),this.getTextFontFamily=HK(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>zK(10,50);break;case"random-light":this.getTextColor=()=>zK(50,90);break;default:this.getTextColor=HK(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 GK extends VK{constructor(t){var e;super(z({},GK.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<=GK.defaultOptions.minFontSize&&(this.options.minFontSize=GK.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=NK[this.options.spiral])&&void 0!==e?e:NK.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=HK(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}=jK(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(E_.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(KK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(YK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}KK(p,this._size)&&(p=XK(p,this._size))}else if(KK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||UK(p,i))&&(!i||!WK(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 WK(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 UK(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,KK=(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 XK(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}=jK(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)}qK.defaultOptions={enlarge:!1};const JK={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},QK=(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?tX(t.fontFamily):"sans-serif",d=t.fontStyle?tX(t.fontStyle):"normal",u=t.fontWeight?tX(t.fontWeight):"normal",p=t.rotate?tX(t.rotate):0,g=tX(t.text),m=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",f=t.padding?tX(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||JK,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?tX(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=iX(sX(t,l),C);w=i=>e(t(i))}let E=GK;"fast"===t.layoutType?E=qK:"grid"===t.layoutType&&(E=$K);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()},tX=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],eX=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),iX=(t,e)=>{if(t[0]===t[1])return t=>e[0];const i=eX(t[0]),s=eX(t[1]),n=Math.min(i,s),r=Math.max(i,s);return t=>(eX(t)-n)/(r-n)*(e[1]-e[0])+e[0]},sX=(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 nX(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{kR.registerTransform("wordcloud",{transform:QK,markPhase:"beforeJoin"},!0),rY(),hz.registerAnimation("wordCloud",((t,e)=>({appear:IK(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),hz.registerSeries(rX.type,rX)};(class extends OK{constructor(){super(...arguments),this.type=oB.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(OK.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(dG(null===(e=hz.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}})),uG("word",this._spec,this._markAttributeContext)))}}).type=oB.wordCloud3d;const oX=(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},lX=(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},hX=`${hB}_FUNNEL_TRANSFORM_RATIO`,cX=`${hB}_FUNNEL_REACH_RATIO`,dX=`${hB}_FUNNEL_HEIGHT_RATIO`,uX=`${hB}_FUNNEL_VALUE_RATIO`,pX=`${hB}_FUNNEL_LAST_VALUE_RATIO`,gX=`${hB}_FUNNEL_NEXT_VALUE_RATIO`,mX=`${hB}_FUNNEL_LAST_VALUE`,fX=`${hB}_FUNNEL_CURRENT_VALUE`,vX=`${hB}_FUNNEL_NEXT_VALUE`,_X=`${hB}_FUNNEL_TRANSFORM_LEVEL`,yX=20;class bX extends aN{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[cX])).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 xX extends zH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class SX extends xX{constructor(){super(...arguments),this.type=SX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}SX.type="polygon";const AX=()=>{hz.registerMark(SX.type,SX),fM(),cM(),kR.registerGraphic(RB.polygon,qg),uO.useRegisters([UI,YI])};class kX extends _G{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class MX extends yG{constructor(){super(...arguments),this.type=oB.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=kX,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;Dz(this._dataSet,"funnel",oX),Dz(this._dataSet,"funnelTransform",lX);const t=new _a(this._dataSet,{name:`${hB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new iG(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:fX,asTransformRatio:hX,asReachRatio:cX,asHeightRatio:dX,asValueRatio:uX,asNextValueRatio:gX,asLastValueRatio:pX,asLastValue:mX,asNextValue:vX,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:_X}})}initMark(){var t,e,i,s,n,r,a,o,l,h,c,d;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},MX.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,morph:mG(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({},MX.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(MX.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(MX.mark.outerLabelLine,{themeSpec:e,markSpec:t,depend:[this._funnelOuterLabelMark.label],noSeparateStyle:!0})}}initTooltip(){this._tooltipHelper=new bX(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*aB(cX).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(dG(null===(s=hz.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),uG("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(dG(hz.getAnimationInKey("fadeInOut")(),uG(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(dG(hz.getAnimationInKey("funnel")({},o),uG(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(dG(null===(a=hz.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),uG("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[pX])/2:this._getSecondaryAxisLength(t[uX])/2,n=this._getSecondaryAxisLength(t[uX])/2):(s=this._getSecondaryAxisLength(t[uX])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[gX])/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[_X])}_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[yD]===t[yD]));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?yX: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{AX(),rY(),OU(),hz.registerSeries(MX.type,MX),hz.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},KH))),hz.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Nc,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Nc,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),$H()};class wX extends xX{constructor(){super(...arguments),this.type=wX.type}}wX.type="pyramid3d";class CX extends kX{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class EX extends MX{constructor(){super(...arguments),this.type=oB.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=CX}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},EX.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({},EX.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(EX.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(EX.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())}}EX.type=oB.funnel3d,EX.mark=cF,EX.transformerConstructor=CX;const PX=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},BX=t=>{const e=t.mark.elements.filter((t=>t.diffState===BB.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}))},RX=(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]},LX=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=BX(i),a=RX(r,s,n);return PX(e.startAngle,a)*(n-s)+s},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=BX(i),a=RX(r,s,n);return PX(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}}}),OX=t=>{const e=$(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),i=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[e,i]},IX=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=BX(i),a=OX(r);return PX(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=BX(i),a=OX(r);return PX(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}}}),DX=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},FX=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):FX(t.children,e,i)))})),e};function jX(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=VX(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}},NX=(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=NX(t.children,e,t,n))})),s},GX=(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=GX(t.children,e,t,n)),n=e(t,s,i,n)})),n},WX={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:jX,slice:zX,sliceDice:function(t,e,i,s,n){(t.depth%2==1?zX:jX)(t,e,i,s,n)}};class UX{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({},UX.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?hb(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?HX(this.options.aspectRatio):null!==(e=WX[this.options.splitType])&&void 0!==e?e:WX.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=VX(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)}))}}UX.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const YX=(t,e)=>{const i=new UX(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 FX(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},KX={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class XX{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];jX(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),KX);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({},XX.defaultOpionts,t):Object.assign({},XX.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?hb(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+gb(this.options.center[0],t.width),s=t.y0+gb(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=>gb(t,n))):gb(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>gb(t,n))):gb(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=gb(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=VX(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)}}}XX.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const $X=4294967296;function qX(t,e){let i,s;if(QX(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function QX(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 s$(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 n$(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 r$(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 a$(t){return{_:t,next:null,prev:null}}function o$(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];s$(n,s,r);let a,o,l,h,c,d,u,p=a$(s),g=a$(n),m=a$(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=VX(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)%$X)/$X}(),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:d$.defaultOpionts.nodeSort;NX([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)NX([o],l$(h)),GX([o],h$(this._getPadding,.5,a)),NX([o],c$(1,this._maxDepth));else{const t=Math.min(s.width,s.height);NX([o],l$(d$.defaultOpionts.setRadius)),GX([o],h$(db,1,a)),c&&GX([o],h$(this._getPadding,o.radius/t,a)),NX([o],c$(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}d$.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const u$=(t,e={})=>{if(!t)return[];const i=[];return FX(t,i,e),i},p$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new XX(i).layout(t,{width:s,height:n})};class g$ extends aN{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var m$;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(m$||(m$={}));const f$=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===m$.DrillDown){return Y(sz(t,n,s,"children"))}if(i.type===m$.DrillUp){const e=nz(t,n,s,"children");if(e)return Y(e)}return t};class v${_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=vU(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;Dz(t,"drillFilter",f$),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:m$.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:m$.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:m$.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:m$.DrillUp},model:this}),r}}class _$ extends _Y{constructor(){super(...arguments),this.type=oB.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:nG),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:yD},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),Dz(this._dataSet,"sunburstLayout",p$),Dz(this._dataSet,"flatten",u$),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:sG,operations:["max","min","values"]},{key:nG,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(Dz(t.dataSet,"addVChartProperty",ZN),t.transform({type:"addVChartProperty",options:{beforeCall:lG.bind(this),call:hG}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t,e;if(!1===this._sunburst.visible)return;const i=this._createMark(_$.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()},Jz.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(_$.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},Jz.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new g$(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(dG(null===(e=hz.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),uG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(dG(null===(e=hz.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),uG(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]}}_$.type=oB.sunburst,_$.mark=_F,U(_$,v$);const y$=()=>{hz.registerSeries(_$.type,_$),EY(),rY(),$H(),hz.registerAnimation("sunburst",((t,e)=>({appear:DX(0,e),enter:LX(t),exit:IX(t),disappear:IX(t)})))},b$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new d$(i).layout(t,{width:s,height:n})};class x$ extends aN{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const S$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"};class A$ extends SG{constructor(){super(...arguments),this.type=oB.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:nG),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:yD},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),Dz(this._dataSet,"circlePackingLayout",b$),Dz(this._dataSet,"flatten",u$),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)||(Dz(t.dataSet,"addVChartProperty",ZN),t.transform({type:"addVChartProperty",options:{beforeCall:lG.bind(this),call:hG}}))}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(A$.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},Jz.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(A$.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"},Jz.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:sG,operations:["max","min","values"]},{key:nG,operations:["values"]}])}initTooltip(){this._tooltipHelper=new x$(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(dG(null===(i=hz.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),uG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(dG(null===(e=hz.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),uG(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]}}A$.type=oB.circlePacking,A$.mark=xF,U(A$,v$);const k$=()=>{hz.registerSeries(A$.type,A$),EY(),rY(),XH(),hz.registerAnimation("circlePacking",((t,e)=>({appear:S$(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},M$=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=M$(t.children):t.value=0),e+=Math.abs(t.value)})),e};function T$(t){return t.depth}function w$(t,e){return e-1-t.endDepth}const C$=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),E$=(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},P$={left:T$,right:w$,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:T$,end:w$},B$=_t(0,1);class R${constructor(t){this._ascendingSourceBreadth=(t,e)=>C$(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>C$(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},R$.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?hb(e):null;this._getNodeKey=i,this._logger=rt.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):P$[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)};yb(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))),yb(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=[];M$(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}`;if(n[r])return n[r].value+=Tt(t.value),void n[r].datum.push(t);const a={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[t],value:t.value,parents:t.parents.map((t=>t.key))};i.push(a),s[t.source].sourceLinks.push(a),s[t.target].targetLinks.push(a),n[r]=a})),{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=[E$(s[t.source]),E$(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=Math.min(n>0?Math.max(this.options.nodeGap,n):this.options.nodeGap,this._viewBox.height/e);a=()=>i,this._gapY=i,this.options.equalNodeHeight?o=this._viewBox.height/e-i:r=t.reduce(((t,e)=>{const s=e.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-(e.length-1)*i)/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,n,0),p=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.max(e.value?i*B$(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&&(o/=i.length-1,n+o>0)){n+=o,this._gapY=Math.min(n);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(C$),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(C$),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 R$(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]:[]},O$=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&O$(t,e.children,i)}))},I$=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},D$=(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 R$(e),r=[];return r.push(n.layout(s,i)),r},F$=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:[]},j$=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 z$ extends aN{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 H$=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),V$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:H$(t),N$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class G$ extends zH{constructor(){super(...arguments),this.type=G$.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}}G$.type="linkPath";const W$=()=>{kR.registerGlyph("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(BO).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),kR.registerAnimationType("linkPathGrowIn",RO),kR.registerAnimationType("linkPathGrowOut",LO),kR.registerAnimationType("linkPathUpdate",OO),_O(),pO(),hz.registerMark(G$.type,G$)};class U$ extends SG{constructor(){super(...arguments),this.type=oB.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=[Jz.STATE_SANKEY_EMPHASIS,Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:s})}else n.target===e.key?i.includes(n.source)||i.push(n.source):(t.removeState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState(Jz.STATE_SANKEY_EMPHASIS),e.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS)):(t.removeState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(Jz.STATE_SANKEY_EMPHASIS),void s.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(Jz.STATE_SANKEY_EMPHASIS),void s.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:h.value/r.value});s.removeState(Jz.STATE_SANKEY_EMPHASIS),s.addState(Jz.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=[Jz.STATE_SANKEY_EMPHASIS,Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS),void t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS),void t.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:o.value/i.value});t.removeState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.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){Dz(this._dataSet,"sankeyLayout",D$),Dz(this._dataSet,"sankeyFormat",I$),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:Xz.sankeyLayout});const{dataSet:a}=this._option;Dz(a,"sankeyNodes",F$),Dz(a,"flatten",u$);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:aG.bind(this),call:oG}},!1),this._nodesSeriesData=new iG(this._option,o),Dz(a,"sankeyLinks",j$);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:aG.bind(this),call:oG}},!1),this._linksSeriesData=new iG(this._option,l)}}initMark(){var t,e,i,s;const n=this._createMark(U$.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(U$.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(U$.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},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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(dG(null===(i=hz.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(r,a),uG("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(dG(null===(s=hz.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(r,a),uG("link",this._spec,this._markAttributeContext))),this._labelMark&&this._labelMark.setAnimationConfig(dG(null===(n=hz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),uG("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([Jz.STATE_SANKEY_EMPHASIS_REVERSE,Jz.STATE_SANKEY_EMPHASIS]),e.includes(t.getDatum().key)||t.addState(Jz.STATE_SANKEY_EMPHASIS_REVERSE)}))}initTooltip(){this._tooltipHelper=new z$(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 HF;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 O$(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]}}U$.type=oB.sankey,U$.mark=mF;const Y$=()=>{kR.registerTransform("sankey",{transform:L$,markPhase:"beforeJoin"},!0),CW(),W$(),rY(),hz.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:V$(t,e)},KH))),hz.registerAnimation("sankeyLinkPath",((t,e)=>({appear:N$(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),$H(),hz.registerSeries(U$.type,U$)},K$=(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=u$(n);return i=QN([{latestData:r}],e),i};class X$ extends aN{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}get defaultShapeType(){return"square"}}const $$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class q$ extends _G{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}class Z$ extends SG{constructor(){super(...arguments),this.type=oB.treemap,this.transformerConstructor=q$,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:nG),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:yD},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&&[nG,"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)&&(Dz(this._rawData.dataSet,"addVChartProperty",ZN),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:lG.bind(this),call:hG}}))}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){Dz(this._dataSet,"hierarchyDimensionStatistics",K$),Dz(this._dataSet,"flatten",u$);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:sG,operations:["max","min","values"]},{key:nG,operations:["values"]}])}initMark(){var t,e,i,s;const n=this._createMark(Z$.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(Z$.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()},Jz.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()},Jz.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},Jz.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},Jz.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},Jz.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},Jz.STATE_NORMAL,t.AttributeLevel.Series))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(dG(null===(e=hz.getAnimationInKey("treemap"))||void 0===e?void 0:e(),uG(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 X$(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]}}Z$.type=oB.treemap,Z$.mark=gF,Z$.transformerConstructor=q$,U(Z$,v$),U(Z$,yU);const J$=()=>{CW(),rY(),hz.registerAnimation("treemap",((t,e)=>({appear:$$(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),$H(),kR.registerTransform("treemap",{transform:YX,markPhase:"beforeJoin"},!0),hz.registerSeries(Z$.type,Z$)},Q$={type:"fadeIn"};function tq(t,e){return"fadeIn"===e?Q$:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class eq extends _G{constructor(){super(...arguments),this._supportStack=!1}}class iq extends gK{constructor(){super(...arguments),this.type=oB.gaugePointer,this.transformerConstructor=eq,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(iq.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},iq.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(iq.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(dG(null===(i=hz.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),uG("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}iq.type=oB.gaugePointer,iq.mark=vF,iq.transformerConstructor=eq;const sq=()=>{hz.registerSeries(iq.type,iq),pU(),CW(),hz.registerAnimation("gaugePointer",((t,e)=>{const i=tq(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),qY(),XY()};class nq extends _G{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class rq extends gK{constructor(){super(...arguments),this.type=oB.gauge,this.transformerConstructor=nq,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();Dz(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[OD]=t[this._angleField[0]],t[LD]=e>0?i[e-1][OD]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(rq.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(rq.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[LD])?this.angleAxisHelper.dataToPosition([t[LD]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[OD]])}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(dG(null===(i=hz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),uG("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}rq.type=oB.gauge,rq.mark=fF,rq.transformerConstructor=nq;class aq extends EG{constructor(){super(...arguments),this.type=aq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}aq.type="cell";const oq=()=>{hz.registerMark(aq.type,aq),fM(),_M(),kR.registerGraphic(RB.cell,yg),kR.registerMark(RB.cell,lD)};function lq(t){return!1===t?{}:{type:"fadeIn"}}class hq extends aN{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return p(i)&&"dimension"===t&&(i.visible=!1),i}}class cq extends _G{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class dq extends SG{constructor(){super(...arguments),this.type=oB.heatmap,this.transformerConstructor=cq}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(dq.mark.cell,{morph:mG(this._spec,dq.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(dq.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=xG(this);this._cellMark.setAnimationConfig(dG(null===(i=hz.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),uG("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 hq(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]}}dq.type=oB.heatmap,dq.mark=SF,dq.transformerConstructor=cq;const uq=()=>{rY(),oq(),hz.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},KH),{appear:lq(e)}))),QG(),qG(),hz.registerSeries(dq.type,dq)},pq=(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=gb(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=gb(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+gb(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+gb(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=hb(e.field),C=t.map(w),[E,P]=ub(C),B=E===P?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(P-E),R=u(e.radiusField)?w:hb(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?ub(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=gq(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),mq({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},mq=(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,[_D]:null==n?void 0:n[_D],[bD]:null==n?void 0:n[bD]}};class vq extends zH{constructor(){super(...arguments),this.type=vq.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}}vq.type="ripple";const _q=()=>{hz.registerMark(vq.type,vq),kR.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}}))),_O(),fO()},yq=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class bq extends _G{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class xq extends _Y{constructor(){super(...arguments),this.type=oB.correlation,this.transformerConstructor=bq,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;Dz(this._dataSet,"correlation",pq);const s=new fa;Fz(s,"dataview",pa),Dz(s,"correlationCenter",fq);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 iG(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(xq.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:_D,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(xq.mark.ripplePoint,{key:_D,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});a&&(this._ripplePointMark=a);const o=this._createMark(xq.mark.centerPoint,{key:_D,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[gD],y:t=>t[mD],size:t=>t[fD],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},Jz.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},Jz.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},Jz.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)},Jz.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(dG(null===(e=hz.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),uG("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()}}xq.type=oB.correlation,xq.mark=AF,xq.transformerConstructor=bq;const Sq=()=>{BG(),_q(),hz.registerSeries(xq.type,xq),hz.registerAnimation("correlation",((t,e)=>Object.assign({appear:yq(0,e)},YH)))};class Aq extends zH{constructor(){super(...arguments),this.type=Aq.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}}Aq.type="liquid";const kq=(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/2):t;class Mq extends aN{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 Tq extends yG{constructor(){super(...arguments),this.type=oB.liquid,this.transformerConstructor=RG,this._liquidBackgroundMark=null,this._liquidOutlineMark=null}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){super.setAttrFromSpec(),this._marginSpec=$F(this._spec.outlineMargin),this._paddingSpec=$F(this._spec.outlinePadding),this.setValueField(this._spec.valueField)}rawDataUpdate(t){super.rawDataUpdate(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(Tq.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(Tq.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidMark=this._createMark(Tq.mark.liquid,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_getPosAndSizeFormRegion(t=!1){const{top:e=0,bottom:i=0,left:s=0,right:n=0}=this._marginSpec,{top:r=0,bottom:a=0,left:o=0,right:l=0}=this._paddingSpec,{width:h,height:c}=this._region.getLayoutRect();return t?{x:h/2+(s-n)/2,y:c/2+(e-i)/2,size:Math.min(h-(s+n),c-(e+i))}:{x:h/2+(s+l-(n+l))/2,y:c/2+(e+r-(i+a))/2,size:Math.min(h-(s+n+o+l),c-(e+i+r+a))}}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),x:()=>this._getPosAndSizeFormRegion(!0).x,y:()=>this._getPosAndSizeFormRegion(!0).y,size:()=>this._getPosAndSizeFormRegion(!0).size,symbolType:()=>{var t;return kq(null!==(t=this._spec.maskShape)&&void 0!==t?t:"circle",this._getPosAndSizeFormRegion(!0).size)}},"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:()=>{var t;const{x:e,y:i,size:s}=this._getPosAndSizeFormRegion();return[yg({x:e,y:i,size:s,symbolType:kq(null!==(t=this._spec.maskShape)&&void 0!==t?t:"circle",s),fill:!0})]}},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setInteractive(!1)}_initLiquidMarkStyle(){const e=this._liquidMark;e&&this.setMarkStyle(e,{dx:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,y:()=>{const{y:t,size:e}=this._getPosAndSizeFormRegion();return t-e/2+e-e*this._heightRatio},height:()=>{const{size:t}=this._getPosAndSizeFormRegion();return t*this._heightRatio},fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new Mq(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}initInteraction(){this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i;const s={y:{from:()=>{const{y:t,size:e}=this._getPosAndSizeFormRegion();return t-e/2+e},to:()=>{const{y:t,size:e}=this._getPosAndSizeFormRegion();return t-e/2+e-e*this._heightRatio}},height:{from:0,to:()=>{const{size:t}=this._getPosAndSizeFormRegion();return t*this._heightRatio}}},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(dG(null===(i=hz.getAnimationInKey("liquid"))||void 0===i?void 0:i(s,n),uG("liquid",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=DM(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]}}Tq.type=oB.liquid,Tq.mark=MF,Tq.transformerConstructor=RG;const wq=t=>Y(t).join(",");class Cq extends aN{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>wq(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>wq(null==t?void 0:t[this.series.getDimensionField()[0]])}}class Eq extends _G{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}class Pq extends yG{constructor(){super(...arguments),this.type=oB.venn,this.transformerConstructor=Eq,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:yD)}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(Pq.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(Pq.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()},Jz.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},Jz.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},Jz.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=>wq(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)}},Jz.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=>wq(t.sets)},Jz.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new Cq(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:wq(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return wq(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[wq(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(wq(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(dG(null===(e=hz.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),uG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(dG(null===(e=hz.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),uG(t.name,this._spec,this._markAttributeContext)))}))}}Pq.type=oB.venn,Pq.mark=TF,Pq.transformerConstructor=Eq;class Bq extends hW{_isValidSeries(t){return t===oB.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 Rq extends oW{constructor(){super(...arguments),this.transformerConstructor=Bq,this.type="map",this.seriesType=oB.map}}Rq.type="map",Rq.seriesType=oB.map,Rq.transformerConstructor=Bq;class Lq extends hW{_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 Oq extends Lq{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=EV(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,Tj({},s,l)),n&&Object.assign(o,Tj({},n,o))}}class Iq extends Lq{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 Dq extends Lq{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 Fq extends oW{constructor(){super(...arguments),this.transformerConstructor=Dq}}Fq.transformerConstructor=Dq;class jq extends Fq{constructor(){super(...arguments),this.transformerConstructor=Dq,this.type="pie",this.seriesType=oB.pie}}jq.type="pie",jq.seriesType=oB.pie,jq.transformerConstructor=Dq;class zq extends Dq{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class Hq extends Fq{constructor(){super(...arguments),this.transformerConstructor=zq,this.type="pie3d",this.seriesType=oB.pie3d}}Hq.type="pie3d",Hq.seriesType=oB.pie3d,Hq.transformerConstructor=zq;class Vq extends Iq{_getDefaultSeriesSpec(t){var e,i,s;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:EB,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:EB,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=>Tj({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}class Nq extends oW{constructor(){super(...arguments),this.transformerConstructor=Vq,this.type="rose",this.seriesType=oB.rose,this._canStack=!0}}Nq.type="rose",Nq.seriesType=oB.rose,Nq.transformerConstructor=Vq;class Gq extends Iq{_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:Tj({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=>Tj({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class Wq extends oW{constructor(){super(...arguments),this.transformerConstructor=Gq,this.type="radar",this.seriesType=oB.radar,this._canStack=!0}}Wq.type="radar",Wq.seriesType=oB.radar,Wq.transformerConstructor=Gq;class Uq extends hW{_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")&&Tj(e,aH(this.type,t))})),this._transformAxisSpec(t)}}class Yq extends oW{constructor(){super(...arguments),this.transformerConstructor=Uq,this.type="common",this._canStack=!0}}Yq.type="common",Yq.transformerConstructor=Uq;class Kq extends cW{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 Xq extends oW{constructor(){super(...arguments),this.transformerConstructor=Kq,this._canStack=!0}}Xq.transformerConstructor=Kq;class $q extends Kq{transformSpec(t){super.transformSpec(t),sH(t)}}class qq extends Xq{constructor(){super(...arguments),this.transformerConstructor=$q,this.type="histogram",this.seriesType=oB.bar}}qq.type="histogram",qq.seriesType=oB.bar,qq.transformerConstructor=$q;class Zq extends Xq{constructor(){super(...arguments),this.transformerConstructor=$q,this.type="histogram3d",this.seriesType=oB.bar3d}}Zq.type="histogram3d",Zq.seriesType=oB.bar3d,Zq.transformerConstructor=$q;class Jq extends Oq{_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 Qq extends oW{constructor(){super(...arguments),this.transformerConstructor=Jq,this.type="circularProgress",this.seriesType=oB.circularProgress,this._canStack=!0}}Qq.type="circularProgress",Qq.seriesType=oB.circularProgress,Qq.transformerConstructor=Jq;class tZ extends Oq{_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:oB.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===oB.gauge||t.type===oB.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===oB.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 eZ extends oW{constructor(){super(...arguments),this.transformerConstructor=tZ,this.type="gauge",this.seriesType=oB.gaugePointer}}eZ.type="gauge",eZ.seriesType=oB.gaugePointer,eZ.transformerConstructor=tZ;class iZ extends hW{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class sZ extends oW{constructor(){super(...arguments),this.transformerConstructor=iZ,this.type="wordCloud",this.seriesType=oB.wordCloud}}sZ.transformerConstructor=iZ;class nZ extends iZ{_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 rZ extends sZ{constructor(){super(...arguments),this.transformerConstructor=nZ,this.type="wordCloud",this.seriesType=oB.wordCloud}}rZ.type="wordCloud",rZ.seriesType=oB.wordCloud,rZ.transformerConstructor=nZ;class aZ extends iZ{_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 oZ extends sZ{constructor(){super(...arguments),this.transformerConstructor=aZ,this.type="wordCloud3d",this.seriesType=oB.wordCloud3d}}oZ.type="wordCloud3d",oZ.seriesType=oB.wordCloud3d,oZ.transformerConstructor=aZ;class lZ extends hW{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 hZ extends oW{constructor(){super(...arguments),this.transformerConstructor=lZ,this.type="funnel",this.seriesType=oB.funnel}}hZ.type="funnel",hZ.seriesType=oB.funnel,hZ.transformerConstructor=lZ;class cZ extends oW{constructor(){super(...arguments),this.transformerConstructor=lZ,this.type="funnel3d",this.seriesType=oB.funnel3d}}cZ.type="funnel3d",cZ.seriesType=oB.funnel3d,cZ.transformerConstructor=lZ;class dZ extends cW{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=EV(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=EV(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class uZ extends oW{constructor(){super(...arguments),this.transformerConstructor=dZ,this.type="linearProgress",this.seriesType=oB.linearProgress,this._canStack=!0}}uZ.type="linearProgress",uZ.seriesType=oB.linearProgress,uZ.transformerConstructor=dZ;class pZ extends cW{_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),sH(t)}}class gZ extends oW{constructor(){super(...arguments),this.transformerConstructor=pZ,this.type="rangeColumn",this.seriesType=oB.rangeColumn}}gZ.type="rangeColumn",gZ.seriesType=oB.rangeColumn,gZ.transformerConstructor=pZ;class mZ extends cW{_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 fZ extends oW{constructor(){super(...arguments),this.transformerConstructor=mZ,this.type="rangeColumn3d",this.seriesType=oB.rangeColumn3d}}fZ.type="rangeColumn3d",fZ.seriesType=oB.rangeColumn3d,fZ.transformerConstructor=mZ;class vZ extends hW{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:CB,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=oB.sunburst;return s.type=n,s[n]=t[n],s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class _Z extends oW{constructor(){super(...arguments),this.transformerConstructor=vZ,this.type="sunburst",this.seriesType=oB.sunburst}}_Z.type="sunburst",_Z.seriesType=oB.sunburst,_Z.transformerConstructor=vZ;class yZ extends hW{_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=oB.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class bZ extends oW{constructor(){super(...arguments),this.transformerConstructor=yZ,this.type="circlePacking",this.seriesType=oB.circlePacking}}bZ.type="circlePacking",bZ.seriesType=oB.circlePacking,bZ.transformerConstructor=yZ;class xZ extends hW{_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 SZ extends oW{constructor(){super(...arguments),this.transformerConstructor=xZ,this.type="treemap",this.seriesType=oB.treemap}}SZ.type="treemap",SZ.seriesType=oB.treemap,SZ.transformerConstructor=xZ;class AZ extends OW{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),sH(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}class kZ extends IW{constructor(){super(...arguments),this.transformerConstructor=AZ,this.type="waterfall",this.seriesType=oB.waterfall}}kZ.type="waterfall",kZ.seriesType=oB.waterfall,kZ.transformerConstructor=AZ;class MZ extends cW{_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"}]),sH(t)}}class TZ extends oW{constructor(){super(...arguments),this.transformerConstructor=MZ,this.type="boxPlot",this.seriesType=oB.boxPlot}}TZ.type="boxPlot",TZ.seriesType=oB.boxPlot,TZ.transformerConstructor=MZ;class wZ extends hW{_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 CZ extends oW{constructor(){super(...arguments),this.transformerConstructor=wZ,this.type="sankey",this.seriesType=oB.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)}))}}CZ.type="sankey",CZ.seriesType=oB.sankey,CZ.transformerConstructor=wZ;class EZ extends cW{_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),sH(t)}}class PZ extends oW{constructor(){super(...arguments),this.transformerConstructor=EZ,this.type="rangeArea",this.seriesType=oB.rangeArea}}PZ.type="rangeArea",PZ.seriesType=oB.rangeArea,PZ.transformerConstructor=EZ;class BZ extends cW{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}class RZ extends oW{constructor(){super(...arguments),this.transformerConstructor=BZ,this.type="heatmap",this.seriesType=oB.heatmap}}RZ.type="heatmap",RZ.seriesType=oB.heatmap,RZ.transformerConstructor=BZ;class LZ extends hW{_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=oB.correlation;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class OZ extends oW{constructor(){super(...arguments),this.transformerConstructor=LZ,this.type="correlation",this.seriesType=oB.correlation}}OZ.type="correlation",OZ.seriesType=oB.correlation,OZ.transformerConstructor=LZ;function IZ(t){var e,i;const s=Object.assign({},t);return B(t.style)||(s.textStyle=lz(t.style)),B(t.textStyle)||Tj(s.textStyle,lz(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&lz(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&lz(s.background.style),s}const DZ=(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},FZ=(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:bD;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 jZ extends FG{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:()=>{sB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),sB(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=UF(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 DH(this._option,e),this._initSelectedData(),sB(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)||(sB(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(Tj({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(Tj({},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(Tj({},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}}jZ.specKey="legends";class zZ extends jZ{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),sB(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:Xz.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){Dz(this._option.dataSet,"discreteLegendFilter",FZ),Dz(this._option.dataSet,"discreteLegendDataMake",DZ);const t=new _a(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return sB(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(!nb(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=qj(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=IZ(s)),B(n.focusIconStyle)||lz(n.focusIconStyle),n.shape&&(n.shape=az(n.shape)),n.label&&(n.label=az(n.label)),n.value&&(n.value=az(n.value)),n.background&&(n.background=az(n.background)),YF(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),YF(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),YF(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)||lz(r.railStyle),B(r.sliderStyle)||lz(r.sliderStyle)):(B(r.textStyle)||lz(r.textStyle),r.handler&&az(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(Tj(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 uP}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(rP.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(rP.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(rP.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}=TV(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=TV(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}zZ.specKey="legends",zZ.type=r.discreteLegend;const HZ=(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[]},VZ=(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)?rz(t,+e,+i):t.filter((t=>t[o]>=e&&t[o]<=i))}return t};function NZ(t){return"color"===t||"size"===t}const GZ={color:vP,size:yP},WZ=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],UZ=[2,10];class YZ extends jZ{static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!y(e))return NZ(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)=>{NZ(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),sB(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData},level:Xz.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(){Dz(this._option.dataSet,"continuousLegendFilter",VZ),Dz(this._option.dataSet,"continuousLegendDataMake",HZ);const t=new _a(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>nB(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=qj(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!nb(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=qj(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?WZ:UZ);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=Tj({},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=IZ(s)),w.showHandler=!1!==n.visible,B(n.style)||(w.handlerStyle=lz(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),B(r.style)||(w.railStyle=lz(r.style)),B(a.style)||(w.trackStyle=lz(a.style)),w.startText=az(o),w.endText=az(l),w.handlerText=az(h),B(c)||(w.sizeBackground=lz(c)),d.visible&&!B(d.style)&&(Tj(w,d.style),p(d.padding)&&(w.padding=d.padding)),w}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return GZ[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))}}}YZ.specKey="legends",YZ.type=r.continuousLegend;class KZ{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=Tz(n,a,!0))&&void 0!==e?e:[],...null!==(i=gz(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(!jw(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=sN(s).includes(t):p(e.visible)||p(e.activeType)?d.visible=sN(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)&&(uN(s).every((t=>{var e;return!sN(null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec).includes("dimension")}))?d.visible=!1:p(e.visible)||p(e.activeType)?d.visible=sN(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=cN(t,i,s),m=dN(t,i,s),f=Tj({},I(e[t]),m),v=g.title,_=gN(void 0,f,u.shape,void 0,v);p(f.title)?f.title=lN(f.title,Object.assign(Object.assign({},v),_)):f.title=lN(v,_,!0);const y=Y(g.content);if(p(f.content)){const t=pN(y);f.content=hN(f.content,(e=>gN(e,f,u.shape,t)))}else f.content=hN(y,(t=>gN(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=xN(a,t,e),l=!!p(o)&&!1!==fN(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 XZ extends KZ{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 $Z extends KZ{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 qZ extends KZ{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 ZZ=t=>p(t)&&!y(t),JZ=t=>p(t)&&y(t);class QZ extends DG{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:s}=super._initTheme(t,e);return i.style=Tj({},this._theme,i.style),{spec:i,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h,c,d;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=sN(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:tb(this._option.mode)||!Jy(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=null===(d=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===d?void 0:d.getElementById(t.parentElement)):Jy(this._option.mode)&&(t.parentElement=null==Zy?void 0:Zy.body)}}class tJ extends FG{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=QZ,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._getMouseOutHandler=t=>e=>{var i,s,n;if(this._alwaysShow)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=Jy(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(!t&&this._clickLock)return;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&&ZZ(this._cacheInfo)?a.mark=this._showTooltipByMouseEvent("mark",i,e,t,!0):r&&JZ(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),t&&this._clickLock&&(this._clickLock=!1))},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(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));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&sV.globalConfig.uniqueTooltip&&l&&sV.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._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?vN.canvas:vN.dom,n=hz.getComponentPluginInType(t);n||Xy("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 $Z(this),dimension:new XZ(this),group:new qZ(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)),(Qy(i)||tb(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)))}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=eN(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(JZ(t)){if(ZZ(this._cacheInfo))return!1;const e=this._cacheInfo;if(!(e.length===t.length&&t.every(((t,i)=>cz(t,e[i])))))return!1}else{if(JZ(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}}tJ.type=r.tooltip,tJ.transformerConstructor=QZ,tJ.specKey="tooltip";var eJ,iJ;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(eJ||(eJ={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(iJ||(iJ={}));const sJ={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class nJ extends FG{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=>{this._handleIn(t),this._clickLock=this._hasActive&&this._spec.lockAfterClick,this._clickLock&&S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._clickLock=!1,this._handleOutEvent()}),this.triggerOff))},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"}:Qy(e)||tb(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=this.trigger||"hover",e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;if(y(t)){const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return[{click:"click"===t,in:i[t],out:e(t)}]}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)=>{sJ[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||t.yField)&&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){mz(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=>{jw(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[0],s=e.series.dataToPosition(e.datum[0]);(p(t.dimType)?"y"===t.dimType:fz(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=s.y:r=s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=e.x,a=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=rB(this._regions,"cartesian");if(!e)return;const{x:i,y:s,offsetWidth:n,offsetHeight:r,bandWidth:a,bandHeight:o}=jV(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=VV(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=NV(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 uT(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(n=new pT(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 QM(e)),null==s||s.add(t)),DV(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}rJ.specKey="crosshair",rJ.type=r.cartesianCrosshair;class aJ extends nJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return e.categoryField||e.valueField?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.polarCrosshair}]:void 0;const i=[];return e.forEach(((t,e)=>{(t.categoryField||t.valueField)&&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=>{jw(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=rB(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:"",Tj(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=CV(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=CV(s.getSpec())),c.angle=a.angle,c.axis=s,Tj(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}=TV(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}=TV(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 uT(Object.assign(Object.assign({},l),{lineStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===o&&(t=new mT(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 fT(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex+1})):new gT(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 QM(e),null==s||s.add(t),i(t)),DV(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair]}}aJ.specKey="crosshair",aJ.type=r.polarCrosshair;const oJ=(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)},lJ=(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 hJ extends FG{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 sB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),sB(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=_z(t),this._isHorizontal="horizontal"===yz(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=>!Dw(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(Dw(this._stateScale.type));this._stateScale.domain(e,!0),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={};sB(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=Dw(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 sB(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;Fz(s,"dataview",pa),Dz(s,"dataFilterComputeDomain",lJ);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 DH(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(Dw(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&&Dw(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,Dw(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=Dw(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 rC,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||(Dz(this._option.dataSet,"dataFilterWithNewDomain",oJ),sB(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:()=>Dw(this._stateScale.type)},level:Xz.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(Dw(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&&jw(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,jw(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(hJ,yU);class cJ extends DG{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=Tj({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 dJ extends hJ{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=cJ,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 TC;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(!Dw(t.type)||e[0]!==e[1])&&(!jw(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 rE(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:lz(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:lz(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:lz(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:lz(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:lz(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:lz(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:lz(g.style)},selectedBackgroundStyle:lz(this._spec.selectedBackground.style),dragMaskStyle:lz(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:Tj(lz(null===(l=m.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},lz(null===(h=m.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:Tj(lz(null===(c=f.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},lz(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}=TV(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()}}dJ.type=r.dataZoom,dJ.transformerConstructor=cJ,dJ.specKey="dataZoom";class uJ extends hJ{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 EM(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=$P(this._start,e)&&$P(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=lz(t.style)),B(null==e?void 0:e.style)||(s.sliderStyle=lz(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}uJ.type=r.scrollBar,uJ.specKey="scrollBar";const pJ=(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 gJ extends FG{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!==gJ.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(){Dz(this._option.dataSet,"indicatorFilter",pJ);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 DH(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=Tj({},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({},lz(e.style)),{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?ZF(this._spec.offsetX,this._computeLayoutRadius()):0,dy:this._spec.offsetY?ZF(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({},lz(this._spec.title.style)),{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 SP(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}}gJ.type=r.indicator,gJ.specKey="indicator";const mJ=["sum","average","min","max","variance","standardDeviation","median"];function fJ(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=X(s);return er}function vJ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&fJ(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=YF(t.x)?xJ(t.x,n)+r.x:l.getXAxisHelper().dataToPosition([t.x])+r.x,h}function _J(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&fJ(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=YF(t.y)?xJ(t.y,n)+r.y:l.getYAxisHelper().dataToPosition([t.y])+r.y,h}function yJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&fJ(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 bJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&fJ(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 xJ(t,e){return Number(t.substring(0,t.length-1))*e/100}function SJ(t){return mJ.includes(t)}function AJ(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=vJ(t,m,n,d,h,a),i=_J(t,f,n,d,c,a);u.push([{x:e,y:i}])}else if(e){const e=vJ(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=_J(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 kJ(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=yJ(t,l,n,r),i=bJ(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=yJ(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=bJ(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function MJ(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=YF(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=YF(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])&&fJ(_,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])&&fJ(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 TJ(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])&&fJ(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])&&fJ(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 wJ(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 YF(e)&&(e=xJ(e,r)),e+=s,YF(i)&&(i=xJ(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 YF(e)&&(e=xJ(e,s)),YF(i)&&(i=xJ(i,n)),{x:e,y:i}}))}function CJ(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 EJ(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},lz(r.style)):t.shape={visible:!1},!1!==s.visible?(t.panel=Object.assign({visible:!0},BJ(lz(s.style),i)),p(s.padding)&&(t.padding=ti(s.padding))):(t.panel={visible:!1},t.padding=0),n&&(t.textStyle=BJ(lz(n),i)),t}return{visible:!1}}function PJ(t,e){for(const i in t)d(t[i])&&(t[i]=t[i](e));return t}function BJ(t,e){return d(t)?t(e):t}function RJ(t,e){return d(t)?t(e):t}function LJ(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 OJ(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 IJ(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 DJ(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function FJ(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=>zJ(i,t,e))):s.x=zJ(i,t,e)}if(p(e.y)){const i=e.y;y(i)?s.y=i.map((i=>zJ(i,t,e))):s.y=zJ(i,t,e)}if(p(e.angle)){const i=e.angle;y(i)?s.angle=i.map((i=>zJ(i,t,e))):s.angle=zJ(i,t,e)}if(p(e.radius)){const i=e.radius;y(i)?s.radius=i.map((i=>zJ(i,t,e))):s.radius=zJ(i,t,e)}if(p(e.areaName)){const i=e.areaName;s.areaName=zJ(i,t,e)}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),i.push(s)})),i}const jJ={min:(t,e)=>qP(t[0].latestData,e.field),max:(t,e)=>ZP(t[0].latestData,e.field),sum:function(t,e){return JP(t[0].latestData,e.field)},average:function(t,e){return QP(t[0].latestData,e.field)},variance:function(t,e){return tB(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(tB(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 zJ(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 jJ[i](e,{field:s})}return t}class HJ extends FG{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)&&SJ(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])&&SJ(t[h])?i.x={field:h,aggrType:t[h]}:i.x=Y(h).map((e=>t[e])),_(t[c])&&SJ(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])&&SJ(t[o])?i.angle={field:o,aggrType:t[o]}:i.angle=Y(o).map((e=>t[e])),_(t[l])&&SJ(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=rB(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=KF(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=KF(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 VJ(t,e){return function(t,e,i){const{predict:s}=vb(t,(t=>t[e]),(t=>t[i])),n=qP(t,e),r=ZP(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 NJ(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 GJ extends HJ{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}=OJ(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:BJ(lz(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:EJ(y,this._markerData),state:{line:PJ(null!==(a=null===(r=this._spec.line)||void 0===r?void 0:r.state)&&void 0!==a?a:{},this._markerData),lineStartSymbol:PJ(null!==(l=null===(o=this._spec.startSymbol)||void 0===o?void 0:o.state)&&void 0!==l?l:{},this._markerData),lineEndSymbol:PJ(null!==(c=null===(h=this._spec.endSymbol)||void 0===h?void 0:h.state)&&void 0!==c?c:{},this._markerData),label:PJ(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:PJ(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:lz(b.style)}):S.startSymbol={visible:!1},x.visible?S.endSymbol=Object.assign(Object.assign({},x),{visible:!0,style:lz(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}=CJ([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}=OJ(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;Dz(this._option.dataSet,"markerAggregation",FJ),Dz(this._option.dataSet,"markerRegression",VJ),Dz(this._option.dataSet,"markerFilter",NJ);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}}GJ.specKey="markLine";class WJ extends GJ{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new UE(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:_}=OJ(e);let y=[];if(u||m||g||f||v||a&&l||a&&h){const t=AJ(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=MJ(i,r,d,e.coordinatesOffset):c&&(y=wJ(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(YF(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}=OJ(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}}}WJ.type=r.markLine,WJ.coordinateType="cartesian";class UJ extends GJ{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=OJ(this._spec);return e||i?new XE(t):new UE(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}=OJ(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=kJ(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=TJ(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}=OJ(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}}}UJ.type=r.polarMarkLine,UJ.coordinateType="polar";class YJ extends FG{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=UF(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 bP(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}}YJ.type=r.title,YJ.specKey=r.title;class KJ extends HJ{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=IJ(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:BJ(lz(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:EJ(u,this._markerData),state:{area:PJ(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData),label:PJ(null===(o=this._spec.label)||void 0===o?void 0:o.state,this._markerData),labelBackground:PJ(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}=CJ([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}=IJ(t);if(!(e||i||s||n||r||a||o))return null;const{options:l}=this._computeOptions(),h=this._getRelativeDataView();Dz(this._option.dataSet,"markerAggregation",FJ),Dz(this._option.dataSet,"markerFilter",NJ);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}}KJ.specKey="markArea";class XJ extends KJ{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new KE(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}=IJ(e),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t;let u=[],g=[];if(l){g=AJ(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=AJ(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[...t,e[1],e[0]])}else h?u=MJ(i,r,d,e.coordinatesOffset):c&&(u=wJ(e.positions,r,e.regionRelative));return{points:u}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=IJ(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}}}XJ.type=r.markArea,XJ.coordinateType="cartesian";class $J extends KJ{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=IJ(this._spec);return i||e||s?new $E(t):new KE(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}=IJ(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=kJ(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=TJ(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}=IJ(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}}}$J.type=r.polarMarkArea,$J.coordinateType="polar";const qJ=t=>lz(Object.assign({},t)),ZJ=t=>Object.assign(Object.assign({},t),{style:Object.assign({},lz(t.style))}),JJ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,m;const f=qJ(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=qJ(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:{},lz(Object.assign({},y)));var y;const b=ZJ(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=ZJ(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=ZJ(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=ZJ(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},QJ=t=>"left"===t||"right"===t,tQ=t=>"top"===t||"bottom"===t;class eQ extends FG{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({},JJ(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({},JJ(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 DP(t):this._playerComponent=new zP(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=QJ(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=QJ(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(PP.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(PP.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(PP.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(PP.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(PP.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(PP.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=QJ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=tQ(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)):QJ(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))):tQ(this._orient)?this._maxSize():t.height}_computeDx(t){return QJ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return tQ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}}eQ.specKey="player",eQ.type=r.player;class iQ extends FG{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)))}}iQ.type=r.label;class sQ extends nY{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}}sQ.type="text",sQ.constructorType="label";const nQ=()=>{hz.registerMark(sQ.constructorType,sQ),vO()};class rQ extends DG{_initTheme(t,e){return{spec:t,theme:this._theme}}}class aQ extends iQ{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=rQ,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),sB(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=Tj({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=zU[t])&&void 0!==i?i:zU.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}:HU(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}}aQ.type=r.label,aQ.specKey="label",aQ.transformerConstructor=rQ;class oQ extends iQ{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[PD]},"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 Tj({textStyle:{pickable:!0===this._spec.interactive},position:lQ(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[RD]))},a))}})).encode((e=>HU({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 lQ(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}oQ.type=r.totalLabel,oQ.specKey="totalLabel";class hQ extends HJ{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=DJ(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:RJ(E.offsetX,this._relativeSeries.getRegion()),offsetY:RJ(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:BJ(B.style,this._markerData)},state:{line:PJ(null!==(h=null===(l=this._spec.itemLine.line)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData),lineStartSymbol:PJ(null!==(d=null===(c=this._spec.itemLine.startSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData),lineEndSymbol:PJ(null!==(p=null===(u=this._spec.itemLine.endSymbol)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData),symbol:PJ(null!==(m=null===(g=this._spec.itemContent.symbol)||void 0===g?void 0:g.state)&&void 0!==m?m:{},this._markerData),image:PJ(null!==(v=null===(f=this._spec.itemContent.image)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData),text:PJ(null!==(y=null===(_=this._spec.itemContent.text)||void 0===_?void 0:_.state)&&void 0!==y?y:{},this._markerData),textBackground:PJ(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:PJ(null!==(A=null===(S=this._spec.itemContent.richText)||void 0===S?void 0:S.state)&&void 0!==A?A:{},this._markerData),customMark:PJ(null!==(M=null===(k=this._spec.itemContent.customMark)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData),targetItem:PJ(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=lz(BJ(L.style,this._markerData))),(null==O?void 0:O.style)&&(F.itemContent.imageStyle=BJ(O.style,this._markerData)),R&&(F.itemContent.textStyle=EJ(R,this._markerData)),(null==I?void 0:I.style)&&(F.itemContent.richTextStyle=BJ(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:lz(z.style)}):{visible:!1};return new ZE(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}=CJ([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:LJ(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:LJ(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}=DJ(t);if(!(p(t.coordinate)||e||i||s))return;Dz(this._option.dataSet,"markerAggregation",FJ),Dz(this._option.dataSet,"markerFilter",NJ);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}}hQ.specKey="markPoint";class cQ extends hQ{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=AJ(i,s,s,s,o)[0][0]:r?l=MJ(i,s,o,e.coordinatesOffset)[0]:a&&(l=wJ([e.position],s,e.regionRelative)[0]),{point:l}}_computeOptions(){const t=this._spec,{doXYProcess:e}=DJ(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}}}cQ.type=r.markPoint,cQ.coordinateType="cartesian";class dQ extends hQ{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=kJ(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}])]}}}dQ.type=r.polarMarkPoint,dQ.coordinateType="polar";class uQ extends hQ{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}])]}}}uQ.type=r.geoMarkPoint,uQ.coordinateType="geo";const pQ="inBrush",gQ="outOfBrush";class mQ extends FG{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),pQ,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),gQ,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 GP(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:lz(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(FP.drawStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(FP.moveStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(FP.drawing,(s=>{this._needInitOutState&&"single"===o&&this._initMarkBrushState(i,gQ),this._needInitOutState=!1,this._needDisablePickable=!0,this._handleBrushChange(t.ChartEvent.brushChange,e,s),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(FP.moving,(i=>{this._handleBrushChange(t.ChartEvent.brushChange,e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(FP.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(FP.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(FP.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({},lz(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(pQ),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(pQ),i.addState(gQ),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(pQ),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(pQ),i.addState(gQ),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(pQ),i.removeState(gQ),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}}}mQ.type=r.brush,mQ.specKey="brush";class fQ extends FG{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,`${hB}_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=dG({},uG(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}}}fQ.type=r.customMark,fQ.specKey="customMark";function vQ(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 _Q(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function yQ(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:_Q(t.rect),anchorCandidates:MQ(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=>vQ(t,r)));if(n.anchorCandidates)if(a&&(null===(e=n.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;tvQ(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 bQ(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=AQ(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(!AQ(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],xQ(SQ(t.point,l)))):t.point;n&&(s.x=n.x,s.y=n.y);const r=xQ(SQ(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=kQ(t.rect,a,0),t}));return yQ(h)}function xQ(t){return t>180?t-360:t}function SQ(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function AQ(t,e){for(let i=0;i{const{x:r,y:a}=kQ(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,s);n.push({x:r,y:a})})),n}class TQ extends FG{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:Xz.copyDataView},!1),this._data=new DH(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 ZE({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=$F(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=Au({});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=Mg(lz(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=yg(lz(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=gp(lz(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=gp(lz(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=kQ(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:lz(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]}))):yQ(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}}TQ.type=r.mapLabel,TQ.specKey="mapLabel";class wQ{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=>CQ(t))),a=n.filter((t=>!CQ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>CQ(t))),h=o.filter((t=>!CQ(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 CQ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}wQ.type="grid";sV.useRegisters([()=>{iI(),sI(),CG(),BG(),ZH(),XH(),QG(),qG(),hz.registerSeries(sW.type,sW),hz.registerChart(uW.type,uW)},()=>{iI(),sI(),CG(),gW(),BG(),fW(),QG(),qG(),hz.registerSeries(_W.type,_W),hz.registerChart(bW.type,bW)},()=>{LW(),hz.registerChart(IW.type,IW)},()=>{XW(),hz.registerChart(qW.type,qW)},()=>{LY(),hz.registerChart(jq.type,jq)},()=>{JY(),hz.registerChart(Nq.type,Nq)},()=>{aK(),hz.registerChart(Wq.type,Wq)},()=>{LW(),hz.registerChart(qq.type,qq)},()=>{MU(),hz.registerChart(Rq.type,Rq)},()=>{sq(),hz.registerSeries(rq.type,rq),EY(),vK(),XY(),hz.registerChart(eZ.type,eZ)},()=>{aX(),hz.registerChart(rZ.type,rZ)},()=>{TX(),hz.registerChart(hZ.type,hZ)},()=>{qU(),hz.registerChart(kZ.type,kZ)},()=>{iY(),BG(),XH(),QG(),qG(),hz.registerSeries(sY.type,sY),hz.registerChart(TZ.type,TZ)},()=>{hz.registerSeries(yK.type,yK),EY(),vK(),$H(),qY(),XY(),hz.registerChart(Qq.type,Qq)},()=>{TK(),hz.registerChart(uZ.type,uZ)},()=>{gY(),hz.registerChart(gZ.type,gZ)},()=>{gW(),QG(),qG(),hz.registerSeries(vY.type,vY),hz.registerChart(PZ.type,PZ)},()=>{y$(),hz.registerChart(_Z.type,_Z)},()=>{k$(),hz.registerChart(bZ.type,bZ)},()=>{J$(),hz.registerChart(SZ.type,SZ)},()=>{Y$(),hz.registerChart(CZ.type,CZ)},()=>{uq(),hz.registerChart(RZ.type,RZ)},()=>{Sq(),hz.registerChart(OZ.type,OZ)},()=>{hz.registerChart(Yq.type,Yq)},qG,QG,()=>{NG(),hz.registerComponent(tW.type,tW)},()=>{NG(),hz.registerComponent(eW.type,eW)},()=>{NG(),hz.registerComponent(iW.type,iW)},qY,XY,()=>{hz.registerComponent(zZ.type,zZ)},()=>{hz.registerComponent(YZ.type,YZ)},()=>{hz.registerComponent(tJ.type,tJ)},()=>{hz.registerComponent(rJ.type,rJ)},()=>{hz.registerComponent(aJ.type,aJ)},()=>{hz.registerComponent(dJ.type,dJ)},()=>{hz.registerComponent(uJ.type,uJ)},()=>{hz.registerComponent(gJ.type,gJ)},SU,()=>{hz.registerComponent(WJ.type,WJ),WE()},()=>{hz.registerComponent(XJ.type,XJ),YE()},()=>{hz.registerComponent(cQ.type,cQ),qE()},()=>{hz.registerComponent(UJ.type,UJ),XE._animate=TE,WE()},()=>{hz.registerComponent($J.type,$J),$E._animate=CE,YE()},()=>{hz.registerComponent(dQ.type,dQ),qE()},()=>{hz.registerComponent(uQ.type,uQ),qE()},()=>{hz.registerComponent(YJ.type,YJ)},()=>{hz.registerComponent(eQ.type,eQ)},()=>{zO(),nQ(),zG(),hz.registerComponent(aQ.type,aQ,!0)},()=>{zO(),nQ(),zG(),hz.registerComponent(oQ.type,oQ,!0)},()=>{hz.registerComponent(mQ.type,mQ)},()=>{hz.registerComponent(fQ.type,fQ)},()=>{hz.registerComponent(TQ.type,TQ)},()=>{$l.load(cT)},()=>{hz.registerLayout(wQ.type,wQ)},qN,UR,WR]),sV.useRegisters([()=>{TA($l)}]),t.ARC_END_ANGLE=xB,t.ARC_K=SB,t.ARC_MIDDLE_ANGLE=AB,t.ARC_QUADRANT=kB,t.ARC_RADIAN=MB,t.ARC_RATIO=yB,t.ARC_START_ANGLE=bB,t.ARC_TRANSFORM_VALUE=_B,t.AxisSyncPlugin=bV,t.BASE_EVENTS=hD,t.CORRELATION_SIZE=fD,t.CORRELATION_X=gD,t.CORRELATION_Y=mD,t.CanvasTooltipHandler=$N,t.DEFAULT_CHART_HEIGHT=dB,t.DEFAULT_CHART_WIDTH=cB,t.DEFAULT_CONICAL_GRADIENT_CONFIG=HD,t.DEFAULT_DATA_INDEX=_D,t.DEFAULT_DATA_KEY=yD,t.DEFAULT_DATA_SERIES_FIELD=bD,t.DEFAULT_GRADIENT_CONFIG=VD,t.DEFAULT_LABEL_ALIGN=pB,t.DEFAULT_LABEL_LIMIT=uB,t.DEFAULT_LABEL_TEXT=gB,t.DEFAULT_LABEL_VISIBLE=mB,t.DEFAULT_LABEL_X=fB,t.DEFAULT_LABEL_Y=vB,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_GRADIENT_CONFIG=jD,t.DEFAULT_MEASURE_CANVAS_ID=vD,t.DEFAULT_RADIAL_GRADIENT_CONFIG=zD,t.DEFAULT_SERIES_STYLE_NAME=xD,t.DomTooltipHandler=XN,t.Factory=hz,t.FormatterPlugin=uV,t.GradientType=FD,t.MediaQuery=lV,t.POLAR_DEFAULT_RADIUS=EB,t.POLAR_END_ANGLE=270,t.POLAR_END_RADIAN=wB,t.POLAR_START_ANGLE=CB,t.POLAR_START_RADIAN=TB,t.PREFIX=hB,t.SEGMENT_FIELD_END=OD,t.SEGMENT_FIELD_START=LD,t.STACK_FIELD_END=MD,t.STACK_FIELD_END_OffsetSilhouette=ED,t.STACK_FIELD_END_PERCENT=wD,t.STACK_FIELD_KEY=AD,t.STACK_FIELD_START=kD,t.STACK_FIELD_START_OffsetSilhouette=CD,t.STACK_FIELD_START_PERCENT=TD,t.STACK_FIELD_TOTAL=PD,t.STACK_FIELD_TOTAL_PERCENT=BD,t.STACK_FIELD_TOTAL_TOP=RD,t.ThemeManager=Wj,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=sV,t.WaterfallDefaultSeriesField=pD,t.builtinThemes=Lj,t.computeActualDataScheme=LF,t.darkTheme=yj,t.dataScheme=JF,t.default=sV,t.defaultThemeName=Oj,t.getActualColor=IF,t.getColorSchemeBySeries=zF,t.getDataScheme=RF,t.getMergedTheme=Nj,t.getTheme=zj,t.hasThemeMerged=Fj,t.isColorKey=DF,t.isProgressiveDataColorScheme=FF,t.isTokenKey=fj,t.lightTheme=_j,t.queryColorFromColorScheme=OF,t.queryToken=mj,t.registerCanvasTooltipHandler=qN,t.registerChartPlugin=oV,t.registerDomTooltipHandler=()=>{KN(XN)},t.registerFormatPlugin=()=>{oV(uV)},t.registerMediaQuery=()=>{oV(lV)},t.registerTheme=jj,t.removeTheme=Hj,t.themeExist=Vj,t.themes=Ij,t.token=vj,t.transformColorSchemeToStandardStruct=jF,t.version="1.11.4",t.vglobal=E_,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 V(t){return Object.prototype.toString.call(t)}function N(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(V(t)!==V(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=N(t),n=N(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 Vt(t){return t>=1?Et:t<=-1?-Et:Math.asin(t)}function Nt(t,e,i,s,n){let r,a;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,Ve,Ne,Ge;function We(t){return He=1/0,Ve=1/0,Ne=-1/0,Ge=-1/0,t.forEach((t=>{He>t.x&&(He=t.x),Net.y&&(Ve=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,Vi=Math.tan;function Ni(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=Ni(-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=Vs},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 Vs(){Hs(Bs,Rs)}var Ns=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(Ns)),Ns.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,Vn=Oi(30*Pi);function Nn(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=Nn(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 Vi((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,Vr(t)},Yr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Rr.DSV,Nr(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",Va="Instance",Na="Invalid";class Ga{constructor(t,e){this.id=ya.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=Na,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 No 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 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 No(t,s):new Vo(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 Vo("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){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"linearClosed":return ol(t,i)}}class hl 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 cl=["l",0,0,0,0,0,0,0];function dl(t,e,i){const s=cl[0]=t[0];if("a"===s||"A"===s)cl[1]=e*t[1],cl[2]=i*t[2],cl[3]=t[3],cl[4]=t[4],cl[5]=t[5],cl[6]=e*t[6],cl[7]=i*t[7];else if("h"===s||"H"===s)cl[1]=e*t[1];else if("v"===s||"V"===s)cl[1]=i*t[1];else for(let s=1,n=t.length;s{rt.getInstance().warn("空函数")}}),wl=Object.assign(Object.assign({},yl),{points:[],cornerRadius:0,closePath:!0}),Cl=Object.assign(Object.assign({},yl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},yl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const El=Object.assign(Object.assign({},yl),{symbolType:"circle",size:10,keepDirIn3d:!0}),Pl=Object.assign(Object.assign(Object.assign({},yl),fl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Bl=Object.assign(Object.assign(Object.assign({},yl),fl),{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}),Rl=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},yl),{fill:!0,cornerRadius:0}),Ll=Object.assign(Object.assign({},Rl),{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 Ol=new class{},Il={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"}},Dl=!0,Fl=!1,jl=/\w|\(|\)|-/,zl=/[.?!,;:/,。?!、;:]/,Hl=/\S/;function Vl(t,e,i,s,n){if(!e||e<=0)return 0;const r=Ol.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=Nl(t,a)),a}function Nl(t,e){let i=e;for(;jl.test(t[i-1])&&jl.test(t[i])||zl.test(t[i]);)if(i--,i<=0)return e;return i}function Gl(t,e){const i=Ol.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 Wl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Ul=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=Pl.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=Nl(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=Nl(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}};Ul=Wl([La()],Ul);var Yl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Kl=Symbol.for("TextMeasureContribution");let Xl=class extends Ul{};Xl=Yl([La()],Xl);const $l=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 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===Ia&&(t.cache=e,t.activated=!0)}},ql=Symbol.for("CanvasFactory"),Zl=Symbol.for("Context2dFactory");function Jl(t){return $l.getNamed(ql,Ol.global.env)(t)}const Ql=1e-4,th=Math.sqrt(3),eh=1/3;function ih(t){return t>-fh&&tfh||t<-fh}const nh=[0,0],rh=[0,0],ah=[0,0];function oh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function lh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function hh(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 ch(t){return(t%=Bt)<0&&(t+=Bt),t}function dh(t,e,i,s,n,r){if(r>e&&r>s||rn?o:0}function uh(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 mh(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(ih(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 _h=[-1,-1,-1],yh=[-1,-1];function bh(){const t=yh[0];yh[0]=yh[1],yh[1]=t}function xh(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(ih(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,eh):Math.pow(i,eh),s=s<0?-Math.pow(-s,eh):Math.pow(s,eh);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+th*Math.sin(e)))/(3*a),h=(-o+i*(s-th*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,_h);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&bh(),p=hh(e,s,r,o,yh[0]),u>1&&(g=hh(e,s,r,o,yh[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(ih(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,_h);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=lh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);_h[0]=-l,_h[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>=_h[0]+t&&a<=_h[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=_h[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 kh(t){return Math.round(t/Ct*1e8)/1e8%2*Ct}function Mh(t,e){let i=kh(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-kh(i-n)):e&&i1&&(i||(h+=dh(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;Th[0]=S,Th[1]=A,Mh(Th,Boolean(a[6])),S=Th[0],A=Th[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(mh(c,d,f,v,e,s,n))return!0}else h+=dh(c,d,f,v,s,n)||0;c=f,d=v;break;case uo.C:if(i){if(ph(c,d,f,v,_,y,b,x,e,s,n))return!0}else h+=xh(c,d,f,v,_,y,b,x,s,n)||0;c=b,d=x;break;case uo.Q:if(i){if(uh(c,d,f,v,_,y,e,s,n))return!0}else h+=Sh(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+=dh(c,d,o,l,s,n),i){if(gh(f,v,_,k,k+M,T,e,w,n))return!0}else h+=Ah(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(mh(u,p,o,p,e,s,n)||mh(o,p,o,l,e,s,n)||mh(o,l,u,l,e,s,n)||mh(u,l,u,p,e,s,n))return!0}else h+=dh(o,p,o,l,s,n),h+=dh(u,l,u,p,s,n);break;case uo.Z:if(i){if(mh(c,d,u,p,e,s,n))return!0}else h+=dh(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},Ph=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Bh=Symbol.for("VWindow"),Rh=Symbol.for("WindowHandlerContribution");let Lh=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&&($l.getNamed(Rh,t.env).configure(this,t),this.actived=!0)},this._uid=ya.GenAutoIncrementId(),this.global=Ol.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)}};Lh=Eh([La(),Ph("design:paramtypes",[])],Lh);var Oh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Dh=function(t,e){return function(i,s){e(i,s,t)}};let Fh=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=Ol.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=Ch.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:fl.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:fl.fontFamily,fontSize:fl.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=$l.get(Bh),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 jh;Fh=Oh([La(),Dh(0,Ba($a)),Dh(0,Oa(Kl)),Ih("design:paramtypes",[Object])],Fh),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(jh||(jh={}));const zh=new ae;let Hh=class{constructor(){this.matrix=new ae}init(t){return this.mode=jh.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=jh.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(zh.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(zh.a,zh.b,zh.c,zh.d,zh.e,zh.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(zh.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(zh.a,zh.b,zh.c,zh.d,zh.e,zh.f),this}scale(t,e,i){return this.mode===jh.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===jh.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return zh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(zh.a,zh.b,zh.c,zh.d,zh.e,zh.f),this}translate(t,e){return this.mode===jh.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===jh.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Hh=Oh([La(),Ih("design:paramtypes",[])],Hh);const Vh={arc:bl,area:xl,circle:Sl,line:Ml,path:Tl,symbol:El,text:Pl,rect:Cl,polygon:wl,richtext:Bl,richtextIcon:Ll,image:Rl,group:Al,glyph:kl},Nh=Object.keys(Vh);function Gh(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Wh={arc:Object.assign({},Vh.arc),area:Object.assign({},Vh.area),circle:Object.assign({},Vh.circle),line:Object.assign({},Vh.line),path:Object.assign({},Vh.path),symbol:Object.assign({},Vh.symbol),text:Object.assign({},Vh.text),rect:Object.assign({},Vh.rect),polygon:Object.assign({},Vh.polygon),richtext:Object.assign({},Vh.richtext),richtextIcon:Object.assign({},Vh.richtextIcon),image:Object.assign({},Vh.image),group:Object.assign({},Vh.group),glyph:Object.assign({},Vh.glyph)};class Uh{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Nh.forEach((t=>{this._defaultTheme[t]=Object.create(Wh[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;Nh.forEach((s=>{const n=Object.create(Wh[s]);t&&t[s]&&Gh(n,t[s]),i[s]&&Gh(n,i[s]),e[s]&&Gh(n,e[s]),this.combinedTheme[s]=n})),e.common&&Nh.forEach((t=>{Gh(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 Yh=new Uh;function Kh(t,e){return t.glyphHost?Kh(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)):Yh.getTheme()}return null}(t)||t.attachedThemeGraphic&&Kh(t.attachedThemeGraphic)||Yh.getTheme()}var Xh=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 $h 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 Xh(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 Jh))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(ic(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 Jh))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=ic(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 Jh))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=ic(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 Jh))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=ic(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 Jh))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=ec.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(ic(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(ic(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,ic(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 Jh))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"):ic(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 Qh))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=ec.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 sc(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 Jh,this.rootWheelEvent=new Qh,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 oc{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return oc.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 lc{static Avaliable(){return!0}avaliable(){return lc.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 hc{static Avaliable(){return!!Ol.global.getRequestAnimationFrame()}avaliable(){return hc.Avaliable()}tick(t,e){Ol.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var cc;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(cc||(cc={}));class dc{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-dc.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*dc.bounceIn(2*t):.5*dc.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}}}dc.quadIn=dc.getPowIn(2),dc.quadOut=dc.getPowOut(2),dc.quadInOut=dc.getPowInOut(2),dc.cubicIn=dc.getPowIn(3),dc.cubicOut=dc.getPowOut(3),dc.cubicInOut=dc.getPowInOut(3),dc.quartIn=dc.getPowIn(4),dc.quartOut=dc.getPowOut(4),dc.quartInOut=dc.getPowInOut(4),dc.quintIn=dc.getPowIn(5),dc.quintOut=dc.getPowOut(5),dc.quintInOut=dc.getPowInOut(5),dc.backIn=dc.getBackIn(1.7),dc.backOut=dc.getBackOut(1.7),dc.backInOut=dc.getBackInOut(1.7),dc.elasticIn=dc.getElasticIn(1,.3),dc.elasticOut=dc.getElasticOut(1,.3),dc.elasticInOut=dc.getElasticInOut(1,.3*1.5);class uc{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 pc=new uc;class gc{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(){}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 mc extends gc{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let fc=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]:pc;this.id=t,this.timeline=e,this.status=So.INITIAL,this.tailAnimate=new vc(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.duration===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 mc((()=>{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 vc(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()}};fc.mode=Ao.NORMAL,fc.interpolateMap=new Map;class vc{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 _c(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?dc[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?dc[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 _c(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 _c{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 yc=200,bc="cubicOut",xc=1e3,Sc="quadInOut";var Ac;!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"}(Ac||(Ac={}));const kc=[!1,!1,!1,!1],Mc=[0,0,0,0],Tc=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Mc[0]=t[0],Mc[2]=t[0],Mc[1]=t[1],Mc[3]=t[1],Mc):t:t:0,wc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Cc=[1,2,3,0,1,2,3,0];function Ec(t,e,i,s){for(;t>=Bt;)t-=Bt;for(;t<0;)t+=Bt;for(;t>e;)e+=Bt;wc[0].x=i,wc[1].y=i,wc[2].x=-i,wc[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]:Oc.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)}}Oc.TimeOut=1e3/60;const Ic=new Oc,Dc=(t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class Fc extends gc{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 jc;!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"}(jc||(jc={}));class zc extends gc{constructor(t,e,i,s,n){super(t,e,i,s,n),this.newPointAnimateType="appear"===(null==n?void 0:n.newPointAnimateType)?"appear":"grow"}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}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?[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=Pc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),i.points=this.points}}class Hc extends gc{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 Vc extends Hc{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=Ol.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 Nc extends Hc{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=Ol.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 Gc extends gc{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 Wc extends gc{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?dc[n]:n;e=r(e),s.onUpdate(t,e,i)})),this.updating=!1)}}function Uc(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 Yc(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 Jc(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 Qc(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 id(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}))),rd=(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]},ad=(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 rd(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return rd(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);ad(n[0],s,i),ad(n[1],e-s,i)}};var od;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(od||(od={}));class ld{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:od.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===od.Color1){const e=ld.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];ld.store1[t]=e,ld.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=ld.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&&(ld.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],ld.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===od.Color1){if(ld.store1[t])return;ld.store1[t]=i,ld.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(ld.store255[t])return;ld.store255[t]=i,ld.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function hd(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 cd(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)=>dd(y(t)?t[r]:t,y(e)?e[r]:e,i,s))):dd(t,e,i,s,n)}function dd(t,e,i,s,n){if(!t||!e)return t&&hd(t)||e&&hd(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=ld.Get(t,od.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=ld.Get(e,od.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:hd(a)})))});return o?cd(r,l,i,s,n):cd(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:gd(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:gd(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:gd(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),hd(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)}ld.store255={},ld.store1={};const ud=[0,0,0,0],pd=[0,0,0,0];function gd(t,e,i){return ld.Get(t,od.Color255,ud),ld.Get(e,od.Color255,pd),`rgba(${Math.round(ud[0]+(pd[0]-ud[0])*i)},${Math.round(ud[1]+(pd[1]-ud[1])*i)},${Math.round(ud[2]+(pd[2]-ud[2])*i)},${ud[3]+(pd[3]-ud[3])*i})`}const md=(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=cd(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},fd=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?Jc(t):[],n=Jc(e);i&&s&&(i.fromTransform&&Qc(s,i.fromTransform.clone().getInverse()),Qc(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})))},_d=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],yd=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!_d.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]?ld.Get(t[n],od.Color255):t[n],to:"string"==typeof r?ld.Get(r,od.Color255):r,key:n}):i.push({from:t[n],to:r,key:n}),s=!0)})),s?i:null};class bd extends gc{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;fd(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&md(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const xd=(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=vd(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=yd(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 bd({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:xc,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Sc)),c};class Sd extends gc{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;fd(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&&md(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Ad=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Rc.includes(t))(i)||(e[i]=t[i])})),e},kd=(t,e,i)=>{const s=Ad(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=Ol.graphicService.creator.rect({x:0,y:0,width:a,height:o});n.appendChild(i),e.push(i)}))}},Md=(t,e,i)=>{const s=[],n=i?null:Ad(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Ad(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=ed(t.attribute),n=id(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(Ol.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=id(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(Ol.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=id(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(Ol.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 sd(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 sd(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(Ol.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:nd(i)}];const s=[];return ad(i,e,s),s})(t,e).forEach((t=>{s.push(Ol.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 ad(r,e,h),h})(t,e).forEach((t=>{s.push(Ol.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=Jc(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(Ol.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(Ol.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&kd(t,s,e),s};class wd{static GetImage(t,e){var i;const s=wd.cache.get(t);s?"fail"===s.loadState?Ol.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):wd.loadImage(t,e)}static GetSvg(t,e){var i;let s=wd.cache.get(t);s?"fail"===s.loadState?Ol.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"},wd.cache.set(t,s),s.dataPromise=Ol.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=wd.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"},wd.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Ol.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Ol.global.loadBlob(t):"json"===e&&(i.dataPromise=Ol.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!wd.isLoading&&wd.toLoadAueue.length){wd.isLoading=!0;const t=wd.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(wd.cache.set(i,n),n.dataPromise=Ol.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((()=>{wd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),wd.loading()})).catch((t=>{console.error(t),wd.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),wd.loading()}))}}),0)}static loadImage(t,e){const i=Cd(t,wd.toLoadAueue);if(-1!==i)return wd.toLoadAueue[i].marks.push(e),void wd.loading();wd.toLoadAueue.push({url:t,marks:[e]}),wd.loading()}static improveImageLoading(t){const e=Cd(t,wd.toLoadAueue);if(-1!==e){const t=wd.toLoadAueue.splice(e,1);wd.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Cd(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;Id.x=n+(null!==(i=t.scrollX)&&void 0!==i?i:0),Id.y=r+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else Id.x=n,Id.y=r;return Id}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Ol.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Ol.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]:Bd;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Bd;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(Ol.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:yc,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:bc),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 Pd.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(Pd),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=ul.x,y:e=ul.y,scaleX:i=ul.scaleX,scaleY:s=ul.scaleY,angle:n=ul.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),Ol.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(ul);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Ed.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),Ol.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=cd(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=cd(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=cd(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 Kh(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:Ol.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 hl).fromString(t):this.pathProxy=new hl,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",Ol.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new tc(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)}}}Fd.mixin(nc);class jd{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 zd(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Hd(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 Vd=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class Nd{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=Hd(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=zd(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Hd(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 jd(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 jd(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 Gd(t,e){return Wd(t)}function Wd(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 qd=0;function Zd(){return qd++}var Jd;function Qd(t){const e=[];let i=0,s="";for(let n=0;ntu.set(t,!0)));const eu=new Map;function iu(t){if(tu.has(t))return!0;if(eu.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>eu.set(t,!0)));const su=Zd(),nu=Zd(),ru=Zd(),au=Zd(),ou=Zd(),lu=Zd(),hu=Zd(),cu=Zd(),du=Zd(),uu=Zd();Zd();const pu=Zd();Zd();const gu=Zd(),mu=Zd(),fu=Zd(),vu=Symbol.for("GraphicService"),_u=Symbol.for("GraphicCreator"),yu={"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"},bu=Object.keys(yu);var xu;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(xu||(xu={}));let Su=class t extends Fd{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=lu,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 Uh),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Uh)}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;Ol.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),Ol.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=ul.x,y:e=ul.y,dx:i=ul.dx,dy:s=ul.dy,scaleX:n=ul.scaleX,scaleY:r=ul.scaleY,angle:a=ul.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=Kh(this).group;this._AABBBounds.clear();const i=Ol.graphicService.updateGroupAABBBounds(t,e,this._AABBBounds,this),{boundsPadding:s=e.boundsPadding}=t,n=Tc(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(),Ol.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Ol.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,Ol.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{Ol.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),Ol.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=Ol.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 Au(t){return new Su(t)}Su.NOWORK_ANIMATE_ATTR=Dd;class ku extends Su{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 Uh,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=>{Ol.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=>{Ol.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 Mu=Symbol.for("TransformUtil"),Tu=Symbol.for("GraphicUtil"),wu=Symbol.for("LayerService"),Cu=Symbol.for("StaticLayerHandlerContribution"),Eu=Symbol.for("DynamicLayerHandlerContribution"),Pu=Symbol.for("VirtualLayerHandlerContribution");var Bu,Ru=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Lu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ou=Bu=class{static GenerateLayerId(){return`${Bu.idprefix}_${Bu.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Ol.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?$l.get(Cu):"dynamic"===t?$l.get(Eu):$l.get(Pu),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 ku(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Bu.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)}};Ou.idprefix="visactor_layer",Ou.prefix_count=0,Ou=Bu=Ru([La(),Lu("design:paramtypes",[])],Ou);var Iu=new ba((t=>{t(eo).to(ro).inSingletonScope(),t(Bh).to(Lh),t(Tu).to(Fh).inSingletonScope(),t(Mu).to(Hh).inSingletonScope(),t(wu).to(Ou).inSingletonScope()}));function Du(t,e){return!(!t&&!e)}function Fu(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function ju(t,e,i){return i&&t*e>0}function zu(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Hu(t,e){return t*e>0}function Vu(t,e,i,s){return t*e>0&&0!==i&&0!==s}function Nu(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 Wu(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(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:m,outerEndAngle:f,innerEndAngle:v,innerStartAngle:_}=t.getParsePadAngle(o,l),y=u,b=u,x=u,S=u,A=Math.max(b,y),k=Math.max(x,S);let M=A,T=k;const w=n*Ot(m),C=n*Ft(m),E=r*Ot(v),P=r*Ft(v);let B,R,L,O;if((k>wt||A>wt)&&(B=n*Ot(f),R=n*Ft(f),L=r*Ot(_),O=r*Ft(_),hwt){const t=Dt(y,M),r=Dt(b,M),o=Gu(L,O,w,C,n,t,Number(c)),l=Gu(B,R,E,P,n,r,Number(c));M0&&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+B,s+n*Ft(f))}else!a||a[0]?(e.moveTo(i+w,s+C),e.arc(i,s,n,m,f,!c)):e.moveTo(i+n*Ot(f),s+n*Ft(f));if(!(r>wt)||g<.001)!a||a[1]?e.lineTo(i+E,s+P):e.moveTo(i+E,s+P),d=!0;else if(T>wt){const t=Dt(S,T),n=Dt(x,T),o=Gu(E,P,B,R,r,-n,Number(c)),l=Gu(w,C,L,O,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),T0&&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+L,s+O)}else!a||a[1]?e.lineTo(i+E,s+P):e.moveTo(i+E,s+P),!a||a[2]?e.arc(i,s,r,v,_,c):e.moveTo(i+r*Ot(_),s+r*Ft(_))}return a?a[3]&&e.lineTo(i+n*Ot(o),s+n*Ft(o)):e.closePath(),d}class Uu{static GetCanvas(){try{return Uu.canvas||(Uu.canvas=Ol.global.createCanvas({})),Uu.canvas}catch(t){return null}}static GetCtx(){if(!Uu.ctx){const t=Uu.GetCanvas();Uu.ctx=t.getContext("2d")}return Uu.ctx}}class Yu extends oe{static getInstance(){return Yu._instance||(Yu._instance=new Yu),Yu._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=Uu.GetCanvas(),s=Uu.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 Yu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Ku{static GetSize(t){for(let e=0;e=t)return Ku.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Ku.GenKey(t,e,i,s,n),l=Ku.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=Ku.GenKey(t,e,i,s,n);Ku.cache[l]?Ku.cache[l].push({width:a,height:o,pattern:r}):Ku.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}Ku.cache={},Ku.ImageSize=[20,40,80,160,320,640,1280,2560];const Xu=Symbol.for("ArcRenderContribution"),$u=Symbol.for("AreaRenderContribution"),qu=Symbol.for("CircleRenderContribution"),Zu=Symbol.for("GroupRenderContribution"),Ju=Symbol.for("ImageRenderContribution"),Qu=Symbol.for("PathRenderContribution"),tp=Symbol.for("PolygonRenderContribution"),ep=Symbol.for("RectRenderContribution"),ip=Symbol.for("SymbolRenderContribution"),sp=Symbol.for("TextRenderContribution"),np=Symbol.for("InteractiveSubRenderContribution"),rp=["radius","startAngle","endAngle",...Bd];class ap extends Fd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=au}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=Kh(this).circle;this._AABBBounds.clear();const i=this.attribute,s=Ol.graphicService.updateCircleAABBBounds(i,Kh(this).circle,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Tc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Kh(this).circle[t]}needUpdateTags(t){return super.needUpdateTags(t,rp)}needUpdateTag(t){return super.needUpdateTag(t,rp)}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 hl;return o.arc(0,0,n,r,a),o}clone(){return new ap(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ap.NOWORK_ANIMATE_ATTR}}function op(t){return new ap(t)}function lp(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 hp(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function cp(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)}ap.NOWORK_ANIMATE_ATTR=Dd;class dp{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=fu,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=Kh(this).text;this._AABBBounds.clear();const e=this.attribute,i=Ol.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=this.attribute,n=Tc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}updateWrapAABBBounds(t){var e,i,s,n;const r=Kh(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=Dc(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=Ol.graphicUtil.textMeasure,k=new dp(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===Jd.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=hp(x,o),M=cp(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=Kh(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=Dc(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 _=Ol.graphicUtil.textMeasure,y=new dp(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=Kh(this).text,a=Ol.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=Dc(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=hp(x,o),e=this.cache.verticalList.length*b,i=cp(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=>Qd(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===Jd.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=hp(x,o),M=this.cache.verticalList.length*b,T=cp(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 Kh(this).text[t]}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:up;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:up;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function gp(t){return new pp(t)}pp.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Dd),pp.baselineMapAlign={top:"left",bottom:"right",middle:"center"},pp.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class mp{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 fp(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 vp=new class extends mp{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 fp(t,e/2,i,s,n)}drawOffset(t,e,i,s,n,r){return fp(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 _p=new class extends mp{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 yp(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 bp=new class extends mp{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 yp(t,e/2,i,s,n)}drawFitDir(t,e,i,s,n){return yp(t,e/2,i,s,n)}drawOffset(t,e,i,s,n,r){return yp(t,e/2+n,i,s,r)}};function xp(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Sp=new class extends mp{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return xp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return xp(t,e/2+n,i,s)}};class Ap extends mp{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 kp=new Ap;var Mp=new class extends Ap{constructor(){super(...arguments),this.type="triangle"}};const Tp=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),wp=Math.sin(Pt/10)*Tp,Cp=-Math.cos(Pt/10)*Tp;function Ep(t,e,i,s){const n=wp*e,r=Cp*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 Pp=new class extends mp{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 Ep(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Ep(t,e/2+n,i,s)}};const Bp=jt(3);function Rp(t,e,i,s){const n=e,r=n/Bp,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 Lp=new class extends mp{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 Rp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Rp(t,e/2+n,i,s)}};function Op(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 Ip=new class extends mp{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}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)}};function Dp(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Fp=new class extends mp{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}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)}};const jp=-.5,zp=jt(3)/2,Hp=1/jt(12);function Vp(t,e,i,s){const n=e/2,r=e*Hp,a=n,o=e*Hp+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(jp*n-zp*r+i,zp*n+jp*r+s),t.lineTo(jp*a-zp*o+i,zp*a+jp*o+s),t.lineTo(jp*l-zp*h+i,zp*l+jp*h+s),t.lineTo(jp*n+zp*r+i,jp*r-zp*n+s),t.lineTo(jp*a+zp*o+i,jp*o-zp*a+s),t.lineTo(jp*l+zp*h+i,jp*h-zp*l+s),t.closePath(),!1}var Np=new class extends mp{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 Vp(t,e/2,i,s)}drawOffset(t,e,i,s,n){return Vp(t,e/2+n,i,s)}};var Gp=new class extends mp{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 Wp=new class extends mp{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 Up=new class extends mp{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 Yp=jt(3);function Kp(t,e,i,s){const n=e*Yp;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Xp=new class extends Ap{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Kp(t,e/2/Yp,i,s)}drawOffset(t,e,i,s,n){return Kp(t,e/2/Yp+n,i,s)}};function $p(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 qp=new class extends mp{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 $p(t,e/4,i,s)}drawOffset(t,e,i,s,n){return $p(t,e/4+n,i,s)}};function Zp(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 Jp=new class extends mp{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 Zp(t,e/4,i,s)}drawOffset(t,e,i,s,n){return Zp(t,e/4+n,i,s)}};function Qp(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 tg=new class extends mp{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 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-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var ig=new class extends mp{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 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,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var ng=new class extends mp{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return sg(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return sg(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 rg(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var ag=new class extends mp{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return rg(t,e/2,i,s)}drawOffset(t,e,i,s,n,r){return rg(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 og(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 lg=new class extends mp{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 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-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function hg(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function cg(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var dg=new class extends mp{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)?cg(t,e,i,s):hg(t,e,i,s)}drawOffset(t,e,i,s,n){return S(e)?cg(t,e+2*n,i,s):hg(t,[e[0]+2*n,e[1]+2*n],i,s)}};const ug=new Jt;class pg{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;ug.x1=s.bounds.x1*t,ug.y1=s.bounds.y1*t,ug.x2=s.bounds.x2*t,ug.y2=s.bounds.y2*t,e.union(ug)}))}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 gg={};[vp,_p,bp,Sp,Xp,Mp,Pp,Lp,Ip,Fp,Np,Gp,Wp,kp,Up,qp,Jp,tg,ig,dg,ng,ag,lg].forEach((t=>{gg[t.type]=t}));const mg={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"},fg=new Jt,vg=["symbolType","size",...Bd];let _g=class t extends Fd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=mu}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=Kh(this).symbol;let{symbolType:i=e.symbolType}=this.attribute,s=gg[i];if(s)return this._parsedPath=s,s;if(s=t.userSymbolMap[i],s)return this._parsedPath=s,s;if(i=mg[i]||i,!0===((n=i).startsWith("{const e=(new hl).fromString(t.d),i={};bu.forEach((e=>{t[e]&&(i[yu[e]]=t[e])})),r.push({path:e,attribute:i}),fg.union(e.bounds)}));const a=fg.width(),o=fg.height(),l=1/It(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new pg(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var n;const r=(new hl).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 pg(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=Kh(this).symbol;this._AABBBounds.clear();const i=this.attribute,s=Ol.graphicService.updateSymbolAABBBounds(i,Kh(this).symbol,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Tc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Kh(this).symbol[t]}needUpdateTags(t){return super.needUpdateTags(t,vg)}needUpdateTag(t){return super.needUpdateTag(t,vg)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new hl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new hl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function yg(t){return new _g(t)}_g.userSymbolMap={},_g.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Dd);const bg=["segments","points","curveType",...Bd];let xg=class t extends Fd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",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||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Bc(i,s,e))}doUpdateAABBBounds(){const t=Kh(this).line;this._AABBBounds.clear();const e=this.attribute,i=Ol.graphicService.updateLineAABBBounds(e,Kh(this).line,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Tc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Kh(this).line[t]}needUpdateTags(t){return super.needUpdateTags(t,bg)}needUpdateTag(t){return super.needUpdateTag(t,bg)}toCustomPath(){const t=this.attribute,e=new hl,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 Sg(t){return new xg(t)}xg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Dd);const Ag=["width","x1","y1","height","cornerRadius",...Bd];class kg extends Fd{constructor(t){super(t),this.type="rect",this.numberType=pu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}doUpdateAABBBounds(){const t=Kh(this).rect;this._AABBBounds.clear();const e=this.attribute,i=Ol.graphicService.updateRectAABBBounds(e,Kh(this).rect,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Tc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Kh(this).rect[t]}needUpdateTags(t){return super.needUpdateTags(t,Ag)}needUpdateTag(t){return super.needUpdateTag(t,Ag)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:s,height:n}=ed(t),r=new hl;return r.moveTo(e,i),r.rect(e,i,s,n),r}clone(){return new kg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return kg.NOWORK_ANIMATE_ATTR}}function Mg(t){return new kg(t)}kg.NOWORK_ANIMATE_ATTR=Dd;class Tg extends Fd{constructor(t){super(t),this.type="glyph",this.numberType=ou,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=Ol.graphicService.updateGlyphAABBBounds(this.attribute,Kh(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 Tg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Tg.NOWORK_ANIMATE_ATTR}}function wg(t){return new Tg(t)}Tg.NOWORK_ANIMATE_ATTR=Dd;class Cg{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=Il[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 Eg{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const s=Dc(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}=Gl(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}=Gl(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=Vl(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}=Gl(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||Fl;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||Dl;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=Vl(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Gl(this.text.slice(t),this.character);return i+this.ellipsisWidth-s}return i}}const Pg=["width","height","image",...Bd];class Bg extends Fd{constructor(t){super(t),this.type="image",this.numberType=hu,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=Kh(this).image;this._AABBBounds.clear();const e=this.attribute,i=Ol.graphicService.updateImageAABBBounds(e,Kh(this).image,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Tc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Rl[t]}needUpdateTags(t){return super.needUpdateTags(t,Pg)}needUpdateTag(t){return super.needUpdateTag(t,Pg)}clone(){return new Bg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Bg.NOWORK_ANIMATE_ATTR}}function Rg(t){return new Bg(t)}Bg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Dd);class Lg extends Bg{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=Tc(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=Tc(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=Rl.width,height:e=Rl.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 Og{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 Lg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=Il[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Eg){const e=Hl.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 Lg)break;if("vertical"===this.direction&&"vertical"!==s.direction){s.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";s.ellipsisStr=r;const{width:a}=Gl(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 Lg)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 Lg)break;const{width:n}=Gl(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 Lg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Ig{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=Il[this.direction]}store(t){if(t instanceof Lg){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 Og(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 Lg?"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=Vl(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 Eg(i,t.newLine,t.character),new Eg(s,!0,t.character)]}(t,s);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const Dg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...Bd];class Fg extends Fd{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=gu}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Bl.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:Bl.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:Bl.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:Bl.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:Bl.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:Bl.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:Bl.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:Bl.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=Kh(this).richtext;this._AABBBounds.clear();const e=this.attribute,i=Ol.graphicService.updateRichTextAABBBounds(e,Kh(this).richtext,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Tc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Bl[t]}needUpdateTags(t){return super.needUpdateTags(t,Dg)}needUpdateTag(t){return super.needUpdateTag(t,Dg)}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(){var t;const{textConfig:e=[],maxWidth:i,maxHeight:s,width:n,height:r,ellipsis:a,wordBreak:o,verticalDirection:l,textAlign:h,textBaseline:c,layoutDirection:d,singleLine:u,disableAutoWrapLine:p}=this.attribute,g=[];for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,g.push(t)}}else{const i=this.combinedStyleToCharacter(e[t]);if(S(i.text)&&(i.text=`${i.text}`),i.text&&i.text.includes("\n")){const t=i.text.split("\n");for(let e=0;e0,f="number"==typeof s&&Number.isFinite(s)&&s>0,v="number"==typeof n&&Number.isFinite(n)&&n>0&&(!m||n<=i),_="number"==typeof r&&Number.isFinite(r)&&r>0&&(!f||r<=s),y=new Cg(0,0,(v?n:m?i:0)||0,(_?r:f?s:0)||0,a,o,l,h,c,d||"horizontal",!v&&m,!_&&f,u||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),b=new Ig(y);if(p){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 Fg.NOWORK_ANIMATE_ATTR}}function jg(t){return new Fg(t)}Fg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Dd);const zg=["path","customPath",...Bd];class Hg extends Fd{constructor(t){super(t),this.type="path",this.numberType=du}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=Kh(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof hl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof hl?this.cache:t.path)}doUpdateAABBBounds(){const t=Kh(this).path;this.doUpdatePathShape(),this._AABBBounds.clear();const e=this.attribute,i=Ol.graphicService.updatePathAABBBounds(e,Kh(this).path,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Tc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new hl).fromString(t.path):t.customPath&&(this.cache=new hl,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Kh(this).path[t]}needUpdateTags(t){return super.needUpdateTags(t,zg)}needUpdateTag(t){return super.needUpdateTag(t,zg)}toCustomPath(){return(new hl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Hg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Hg.NOWORK_ANIMATE_ATTR}}function Vg(t){return new Hg(t)}Hg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Dd);const Ng=["segments","points","curveType",...Bd];class Gg extends Fd{constructor(t){super(t),this.type="area",this.numberType=ru}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=Kh(this).area;this._AABBBounds.clear();const e=this.attribute,i=Ol.graphicService.updateAreaAABBBounds(e,Kh(this).area,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Tc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Bc(i,s,e))}getDefaultAttribute(t){return Kh(this).area[t]}needUpdateTags(t){return super.needUpdateTags(t,Ng)}needUpdateTag(t){return super.needUpdateTag(t,Ng)}toCustomPath(){const t=new hl,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 Gg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Gg.NOWORK_ANIMATE_ATTR}}function Wg(t){return new Gg(t)}Gg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Dd);const Ug=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Bd];class Yg extends Fd{constructor(t){super(t),this.type="arc",this.numberType=su}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=Kh(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);return Math.min(S(e,!0)?e:a*parseFloat(e)/100,a/2)}getParsedAngle(){const t=Kh(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=Kh(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=Vt(Number(l)/o*Ft(g)),n=Vt(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=Kh(this).arc;this._AABBBounds.clear();const i=this.attribute,s=Ol.graphicService.updateArcAABBBounds(i,Kh(this).arc,this._AABBBounds,t,this),{boundsPadding:n=e.boundsPadding}=i,r=Tc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return super.needUpdateTags(t,Ug)}needUpdateTag(t){return super.needUpdateTag(t,Ug)}getDefaultAttribute(t){return Kh(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 Yg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Yg.NOWORK_ANIMATE_ATTR}}function Kg(t){return new Yg(t)}Yg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Dd);const Xg=["points","cornerRadius",...Bd];class $g extends Fd{constructor(t){super(t),this.type="polygon",this.numberType=uu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=Kh(this).polygon;this._AABBBounds.clear();const e=this.attribute,i=Ol.graphicService.updatePolygonAABBBounds(e,Kh(this).polygon,this._AABBBounds,this),{boundsPadding:s=t.boundsPadding}=e,n=Tc(s);return n&&i.expand(n),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Bc(i,s,e))}getDefaultAttribute(t){return Kh(this).polygon[t]}needUpdateTags(t){return super.needUpdateTags(t,Xg)}needUpdateTag(t){return super.needUpdateTag(t,Xg)}toCustomPath(){const t=this.attribute.points,e=new hl;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 $g(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return $g.NOWORK_ANIMATE_ATTR}}function qg(t){return new $g(t)}$g.NOWORK_ANIMATE_ATTR=Dd;class Zg extends Su{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 Jg(t){return new Zg(t)}class Qg{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 tm extends Qg{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;$d(i,s+(r+o)/2,!0,a)}return i}}class em{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 em.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},rm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},am=function(t,e){return function(i,s){e(i,s,t)}};function om(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 lm(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 hm(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 cm(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),om(t,t,[n+o,r+l,a+h]),om(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),om(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=sm.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]}om(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),om(i,i,[-s[0],-s[1],0]),hm(t,t,i)}}let dm=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 Qg],this._symbolBoundsContribitions=[new tm],this._imageBoundsContribitions=[new Qg],this._circleBoundsContribitions=[new Qg],this._arcBoundsContribitions=[new Qg],this._pathBoundsContribitions=[new Qg]}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,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}=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 h=this.tempAABBBounds1,c=this.tempAABBBounds2;return h.setValue(i.x1,i.y1,i.x2,i.y2),c.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=cp(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=hp(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){$d(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}=t,r=i;return n.forEach((t=>{r.add(t.x,t.y)})),r}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{r.add(t.x,t.y)}))})),r}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):Ec(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):(Ec(h,l,n,i),Ec(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){$d(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;$d(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)}};dm=nm([La(),am(0,Ba(_u)),rm("design:paramtypes",[Object])],dm);const um=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 pm,gm;function mm(t){return pm||(pm=um.CreateGraphic("text",{})),pm.initAttributes(t),pm.AABBBounds}const fm={x:0,y:0,z:0,lastModelMatrix:null};class vm{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=ju(o,l,n),p=Hu(o,c),g=Du(n,r),m=Fu(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;fm.x=n,fm.y=r,fm.z=a,fm.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=sm.allocate(),n=sm.allocate();cm(n,t,e),hm(s,d||s,n),fm.x=0,fm.y=0,fm.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),sm.free(n)}if(g&&!d){const s=t.getOffsetXY(e);fm.x+=s.x,fm.y+=s.y,fm.z=a,i.setTransformForCurrent()}else if(p)fm.x=0,fm.y=0,fm.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);fm.x+=s.x,fm.y+=s.y,this.transformWithoutTranslate(i,fm.x,fm.y,fm.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),fm.x=0,fm.y=0,fm.z=0;return fm}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=Kh(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,_=ju(d,u,h),y=Hu(d,g),b=Du(h),x=Fu(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&&sm.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}const _m=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 ym{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(ym.IsGradientStr(t))try{const e=_m(t)[0];if(e){if("linear"===e.type)return ym.ParseLinear(e);if("radial"===e.type)return ym.ParseRadial(e);if("conic"===e.type)return ym.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 bm(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 xm(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 Sm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},km=function(t,e){return function(i,s){e(i,s,t)}};class Mm{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=Kh(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=Ch.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),Ch.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 Tm=new Mm;let wm=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)}))}};wm=Sm([La(),km(0,Ba($a)),km(0,Oa(np)),Am("design:paramtypes",[Object])],wm);class Cm{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=Ch.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])),Ch.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 Em=new Cm;const Pm=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=bm(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T+r,innerRadius:M-r,startAngle:_-a,endAngle:y+a}),e.beginPath(),Wu(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=bm(e,n,e.dpr),a=n/T;if(t.setAttributes({outerRadius:T-r,innerRadius:M+r,startAngle:_+a,endAngle:y-a}),e.beginPath(),Wu(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})}},Bm=Em,Rm=Tm;const Lm=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=bm(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=bm(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()}}}},Om=Em,Im=Tm;const Dm=new class extends Mm{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()}},Fm=Ct/2;function jm(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],-Fm,0,!1)}if(t.lineTo(_[0],_[1]),!q(v,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,Fm,!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],Fm,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+Fm,!1)}return t.closePath(),t}var zm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Hm{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=bm(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(),jm(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=bm(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(),jm(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 Vm=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)}};Vm=zm([La()],Vm);let Nm=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()}}};Nm=zm([La()],Nm);const Gm=new Hm,Wm=Em,Um=Tm;const Ym=new class extends Hm{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)}},Km=new class extends Mm{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=Kh(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=Tc(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?jm(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 Xm=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=bm(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=bm(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()}}}},$m=Em,qm=Tm;var Zm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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,s){e(i,s,t)}};let tf=class extends vm{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=su,this.builtinContributions=[Pm,Rm,Bm],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||T>wt)&&(O=n*Ot(y),I=n*Ft(y),D=r*Ot(x),F=r*Ft(x),uwt){const t=Dt(S,C),r=Dt(A,C),a=Gu(D,F,P,B,n,t,Number(p)),o=Gu(O,I,R,L,n,r,Number(p));if(C0&&e.arc(i+o.cx,s+o.cy,r,Lt(o.y11,o.x11),Lt(o.y01,o.x01),!p)}}else e.moveTo(i+P,s+B);if(!(r>wt)||v<.001)e.lineTo(i+R,s+L),g=!0;else if(E>wt){const t=Dt(M,E),n=Dt(k,E),a=Gu(R,L,O,I,r,-n,Number(p)),o=Gu(P,B,D,F,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),E0&&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(x),s+r*Ft(x));return g}drawShape(t,e,i,s,n,r,a,o){const l=Kh(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++)kc[s]=t,i&&(i=!(null!==(e=kc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)kc[e]=!!t[e],i&&(i=!!kc[e]);else kc[0]=!1,kc[1]=!1,kc[2]=!1,kc[3]=!1;return{isFullStroke:i,stroke:kc}})(d);if((v||C)&&(e.beginPath(),Wu(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(),Wu(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),cd(o.color,l.color,h,!1)}(0,0,h,n);a||ju&&(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=Kh(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}};tf=Zm([La(),Qm(0,Ba($a)),Qm(0,Oa(Xu)),Jm("design:paramtypes",[Object])],tf);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 vm{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=au,this.builtinContributions=[Lm,Im,Om],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Kh(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=Kh(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function af(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 of(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),af(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 hf=class extends vm{constructor(){super(...arguments),this.numberType=cu}draw(t,e,i,s){const n=Kh(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;of(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(),of(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"===f)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=ll(t.points,f,{startPoint:e});return s=n,n})).filter((t=>!!t)),"linearClosed"===f){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===v){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],v,_,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=v*r;let g=0,m=!1;t.cache.forEach(((r,f)=>{if(m)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(m=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[f],[l,t.attribute],Dt(y,1),_,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,v,_,i,s,t,a,o)}};function cf(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 df(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),af(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),af(t,l,1,s),o=!1):o=!0}t.closePath()}hf=lf([La()],hf);const uf=new class extends Cm{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:Lc(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Lc(l,"textureColor")),textureSize:b=(null!==(m=t.attribute.textureSize)&&void 0!==m?m:Lc(l,"textureSize")),texturePadding:x=(null!==(f=t.attribute.texturePadding)&&void 0!==f?f:Lc(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},pf=Tm;var gf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ff=function(t,e){return function(i,s){e(i,s,t)}};function vf(t,e,i){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"linearClosed":return ol(t,i)}}let _f=class extends vm{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=ru,this.builtinContributions=[uf,pf],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=Kh(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}=t.attribute,b=this.valid(t,g,a,o);if(!b)return;const{doFill:x,doStroke:S}=b,{clipRange:A=g.clipRange,closePath:k,points:M,segments:T}=t.attribute;let{curveType:w=g.curveType}=t.attribute;if(k&&"linear"===w&&(w="linearClosed"),1===A&&!T&&!M.some((t=>!1===t.defined))&&"linear"===w)return this.drawLinearAreaHighPerformance(t,e,!!m,S,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(T&&T.length){let e,i;const s=T.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=vf(t.points,w,{startPoint:e});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=T.length-1;t>=0;t--){const e=T[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=T[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=vf(i,"stepBefore"===w?"stepAfter":"stepAfter"===w?"stepBefore":w),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!M||!M.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=M,i=[];for(let t=M.length-1;t>=0;t--)i.push({x:null!==(u=M[t].x1)&&void 0!==u?u:M[t].x,y:null!==(p=M[t].y1)&&void 0!==p?p:M[t].y});const s=vf(e,w),n=vf(i,"stepBefore"===w?"stepAfter":"stepAfter"===w?"stepBefore":w);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===A){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,x,v,S,y,r[c],[g,t.attribute],A,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=A*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,x,v,S,y,r[u],[g,t.attribute],Dt(m,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,x,v,S,y,t.attribute,g,A,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Kh(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=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),cf(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),cf(t,e,i,s),e.length=0,i.length=0)}n=o})),cf(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},Sf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Af=function(t,e){return function(i,s){e(i,s,t)}};let kf=class extends vm{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=du,this.builtinContributions=[bf,yf],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:Kh(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=Kh(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};kf=xf([La(),Af(0,Ba($a)),Af(0,Oa(Qu)),Sf("design:paramtypes",[Object])],kf);var Mf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 vm{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=pu,this.builtinContributions=[Gm,Um,Wm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Kh(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=zu(g,m,k,M,c),w=Vu(g,v,k,M),C=Du(c,d),E=Fu(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(),jm(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=Kh(t,null==s?void 0:s.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Cf=Mf([La(),wf(0,Ba($a)),wf(0,Oa(ep)),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 vm{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=mu,this.builtinContributions=[Xm,qm,$m],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=Kh(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=Kh(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Rf=Ef([La(),Bf(0,Ba($a)),Bf(0,Oa(ip)),Pf("design:paramtypes",[Object])],Rf);const Lf=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 Of=new class extends Mm{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=Lf.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=mm(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?(jm(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&&Lf.free(C),w()}};var If=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Df=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ff=function(t,e){return function(i,s){e(i,s,t)}};let jf=class extends vm{constructor(t){super(),this.textRenderContribitions=t,this.numberType=fu,this.builtinContributions=[Of],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Kh(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=Dc(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=im.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),im.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=Kh(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=hp(l,f),_=cp(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=cp("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 zf(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},Uf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Yf=function(t,e){return function(i,s){e(i,s,t)}};let Kf=class extends vm{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=uu,this.builtinContributions=[Gf,Nf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Kh(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))?zf(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 zf(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=Hf(d,u),b=Hf(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*f);const S=Vf(h,_,y,d,u),A=Vf(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Hf(k,M),w=Vf(h,Hf(_,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=Kh(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Kf=Wf([La(),Yf(0,Ba($a)),Yf(0,Oa(tp)),Uf("design:paramtypes",[Object])],Kf);var Xf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)}};const Zf=["","repeat-x","repeat-y","repeat"];let Jf=class extends vm{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=hu,this.builtinContributions=[Ym,Km],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Kh(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(),jm(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,Zf[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 wd.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Kh(t).image;this._draw(t,a,!1,i)}};Jf=Xf([La(),qf(0,Ba($a)),qf(0,Oa(Ju)),$f("design:paramtypes",[Object])],Jf);const Qf=Symbol.for("IncrementalDrawContribution"),tv=Symbol.for("ArcRender"),ev=Symbol.for("AreaRender"),iv=Symbol.for("CircleRender"),sv=Symbol.for("GraphicRender"),nv=Symbol.for("GroupRender"),rv=Symbol.for("LineRender"),av=Symbol.for("PathRender"),ov=Symbol.for("PolygonRender"),lv=Symbol.for("RectRender"),hv=Symbol.for("SymbolRender"),cv=Symbol.for("TextRender"),dv=Symbol.for("RichTextRender"),uv=Symbol.for("GlyphRender"),pv=Symbol.for("ImageRender"),gv=Symbol.for("DrawContribution");var mv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const vv=Symbol.for("DrawItemInterceptor"),_v=new Jt,yv=new Jt;class bv{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return t.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){_v.copy(s.dirtyBounds),yv.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(_v),s.backupDirtyBounds.copy(yv)),!0}}class xv{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 Sv=class{constructor(){this.order=1,this.interceptors=[new bv,new kv,new Av,new xv]}afterDrawItem(t,e,i,s,n){for(let r=0;r(e=t.numberType===nu,!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&&sm.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Mv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},wv=function(t,e){return function(i,s){e(i,s,t)}};const Cv=Symbol.for("RenderService");let Ev=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}};Ev=Mv([La(),wv(0,Ba(gv)),Tv("design:paramtypes",[Object])],Ev);var Pv=new ba((t=>{t(Cv).to(Ev)}));const Bv=Symbol.for("PickerService"),Rv=Symbol.for("GlobalPickerService");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};const Ov=Symbol.for("PickItemInterceptor");let Iv=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){if(!t.shadowRoot)return null;const{parentMatrix:r}=n||{};if(!r)return null;const a=e.pickContext;a.highPerformanceSave();const o=t.shadowRoot,l=im.allocateByObj(r),h=new Xt(l.a*i.x+l.c*i.y+l.e,l.b*i.x+l.d*i.y+l.f),c=e.pickGroup(o,h,l,s);return a.highPerformanceRestore(),c}};Iv=Lv([La()],Iv);let Dv=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}};Dv=Lv([La()],Dv);let Fv=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===nu,!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()}};Fv=Lv([La()],Fv);var jv=new ba(((t,e,i)=>{i(Bv)||(t(Rv).toSelf(),t(Bv).toService(Rv)),t(Fv).toSelf().inSingletonScope(),t(Ov).toService(Fv),t(Iv).toSelf().inSingletonScope(),t(Ov).toService(Iv),t(Dv).toSelf().inSingletonScope(),t(Ov).toService(Dv),Za(t,Ov)})),zv=new ba((t=>{t(vu).to(dm).inSingletonScope(),t(_u).toConstantValue(um)}));const Hv=Symbol.for("AutoEnablePlugins"),Vv=Symbol.for("PluginService");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},Gv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wv=function(t,e){return function(i,s){e(i,s,t)}};let Uv=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&&$l.isBound(Hv)&&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=[]}};Uv=Nv([La(),Wv(0,Ba($a)),Wv(0,Oa(Hv)),Gv("design:paramtypes",[Object])],Uv);var Yv=new ba((t=>{t(Vv).to(Uv),function(t,e){t($a).toDynamicValue((t=>{let{container:i}=t;return new qa(e,i)})).whenTargetNamed(e)}(t,Hv)})),Kv=new ba((t=>{Za(t,to)})),Xv=new ba((t=>{t(Kl).to(Xl).inSingletonScope(),Za(t,Kl)})),$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},qv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Zv=class{constructor(){this.type="static",this.offscreen=!1,this.global=Ol.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=Jl({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()}};Zv=$v([La(),qv("design:paramtypes",[])],Zv);var Jv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)};let t_=class{constructor(){this.offscreen=!1,this.type="virtual",this.global=Ol.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(){}};t_=Jv([La(),Qv("design:paramtypes",[])],t_);var e_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)};let s_=class{constructor(){this.offscreen=!0,this.type="dynamic",this.global=Ol.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;const s=Jl({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){}};s_=e_([La(),i_("design:paramtypes",[])],s_);var n_=new ba((t=>{t(Zv).toSelf(),t(s_).toSelf(),t(t_).toSelf(),t(Cu).toService(Zv),t(Eu).toService(s_),t(Pu).toService(t_)}));var r_=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 a_(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 r_(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,s)}))}function l_(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 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)},d_=function(t,e){return function(i,s){e(i,s,t)}};let u_=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=Ol.global,this.layerService=Ol.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:yl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:yl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,im.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=l_(e,i,yl.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=Lf.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=im.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))})):a_(t,yl.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),Lf.free(n),im.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||$l.get(Qf);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},g_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},m_=function(t,e){return function(i,s){e(i,s,t)}};let f_=class{constructor(t){this.groupRenderContribitions=t,this.numberType=lu}drawShape(t,e,i,s,n,r,a,o){const l=Kh(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=zu(u,f,p,g,h),k=Vu(u,v,p,g),M=Du(h,c),T=Fu(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(),jm(e,i,s,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Dm));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=Kh(t,null==s?void 0:s.theme).group,l=n.modelMatrix;if(n.camera){const e=sm.allocate(),i=sm.allocate();cm(i,t,o),hm(e,l||e,i),n.modelMatrix=e,sm.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&&sm.free(n.modelMatrix),n.modelMatrix=l,n.baseGlobalAlpha/=a,d&&d.then?d.then((()=>{r?n.restore():n.highPerformanceRestore()})):r?n.restore():n.highPerformanceRestore()}};f_=p_([La(),m_(0,Ba($a)),m_(0,Oa(Zu)),g_("design:paramtypes",[Object])],f_);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};let __=class extends hf{constructor(){super(...arguments),this.numberType=cu}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=Kh(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=ju(u,p,c),_=Hu(u,g),y=Du(c),b=Fu(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())}};__=v_([La()],__);var y_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 b_=class extends _f{constructor(){super(...arguments),this.numberType=ru}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=Kh(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=ju(u,d,c),m=Du(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())}};b_=y_([La()],b_);var x_,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},A_=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)}},M_=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"}(x_||(x_={}));let T_=class extends u_{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=x_.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 M_(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:yl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:yl.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 M_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return M_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>M_(this,void 0,void 0,(function*(){if(2!==t.count)yield o_(t,yl.zIndex,((i,s)=>{if(this.status===x_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return M_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return M_(this,void 0,void 0,(function*(){this.rendering&&(this.status=x_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=x_.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 M_(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:()=>M_(this,void 0,void 0,(function*(){yield o_(t,yl.zIndex,(t=>M_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};T_=S_([La(),k_(0,Ra(sv)),k_(1,Ba(__)),k_(2,Ba(b_)),k_(3,Ba($a)),k_(3,Oa(vv)),A_("design:paramtypes",[Array,Object,Object,Object])],T_);var w_=new ba((t=>{t(Mm).toSelf().inSingletonScope(),t(Cm).toSelf().inSingletonScope(),t(gv).to(u_),t(Qf).to(T_),t(nv).to(f_).inSingletonScope(),t(sv).toService(nv),Za(t,Zu),t(wm).toSelf().inSingletonScope(),Za(t,np),Za(t,sv),t(Sv).toSelf().inSingletonScope(),t(vv).toService(Sv),Za(t,vv)}));function C_(){C_.__loaded||(C_.__loaded=!0,$l.load(Iu),$l.load(zv),$l.load(Pv),$l.load(jv),$l.load(Yv),function(t){t.load(Kv),t.load(Xv),t.load(n_)}($l),function(t){t.load(w_)}($l))}C_.__loaded=!1,C_();const E_=$l.get(eo);Ol.global=E_;const P_=$l.get(Tu);Ol.graphicUtil=P_;const B_=$l.get(Mu);Ol.transformUtil=B_;const R_=$l.get(vu);Ol.graphicService=R_;const L_=$l.get(wu);Ol.layerService=L_;class O_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ya.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Ol.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),Ol.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){Ol.graphicService.hooks.onAttributeUpdate.taps=Ol.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Ol.graphicService.hooks.onSetStage.taps=Ol.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class I_{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 D_{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,Ol.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))})),Ol.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){Ol.graphicService.hooks.onAddIncremental.taps=Ol.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Ol.graphicService.hooks.onClearIncremental.taps=Ol.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Ol.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 F_{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)),Ol.graphicService.hooks.onRemove.unTap(this.key),Ol.graphicService.hooks.onRelease.unTap(this.key),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?Ol.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:Ol.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return function(t){const e={};return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[si(i)]=t[i])})),["fontSize","lineHeight"].forEach((i=>{const s=si(i);u(t[i])||(e[s]=/^[0-9]*$/.test(`${t[i]}`)?`${t[i]}px`:`${t[i]}`)})),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:Kh(t).text)}getTransformOfText(t){const e=Kh(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=Ol.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),f=o+m.left-p.left,v=l+m.top-p.top;if(a.left=`${f}px`,a.top=`${v}px`,"text"===t.type&&"position"===c&&(a=Object.assign(Object.assign({},a),this.getTransformOfText(t))),d(n.style)){const e=n.style({top:v,left:f,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)));Ol.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"===Ol.global.env&&(t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:yl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:yl.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&&Ol.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"===Ol.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 j_=new Jt;class z_{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()})),Ol.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&&(j_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(j_,t.parent&&t.parent.globalTransMatrix)))})),Ol.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))})),Ol.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){Ol.graphicService.hooks.beforeUpdateAABBBounds.taps=Ol.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Ol.graphicService.hooks.afterUpdateAABBBounds.taps=Ol.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)),Ol.graphicService.hooks.onRemove.taps=Ol.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const H_=new Jt;class V_{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=Kh(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,Ol.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),Ol.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&H_.copy(s)})),Ol.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(H_.equals(i)||this.tryLayout(t,!1))})),Ol.graphicService.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1)}))}deactivate(t){Ol.graphicService.hooks.onAttributeUpdate.taps=Ol.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Ol.graphicService.hooks.beforeUpdateAABBBounds.taps=Ol.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Ol.graphicService.hooks.afterUpdateAABBBounds.taps=Ol.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Ol.graphicService.hooks.onSetStage.taps=Ol.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const N_=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===cc.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=cc.INITIAL,Ol.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),Ol.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:hc},{mode:"timeout",cons:lc},{mode:"manual",cons:oc}];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!==cc.INITIAL&&(this.status=cc.PAUSE,!0)}resume(){return this.status!==cc.INITIAL&&(this.status=cc.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===cc.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===cc.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=cc.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=cc.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};N_.addTimeline(pc),N_.setFPS(60);class G_{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=ld.Get(e,od.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)?ld.Get(e,od.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}function W_(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 U_(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 Y_{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=sm.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=sm.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()})),i&&Ol.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))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])this.htmlMap[o].root.render(r);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t){const i=n.createRoot(t);i.render(r),this.htmlMap||(this.htmlMap={}),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}}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 q_="white";class Z_ extends Su{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:q_}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 Uh,this.hooks={beforeRender:new Qa(["stage"]),afterRender:new Qa(["stage"])},this.global=Ol.global,!this.global.env&&X_()&&this.global.setEnv("browser"),this.window=$l.get(Bh),this.renderService=$l.get(Cv),this.pluginService=$l.get(Vv),this.layerService=$l.get(wu),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:q_,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||N_,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new uc,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 ac(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 G_(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 Y_(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 I_))}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 O_))}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 D_))}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 z_,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 V_))}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 F_))}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 $_))}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){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(){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){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(){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];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];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){this.pickerService||(this.pickerService=$l.get(Bv));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){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){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;const e=$l.get(Bh),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;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 J_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)};const ty=new ae(1,0,0,1,0,0),ey={x:0,y:0};let iy=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 hl,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 im.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(im.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(im.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},ey),function(t,e,i){return wh(t,0,!1,e,i)}(this.path.commandList,ey.x,ey.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ey);const i=bm(this,this.lineWidth,this.dpr);return function(t,e,i,s){return wh(t,e,!0,i,s)}(this.path.commandList,i,ey.x,ey.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(ty,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=>im.free(t))),this.stack.length=0}};iy=J_([La(),Q_("design:paramtypes",[Object,Number])],iy);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={WIDTH:500,HEIGHT:500,DPR:1};let ay=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=ry.WIDTH,height:n=ry.HEIGHT,dpr:r=ry.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)}};ay.env="browser",ay=sy([La(),ny("design:paramtypes",[Object])],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};let ly=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}}};ly=oy([La()],ly);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},cy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let dy=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}};dy=hy([La(),cy("design:paramtypes",[])],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},py=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gy=function(t,e){return function(i,s){e(i,s,t)}};let my=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=Ol.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=sm.allocate();if(lm(i,e),a){if(i){const t=sm.allocate();r.modelMatrix=hm(t,a,i),sm.free(i)}}else lm(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=Kh(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=Kh(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&&sm.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),im.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function fy(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&&fy(t,e,a,s,n),n.push(t[a],t[a+1]),i-a>2&&fy(t,a,i,s,n))}function vy(t,e){const i=t.length-1,s=[t[0]];return fy(t,0,i,e,s),s.push(t[i]),s}my=uy([La(),gy(0,Ba($a)),gy(0,Oa(Ov)),py("design:paramtypes",[Object])],my);let _y=!1;const yy=new ba((t=>{_y||(_y=!0,t(tf).toSelf().inSingletonScope(),t(tv).to(tf).inSingletonScope(),t(sv).toService(tv),t(Xu).toService(wm),Za(t,Xu))}));let by=!1;const xy=new ba((t=>{by||(by=!0,t(Cf).toSelf().inSingletonScope(),t(lv).to(Cf).inSingletonScope(),t(sv).toService(lv),t(Nm).toSelf(),t(Vm).toSelf(),t(ep).toService(Nm),t(ep).toService(Vm),t(ep).toService(wm),Za(t,ep))}));let Sy=!1;const Ay=new ba((t=>{Sy||(Sy=!0,t(hf).toSelf().inSingletonScope(),t(__).toSelf().inSingletonScope(),t(rv).to(hf).inSingletonScope(),t(sv).toService(rv))}));let ky=!1;const My=new ba((t=>{ky||(ky=!0,t(_f).toSelf().inSingletonScope(),t(ev).to(_f).inSingletonScope(),t(sv).toService(ev),t($u).toService(wm),Za(t,$u),t(b_).toSelf().inSingletonScope())}));let Ty=!1;const wy=new ba((t=>{Ty||(Ty=!0,t(Rf).toSelf().inSingletonScope(),t(hv).to(Rf).inSingletonScope(),t(sv).toService(hv),t(ip).toService(wm),Za(t,ip))}));let Cy=!1;const Ey=new ba((t=>{Cy||(Cy=!0,t(rf).toSelf().inSingletonScope(),t(iv).to(rf).inSingletonScope(),t(sv).toService(iv),t(qu).toService(wm),Za(t,qu))}));let Py=!1;const By=new ba((t=>{Py||(Py=!0,t(cv).to(jf).inSingletonScope(),t(sv).toService(cv),t(sp).toService(wm),Za(t,sp))}));let Ry=!1;const Ly=new ba((t=>{Ry||(Ry=!0,t(kf).toSelf().inSingletonScope(),t(av).to(kf).inSingletonScope(),t(sv).toService(av),t(Qu).toService(wm),Za(t,Qu))}));let Oy=!1;const Iy=new ba((t=>{Oy||(Oy=!0,t(ov).to(Kf).inSingletonScope(),t(sv).toService(ov),t(tp).toService(wm),Za(t,tp))}));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 Fy=class{constructor(){this.numberType=ou}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=Kh(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};Fy=Dy([La()],Fy);let jy=!1;const zy=new ba((t=>{jy||(jy=!0,t(uv).to(Fy).inSingletonScope(),t(sv).toService(uv))}));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},Vy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ny=class extends vm{constructor(){super(),this.numberType=gu,this.builtinContributions=[Of],this.init()}drawShape(t,e,i,s,n){const r=Kh(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=ju(o,l,!0),d=ju(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=Kh(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(),jm(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=Kh(t).richtext;this._draw(t,s,!1,i)}};Ny=Hy([La(),Vy("design:paramtypes",[])],Ny);let Gy=!1;const Wy=new ba((t=>{Gy||(Gy=!0,t(dv).to(Ny).inSingletonScope(),t(sv).toService(dv))}));let Uy=!1;const Yy=new ba((t=>{Uy||(Uy=!0,t(pv).to(Jf).inSingletonScope(),t(sv).toService(pv),t(Ju).toService(wm),Za(t,Ju))}));const Ky=(t,e)=>(d($y.warnHandler)&&$y.warnHandler.call(null,t,e),e?rt.getInstance().warn(`[VChart warn]: ${t}`,e):rt.getInstance().warn(`[VChart warn]: ${t}`)),Xy=(t,e,i)=>{if(!d($y.errorHandler))throw new Error(t);$y.errorHandler.call(null,t,e)},$y={silent:!1,warnHandler:!1,errorHandler:!1},qy=X_(),Zy=qy&&globalThis?globalThis.document:void 0;function Jy(t){return("desktop-browser"===t||"mobile-browser"===t)&&qy}function Qy(t){return tb(t)||"mobile-browser"===t}function tb(t){return t.includes("miniApp")||"lynx"===t||"wx"===t}let eb=0;function ib(){return eb>=9999999&&(eb=0),eb++}function sb(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function nb(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const rb=(t,e,i)=>(t.fields=e||[],t.fname=i,t),ab=t=>e=>R(e,t),ob=t=>{rt.getInstance().error(t)},lb=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||ob("Access path missing open bracket: "+t),o>0&&h(),o=0,s=n+1):n>s?h():s=n+1}return o&&ob("Access path missing closing bracket: "+t),a&&ob("Access path missing closing quote: "+t),n>s&&(n+=1,h()),e})(t),n=1===s.length?s[0]:t;return rb((i&&i.get||ab)(s),[n],e||n)},hb=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(y(t)){const s=t.map((t=>lb(t,e,i)));return t=>s.map((e=>e(t)))}return lb(t,e,i)};hb("id");const cb=rb((function(t){return t}),[],"identity"),db=rb((function(){return 0}),[],"zero");rb((function(){return 1}),[],"one"),rb((function(){return!0}),[],"true"),rb((function(){return!1}),[],"false"),rb((function(){return{}}),[],"emptyObject");const ub=(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=>pb(t,r,n)))))},gb=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t;function mb(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 fb(t,e,i,s,n){let r=0,a=0;return mb(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function vb(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;mb(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:fb(t,e,i,n,h)}}function _b(t){return"horizontal"===t}function yb(t){return"vertical"===t}const bb=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class xb extends Su{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,bb.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=>bb.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 $b=(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"},qb=(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 Zb 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=ec.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=ec.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||$b(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=qb(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=ec.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=qb(i,n),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=$b(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=ec.now()-i>this.config.press.time&&qb(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},Qb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const tx=[0,0,0];let ex=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({},pl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},ml),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},fl),{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 im.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&&(im.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(im.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&&Ku.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&&(U_(tx,[t,e,i],this.modelMatrix),t=tx[0],e=tx[1],i=tx[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&&(U_(tx,[t,e,i],this.modelMatrix),t=tx[0],e=tx[1],i=tx[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(U_(tx,[e,i,s],this.modelMatrix),e=tx[0],i=tx[1],s=tx[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]:Ol.global.measureTextMethod;var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Ol.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:fl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:fl.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&&(U_(tx,[e,i,s],this.modelMatrix),e=tx[0],i=tx[1],s=tx[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=xm(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=bm(this,l,this.dpr),r.strokeStyle=xm(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=lp(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=lp(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=>im.free(t))),this.stack.length=0}};ex.env="browser",ex=Jb([La(),Qb("design:paramtypes",[Object,Number])],ex);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},sx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let nx=class extends ay{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Ol.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new ex(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 rx(t,e){return new ba((i=>{i(ql).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Zl).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}nx.env="browser",nx=ix([La(),sx("design:paramtypes",[Object])],nx);const ax=rx(nx,ex);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)},hx=function(t,e){return function(i,s){e(i,s,t)}};let cx=class extends my{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=Ch.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 ux=class{constructor(){this.type="group",this.numberType=lu}contains(t,e,i){return!1}};ux=dx([La()],ux);const px=new ba(((t,e,i,s)=>{px.__vloaded||(px.__vloaded=!0,t(Yb).to(ux).inSingletonScope(),t(Kb).toService(Yb),Za(t,Kb))}));px.__vloaded=!1;var gx=px;const mx=new ba(((t,e,i,s)=>{i(cx)||t(cx).toSelf().inSingletonScope(),i(Bv)?s(Bv).toService(cx):t(Bv).toService(cx)}));var fx,vx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)};let yx=fx=class extends dy{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${fx.idprefix}_${fx.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Ol.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:fx.GenerateCanvasId(),canvasControled:!0};this.canvas=new nx(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 nx({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)}};yx.env="browser",yx.idprefix="visactor_window",yx.prefix_count=0,yx=fx=vx([La(),_x("design:paramtypes",[])],yx);const bx=new ba((t=>{t(yx).toSelf(),t(Rh).toDynamicValue((t=>t.container.get(yx))).whenTargetNamed(yx.env)}));var 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)};class Ax{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 kx(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 Mx=class extends ly{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 Ax(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 kx(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return kx(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}}};Mx=xx([La(),Sx("design:paramtypes",[])],Mx);const Tx=new ba((t=>{Tx.isBrowserBound||(Tx.isBrowserBound=!0,t(Mx).toSelf().inSingletonScope(),t(to).toService(Mx))}));function Cx(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Cx.__loaded||(Cx.__loaded=!0,t.load(Tx),t.load(ax),t.load(bx),e&&function(t){t.load(gx),t.load(mx)}(t))}Tx.isBrowserBound=!1,Cx.__loaded=!1;var Ex=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Bx=function(t,e){return function(i,s){e(i,s,t)}};let Rx=class extends my{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 iy(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}};Rx=Ex([La(),Bx(0,Ba($a)),Bx(0,Oa(Sb)),Bx(1,Ba($a)),Bx(1,Oa(Ov)),Px("design:paramtypes",[Object,Object])],Rx);const Lx=new ba((t=>{Lx.__vloaded||(Lx.__vloaded=!0,Za(t,Sb))}));Lx.__vloaded=!1;var Ox=Lx,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)},Fx=function(t,e){return function(i,s){e(i,s,t)}};let jx=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=su}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=Kh(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}};jx=Ix([La(),Fx(0,Ba(tv)),Dx("design:paramtypes",[Object])],jx);let zx=!1;const Hx=new ba(((t,e,i,s)=>{zx||(zx=!0,t(Ab).to(jx).inSingletonScope(),t(Sb).toService(Ab))}));var Vx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Gx=function(t,e){return function(i,s){e(i,s,t)}};let Wx=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=ru}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=Kh(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}};Wx=Vx([La(),Gx(0,Ba(ev)),Nx("design:paramtypes",[Object])],Wx);let Ux=!1;const Yx=new ba(((t,e,i,s)=>{Ux||(Ux=!0,t(kb).to(Wx).inSingletonScope(),t(Sb).toService(kb))}));var Kx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$x=function(t,e){return function(i,s){e(i,s,t)}};let qx=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=au}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=Kh(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}};qx=Kx([La(),$x(0,Ba(iv)),Xx("design:paramtypes",[Object])],qx);let Zx=!1;const Jx=new ba(((t,e,i,s)=>{Zx||(Zx=!0,t(Mb).to(qx).inSingletonScope(),t(Sb).toService(Mb))}));var Qx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},eS=function(t,e){return function(i,s){e(i,s,t)}};let iS=class{constructor(t){this.canvasRenderer=t,this.type="glyph",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=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}};iS=Qx([La(),eS(0,Ba(uv)),tS("design:paramtypes",[Object])],iS);let sS=!1;const nS=new ba(((t,e,i,s)=>{sS||(sS=!0,t(Lb).to(iS).inSingletonScope(),t(iS).toService(Lb))}));var rS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 aS=class{constructor(){this.type="image",this.numberType=hu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};aS=rS([La()],aS);let oS=!1;const lS=new ba(((t,e,i,s)=>{oS||(oS=!0,t(Tb).to(aS).inSingletonScope(),t(aS).toService(Tb))}));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="line",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=Kh(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}};uS=hS([La(),dS(0,Ba(rv)),cS("design:paramtypes",[Object])],uS);let pS=!1;const gS=new ba(((t,e,i,s)=>{pS||(pS=!0,t(wb).to(uS).inSingletonScope(),t(Sb).toService(wb))}));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="polygon",this.numberType=uu}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=Kh(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}};_S=mS([La(),vS(0,Ba(ov)),fS("design:paramtypes",[Object])],_S);let yS=!1;const bS=new ba(((t,e,i,s)=>{yS||(yS=!0,t(Rb).to(_S).inSingletonScope(),t(Sb).toService(Rb))}));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},SS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},AS=function(t,e){return function(i,s){e(i,s,t)}};let kS=class{constructor(t){this.canvasRenderer=t,this.type="path",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=Kh(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}};kS=xS([La(),AS(0,Ba(av)),SS("design:paramtypes",[Object])],kS);let MS=!1;const TS=new ba(((t,e,i,s)=>{MS||(MS=!0,t(Cb).to(kS).inSingletonScope(),t(Sb).toService(Cb))}));var wS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ES=function(t,e){return function(i,s){e(i,s,t)}};const PS=new Jt;let BS=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=pu}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=Kh(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;PS.setValue(i.x1,i.y1,i.x2,i.y2),PS.expand(-r/2),h=!PS.containsPoint(e)}}return s.highPerformanceRestore(),h}};BS=wS([La(),ES(0,Ba(lv)),CS("design:paramtypes",[Object])],BS);let RS=!1;const LS=new ba(((t,e,i,s)=>{RS||(RS=!0,t(Eb).to(BS).inSingletonScope(),t(Sb).toService(Eb))}));let OS=!1;const IS=new ba(((t,e,i,s)=>{OS||(OS=!0,t(Tb).to(aS).inSingletonScope(),t(aS).toService(Tb))}));var DS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},jS=function(t,e){return function(i,s){e(i,s,t)}};let zS=class{constructor(t){this.canvasRenderer=t,this.type="symbol",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=Kh(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}};zS=DS([La(),jS(0,Ba(hv)),FS("design:paramtypes",[Object])],zS);let HS=!1;const VS=new ba(((t,e,i,s)=>{HS||(HS=!0,t(Pb).to(zS).inSingletonScope(),t(Sb).toService(Pb))}));var NS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 GS=class{constructor(){this.type="text",this.numberType=fu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};GS=NS([La()],GS);let WS=!1;const US=new ba(((t,e,i,s)=>{WS||(WS=!0,t(Bb).to(GS).inSingletonScope(),t(Sb).toService(Bb))})),YS=new ba(((t,e,i,s)=>{i(Rx)||t(Rx).toSelf().inSingletonScope(),i(Bv)?s(Bv).toService(Rx):t(Bv).toService(Rx)}));var KS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let $S=class extends ex{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(){}};$S.env="node",$S=KS([La(),XS("design:paramtypes",[Object,Number])],$S);var qS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ZS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let JS=class extends ay{constructor(t){super(t)}init(){this._context=new $S(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};JS.env="node",JS=qS([La(),ZS("design:paramtypes",[Object])],JS);const QS=rx(JS,$S);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)},iA=function(t,e){return function(i,s){e(i,s,t)}};let sA=class extends dy{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 JS(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 JS({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){}};sA.env="node",sA=tA([La(),iA(0,Ba(eo)),eA("design:paramtypes",[Object])],sA);const nA=new ba((t=>{t(sA).toSelf(),t(Rh).toDynamicValue((t=>t.container.get(sA))).whenTargetNamed(sA.env)}));var rA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 aA=class extends ly{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 Ic.call(t)}}getCancelAnimationFrame(){return t=>{Ic.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};aA=rA([La()],aA);const oA=new ba((t=>{oA.isNodeBound||(oA.isNodeBound=!0,t(aA).toSelf().inSingletonScope(),t(to).toService(aA))}));function lA(t){lA.__loaded||(lA.__loaded=!0,t.load(oA),t.load(QS),t.load(nA))}oA.isNodeBound=!1,lA.__loaded=!1;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 ex{draw(){}createPattern(t,e){return null}};cA.env="wx",cA=hA([La()],cA);var dA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let pA=class extends ay{constructor(t){super(t)}init(){this._context=new cA(this,this._dpr)}release(){}};pA.env="wx",pA=dA([La(),uA("design:paramtypes",[Object])],pA);const gA=rx(pA,cA);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)},vA=function(t,e){return function(i,s){e(i,s,t)}};class _A{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 yA=class extends dy{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new _A}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 pA(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 pA({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()}};yA.env="wx",yA=mA([La(),vA(0,Ba(eo)),fA("design:paramtypes",[Object])],yA);const bA=new ba((t=>{t(yA).toSelf(),t(Rh).toDynamicValue((t=>t.container.get(yA))).whenTargetNamed(yA.env)}));var xA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},SA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},AA=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 kA=class extends ly{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 AA(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 Ic.call(t)}}getCancelAnimationFrame(){return t=>{Ic.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}};kA=xA([La(),SA("design:paramtypes",[])],kA);const MA=new ba((t=>{MA._isWxBound||(MA._isWxBound=!0,t(kA).toSelf().inSingletonScope(),t(to).toService(kA))}));function TA(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];TA.__loaded||(TA.__loaded=!0,t.load(MA),t.load(gA),t.load(bA),e&&function(t){t.load(Ox),t.load(YS),t.load(Hx),t.load(Yx),t.load(Jx),t.load(nS),t.load(lS),t.load(gS),t.load(bS),t.load(TS),t.load(LS),t.load(IS),t.load(VS),t.load(US)}(t))}MA._isWxBound=!1,TA.__loaded=!1;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},CA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},EA=function(t,e){return function(i,s){e(i,s,t)}};let PA=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=su}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=Kh(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=bm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};PA=wA([La(),EA(0,Ba(tv)),CA("design:paramtypes",[Object])],PA);let BA=!1;const RA=new ba(((t,e,i,s)=>{BA||(BA=!0,t(Ob).to(PA).inSingletonScope(),t(Kb).toService(Ob))}));var LA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},OA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IA=function(t,e){return function(i,s){e(i,s,t)}};const DA=new Jt;let FA=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=pu}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=Kh(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=bm(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;DA.setValue(i.x1,i.y1,i.x2,i.y2),DA.expand(-r/2),h=!DA.containsPoint(e)}}return s.highPerformanceRestore(),h}};FA=LA([La(),IA(0,Ba(lv)),OA("design:paramtypes",[Object])],FA);let jA=!1;const zA=new ba(((t,e,i,s)=>{jA||(jA=!0,t(Hb).to(FA).inSingletonScope(),t(Kb).toService(Hb))}));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 VA=class extends vm{};VA=HA([La()],VA);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},GA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},WA=function(t,e){return function(i,s){e(i,s,t)}};let UA=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="line",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;s.highPerformanceSave();const n=Kh(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=bm(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&sm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};UA=NA([La(),WA(0,Ba(rv)),GA("design:paramtypes",[Object])],UA);let YA=!1;const KA=new ba(((t,e,i,s)=>{YA||(YA=!0,t(jb).to(UA).inSingletonScope(),t(Kb).toService(jb))}));var XA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},qA=function(t,e){return function(i,s){e(i,s,t)}};let ZA=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=ru}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=Kh(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=bm(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h})),s.highPerformanceRestore(),h}};ZA=XA([La(),qA(0,Ba(ev)),$A("design:paramtypes",[Object])],ZA);let JA=!1;const QA=new ba(((t,e,i,s)=>{JA||(JA=!0,t(Ib).to(ZA).inSingletonScope(),t(Kb).toService(Ib))}));var tk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ik=function(t,e){return function(i,s){e(i,s,t)}};let sk=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=mu}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=Kh(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=bm(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&sm.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};sk=tk([La(),ik(0,Ba(hv)),ek("design:paramtypes",[Object])],sk);let nk=!1;const rk=new ba(((t,e,i,s)=>{nk||(nk=!0,t(Vb).to(sk).inSingletonScope(),t(Kb).toService(Vb))}));var ak=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ok=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lk=function(t,e){return function(i,s){e(i,s,t)}};let hk=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=au}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=Kh(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=bm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};hk=ak([La(),lk(0,Ba(iv)),ok("design:paramtypes",[Object])],hk);let ck=!1;const dk=new ba(((t,e,i,s)=>{ck||(ck=!0,t(Db).to(hk).inSingletonScope(),t(Kb).toService(Db))}));var uk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gk=function(t,e){return function(i,s){e(i,s,t)}};let mk=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=fu}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=Kh(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=cp(a,u,n),v=hp(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&&sm.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};mk=uk([La(),gk(0,Ba(cv)),pk("design:paramtypes",[Object])],mk);let fk=!1;const vk=new ba(((t,e,i,s)=>{fk||(fk=!0,t(Nb).to(mk).inSingletonScope(),t(Kb).toService(Nb))}));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},yk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bk=function(t,e){return function(i,s){e(i,s,t)}};let xk=class extends VA{constructor(t){super(),this.canvasRenderer=t,this.type="path",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=Kh(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=bm(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&sm.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}};xk=_k([La(),bk(0,Ba(av)),yk("design:paramtypes",[Object])],xk);let Sk=!1;const Ak=new ba(((t,e,i,s)=>{Sk||(Sk=!0,t(zb).to(xk).inSingletonScope(),t(Kb).toService(zb))}));var kk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mk=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 wk=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=uu}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=Kh(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=bm(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}};wk=kk([La(),Tk(0,Ba(ov)),Mk("design:paramtypes",[Object])],wk);let Ck=!1;const Ek=new ba(((t,e,i,s)=>{Ck||(Ck=!0,t(Gb).to(wk).inSingletonScope(),t(Kb).toService(Gb))}));var Pk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rk=function(t,e){return function(i,s){e(i,s,t)}};let Lk=class{constructor(t){this.canvasRenderer=t,this.type="glyph",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=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}};Lk=Pk([La(),Rk(0,Ba(uv)),Bk("design:paramtypes",[Object])],Lk);let Ok=!1;const Ik=new ba(((t,e,i,s)=>{Ok||(Ok=!0,t(Ub).to(Lk).inSingletonScope(),t(Kb).toService(Ub))}));var Dk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Fk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jk=function(t,e){return function(i,s){e(i,s,t)}};let zk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=gu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};zk=Dk([La(),jk(0,Ba(dv)),Fk("design:paramtypes",[Object])],zk);let Hk=!1;const Vk=new ba(((t,e,i,s)=>{Hk||(Hk=!0,t(Wb).to(zk).inSingletonScope(),t(Kb).toService(Wb))}));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};let Gk=class{constructor(){this.type="image",this.numberType=hu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Gk=Nk([La()],Gk);let Wk=!1;const Uk=new ba(((t,e,i,s)=>{Wk||(Wk=!0,t(Fb).to(Gk).inSingletonScope(),t(Kb).toService(Fb))})),Yk=X_();function Kk(){Kk.__loaded||(Kk.__loaded=!0,um.RegisterGraphicCreator("arc",Kg),$l.load(yy),$l.load(Yk?RA:Hx))}Kk.__loaded=!1;const Xk=Kk;function $k(){$k.__loaded||($k.__loaded=!0,um.RegisterGraphicCreator("area",Wg),$l.load(My),$l.load(Yk?QA:Yx))}$k.__loaded=!1;const qk=$k;function Zk(){Zk.__loaded||(Zk.__loaded=!0,um.RegisterGraphicCreator("circle",op),$l.load(Ey),$l.load(Yk?dk:Jx))}Zk.__loaded=!1;const Jk=Zk;function Qk(){Qk.__loaded||(Qk.__loaded=!0,um.RegisterGraphicCreator("glyph",wg),$l.load(zy),$l.load(Yk?Ik:nS))}Qk.__loaded=!1;const tM=Qk;function eM(){eM.__loaded||(eM.__loaded=!0,um.RegisterGraphicCreator("group",Au))}eM.__loaded=!1;const iM=eM;function sM(){sM.__loaded||(sM.__loaded=!0,um.RegisterGraphicCreator("image",Rg),$l.load(Yy),$l.load(Yk?Uk:lS))}sM.__loaded=!1;const nM=sM;function rM(){rM.__loaded||(rM.__loaded=!0,um.RegisterGraphicCreator("line",Sg),$l.load(Ay),$l.load(Yk?KA:gS))}rM.__loaded=!1;const aM=rM;function oM(){oM.__loaded||(oM.__loaded=!0,um.RegisterGraphicCreator("path",Vg),$l.load(Ly),$l.load(Yk?Ak:TS))}oM.__loaded=!1;const lM=oM;function hM(){hM.__loaded||(hM.__loaded=!0,um.RegisterGraphicCreator("polygon",qg),$l.load(Iy),$l.load(Yk?Ek:bS))}hM.__loaded=!1;const cM=hM;function dM(){dM.__loaded||(dM.__loaded=!0,um.RegisterGraphicCreator("rect",Mg),$l.load(xy),$l.load(Yk?zA:LS))}dM.__loaded=!1;const uM=dM;function pM(){pM.__loaded||(pM.__loaded=!0,um.RegisterGraphicCreator("richtext",jg),$l.load(Wy),$l.load(Yk?Vk:IS))}pM.__loaded=!1;const gM=pM;function mM(){mM.__loaded||(mM.__loaded=!0,um.RegisterGraphicCreator("shadowRoot",Jg))}mM.__loaded=!1;const fM=mM;function vM(){vM.__loaded||(vM.__loaded=!0,um.RegisterGraphicCreator("symbol",yg),$l.load(wy),$l.load(Yk?rk:VS))}vM.__loaded=!1;const _M=vM;function yM(){yM.__loaded||(yM.__loaded=!0,um.RegisterGraphicCreator("text",gp),$l.load(By),$l.load(Yk?vk:US))}yM.__loaded=!1;const bM=yM;function xM(){iM(),uM()}const SM=-.5*Math.PI,AM=1.5*Math.PI,kM="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 MM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(MM||(MM={}));const TM={[MM.selectedReverse]:{},[MM.selected]:{},[MM.hover]:{},[MM.hoverReverse]:{}},wM={container:"",width:30,height:30,style:{}},CM={debounce:bt,throttle:xt};xM();let EM=class t extends xb{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"===E_.env?(E_.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),E_.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:CM[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"===E_.env?(E_.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),E_.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",CM[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 PM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&PM(t,e)}))}EM.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 BM=t=>!u(t)&&!1!==t.visible;function RM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function LM(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 IM=["#ffffff","#000000"];function DM(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 FM(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(...IM);for(const n of a)if(t!==n&&FM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function FM(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?jM(t,e)>s:"largeText"===i?jM(t,e)>3:jM(t,e)>4.5}function jM(t,e){const i=zM(t),s=zM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function zM(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 HM(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 VM(t,e){return[t[0]*e,t[1]*e]}function NM(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 GM=(t,e,i,s)=>new Je(Object.assign({defaultFontParams:Object.assign({fontFamily:kM,fontSize:14},s),getTextBounds:i?void 0:mm,specialCharSet:"-/: .,@%'\"~"+Je.ALPHABET_CHAR_SET+Je.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function WM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const s=mm({text:t,fontFamily:e.fontFamily||i.fontFamily||kM,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 UM(t){return"rich"===YM(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type")}function YM(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 KM(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 XM(t){const e=YM(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?um.richtext(KM(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)),um.text(t))}function $M(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 ZM(){iM(),uM(),_M(),gM(),bM()}var JM=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);nh&&(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,V=JM(a,["visible"]);if(m&&c(H)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},V),{visible:H&&!!s,x:I,y:D,width:k,height:M}),"rect");B(null==f?void 0:f.panel)||(t.states=f.panel),this._bgRect=t}}this._textShape=P}}QM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const tT={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}},eT={poptip:z({},tT)};var iT=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]]}}}}nT.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 rT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 aT=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,nT.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new nT(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,eT.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}))}};aT=rT([La()],aT);var oT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 lT=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)}};lT=oT([La()],lT);let hT=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)}};hT=oT([La()],hT);const cT=new ba(((t,e,i,s)=>{i(aT)||(t(aT).toSelf().inSingletonScope(),t(np).toService(aT)),i(lT)||(t(lT).toSelf(),t(Hv).toService(lT)),i(hT)||(t(hT).toSelf(),t(Hv).toService(hT))}));class dT extends xb{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}iM(),aM();class uT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},uT.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})}}uT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},iM(),uM();class pT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},pT.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})}}pT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},iM(),Xk();class gT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},gT.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)}}gT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},iM(),Xk();class mT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},mT.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=SM,endAngle:s=AM}=this.attribute,n=s-i,r=te(se(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}mT.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},iM(),lM();class fT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fT.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)}}fT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const vT=new Uint32Array(33),_T=new Uint32Array(33);_T[0]=0,vT[0]=~_T[0];for(let t=1;t<=32;++t)_T[t]=_T[t-1]<<1|1,vT[t]=~_T[t];function yT(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]&vT[31&l]&_T[1+(31&h)])return!0}else{if(i[c]&vT[31&l])return!0;if(i[d]&_T[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,vT[31&n]&_T[1+(31&r)]);else for(s(a,vT[31&n]),s(o,_T[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,_T[31&i]|vT[1+(31&s)]);else for(n(r,_T[31&i]),n(a,vT[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 bT(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 xT(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=bT(t,r),!(s&&e.outOfBounds(r)||e.getRange(r))}function ST(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 ST(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 ST(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 ST(t,e,n,s,h,c)}return!1}const kT=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],MT=["top","inside-top","inside"];function TT(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 wT={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 CT(t,e){var i,s;return null!==(s=null===(i=wT[e])||void 0===i?void 0:i.call(wT,t))&&void 0!==s?s:{from:{},to:{}}}const ET=(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 PT(t,e,i,s){t.attribute.text!==e.attribute.text&&k(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new Fc({text:t.attribute.text},{text:e.attribute.text},i,s))}const BT={mode:"same-time",duration:300,easing:"linear"};function RT(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 LT(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 OT(t){return 3===t||4===t}function IT(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 DT=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)}},FT=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 jT(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 zT(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)}}iM(),bM(),gM(),aM();class HT extends xb{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},HT.defaultAttributes,t)),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(MM.hover,!0),PM(this,(t=>{t===e||B(t.states)||t.addState(MM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(PM(this,(t=>{B(t.states)||(t.removeState(MM.hoverReverse),t.removeState(MM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void PM(this,(t=>{B(t.states)||(t.removeState(MM.selectedReverse),t.removeState(MM.selected))}));B(e.states)||(e.addState(MM.selected,!0),PM(this,(t=>{t===e||B(t.states)||t.addState(MM.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:[];(this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)]).forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(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[zT(g,m,c,d,a,o),zT(-g,-m,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds);if(i){const t=um.line({points:i});return e&&e.attribute.fill&&t.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&t.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(t),t}}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)),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 XM(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&&y.setRange(bT(v,t.AABBBounds,!0))}))),m.length>0&&m.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&&y.setRange(bT(v,t.AABBBounds,!0))})):t.AABBBounds&&y.setRange(bT(v,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 i=new Map,s=this._graphicToText||new Map,n=[],r=[],{visible:a}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{const o=this.getRelatedGraphic(t.attribute),l=t.attribute.id,h=this._isCollectionBase?l:o,c=(null==s?void 0:s.get(h))?"update":"enter";let d;if(a&&(d=this._createLabelLine(t,o)),"enter"===c){if(n.push(t),i.set(h,d?{text:t,labelLine:d}:{text:t}),o){const{from:i,to:s}=CT(t.attribute,"fadeIn");this.add(t),d&&(r.push(d),this.add(d)),this._syncStateWithRelatedGraphic(o),this._animationConfig.enter.duration>0&&o.once("animate-bind",(a=>{t.setAttributes(i),d&&d.setAttributes(i);const l=this._afterRelatedGraphicAttributeUpdate(t,n,d,r,e,o,s,this._animationConfig.enter);o.on("afterAttributeUpdate",l)}))}}else if("update"===c){const e=s.get(h);s.delete(h),i.set(h,e);const n=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&&PT(t,e,s,n))}i.forEach(((i,s)=>{const{duration:n,easing:r,increaseEffect:a=!0,channel:o}=i,{from:l,to:h}=ET(t,e,o,i.options);B(h)||t.animate().to(h,n,r),"text"in l&&"text"in h&&a&&PT(t,e,n,r)}))})(n,t,this._animationConfig.update),e.labelLine&&d&&e.labelLine.animate().to(d.attribute,r,a)}})),s.forEach((t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(CT(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=i}_renderWithOutAnimation(t){var e;const i=new Map,s=this._graphicToText||new Map,{visible:n}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach((t=>{const e=this.getRelatedGraphic(t.attribute),r=(null==s?void 0:s.get(e))?"update":"enter",a=this._isCollectionBase?t.attribute.id:e;let o;if(n&&(o=this._createLabelLine(t,e)),"enter"===r)i.set(a,o?{text:t,labelLine:o}:{text:t}),this.add(t),o&&this.add(o),this._syncStateWithRelatedGraphic(e);else if("update"===r){const e=s.get(a);s.delete(a),i.set(a,e),e.text.setAttributes(t.attribute),e.labelLine&&o&&e.labelLine.setAttributes(o.attribute)}})),s.forEach((t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)})),this._graphicToText=i}_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)}}VT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};class NT extends HT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},NT.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}}}NT.tag="rect-label",NT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};let GT=class t extends HT{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 jT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};GT.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};class WT{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 UT extends HT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UT.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:"…"}),n=this._createLabelText(s),r=this.getGraphicBounds(n),a=r.x2-r.x1,o=e.map((t=>t.attribute)),l=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),o,i,a);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=LT(l.endAngle-d/2),p=RT(h.x,h.y,l.outerRadius,o),g=RT(h.x,h.y,a+e.line.line1MinLength,o),m=new WT(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);m.pointA=RT(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):OT(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=RT(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=OT(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=OT(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=OT(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?OT(t.quadrant)?"left":"right":OT(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*(OT(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;e1&&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 jT(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 extends HT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},KT.defaultAttributes,t)),this.name="line-data-label"}labeling(t,e){return DT(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}KT.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const XT={rect:NT,symbol:VT,arc:UT,line:GT,area:YT,"line-data":KT};class $T extends xb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},$T.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=yT(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(){iM(),aM(),cM(),_M()}function ZT(){iM(),aM(),Xk(),_M()}$T.defaultAttributes={pickable:!1},qT();class JT extends xb{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({},JT.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=um.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=um.line;Y(i)[0].cornerRadius&&(t=um.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=um.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}}JT.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}}},ZT();class QT extends JT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JT.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=um.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 tw,ew;!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"}(tw||(tw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(ew||(ew={}));const iw={[ew.selectedReverse]:{},[ew.selected]:{},[ew.hover]:{},[ew.hoverReverse]:{}},sw={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}}},nw=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 rw(t,e,i){return!gt(t,e,0,1e-6)&&!pt(t,i,0,1e-6)}function aw(t,e,i,s){const n=mm(Object.assign({text:i},s)),r=n.width(),a=n.height(),o=nw(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=rw(o,-l,-h)?((o+l)/c-.5)*r:rw(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=rw(o,-l,-h)?.5*-a:rw(o,h,l)?.5*a:Math.cos(o)>=0?(.5-(h-o)/c)*a:(.5-nw(o-l)/c)*a,{x:p,y:g-m}}function ow(t){const e={};return PM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function lw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function hw(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 VM(r,(s?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}const cw=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!B(s.states)?(s.addState(MM.hover,!0),PM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(MM.hoverReverse,!0)})),s):i},dw=(t,e,i)=>i?(PM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(MM.hoverReverse),t.removeState(MM.hover))})),null):i,uw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(MM.selected)?(PM(e,(t=>{t.name&&!B(t.states)&&(t.removeState(MM.selectedReverse),t.removeState(MM.selected))})),null):s.name&&!B(s.states)?(s.addState(MM.selected,!0),PM(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(MM.selectedReverse,!0)})),s):i};class pw extends xb{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=cw(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=dw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=uw(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=um.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&&ow(this._innerView),this.removeAllChild(!0),this._innerView=um.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=um.group({x:0,y:0,zIndex:1});if(a.name=tw.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=um.group({x:0,y:0,pickable:!1});t.name=tw.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=um.group({x:0,y:0,pickable:!1});i.name=tw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=um.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=tw.tick,r.id=this._getNodeId(t.id),B(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=TM;else{const t=this.data[s],e=z({},TM,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=um.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=tw.subTick,r.id=this._getNodeId(`${n}`),B(s.state))r.states=TM;else{const i=z({},TM,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=um.group({x:0,y:0,pickable:!1});return r.name=`${tw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=XM(this._getLabelAttribute(t,e,n,i));if(a.name=tw.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=TM;else{const s=z({},TM,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 QM(Object.assign({},e));i.name=tw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return lw(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({},sw.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 gw(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 mw(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 fw={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&&vw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function vw(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 _w(t,e){for(let i,s=1,n=t.length,r=t[0];s1&&e.height()>1}function bw(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Aw(t,e.attribute.angle)),{angle:Sw(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({},kw(t,e.attribute.angle)),{angle:Sw(e.attribute.angle)}))}))}(t,e),gw(e)}function Sw(){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 Aw(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=Sw(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 kw(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=Sw(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 Mw{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 VM([s[1],-1*s[0]],t*(e?1:-1)*i)}}function Tw(){iM(),aM(),gM(),bM()}var ww=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=NM(_,[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({},iw,c.text),shape:z({},iw,c.shape),panel:z({},iw,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 Aw(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return kw(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)})),xw(i,t),!bw(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(yw);if(B(i))return;let s;s=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i),gw(s);const{method:n="parity",separation:r=0}=e,a=d(n)?n:fw[n]||fw.parity;if(s.length>=3&&_w(s,r)){do{s=a(s,r)}while(s.length>=3&&_w(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&&vw(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=um.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=tw.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=WM(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}}Cw.defaultAttributes=sw,U(Cw,Mw);class Ew{isInValidValue(t){const{startAngle:e=SM,endAngle:i=AM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=SM,endAngle:i=AM,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 hw(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 Pw,Bw=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=um.circle(c);d.name=tw.line,d.id=this._getNodeId("line"),B(a.state)||(d.states=z({},iw,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=Bw(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({},iw,d.text),shape:z({},iw,d.shape),panel:z({},iw,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 aw(t,e,i,s)}}Rw.defaultAttributes=sw,U(Rw,Ew);class Lw extends gc{constructor(){super(...arguments),this.mode=Ao.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},PM(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{Iw[t]=!0}));const Hw=t=>-Math.log(-t),Vw=t=>-Math.exp(-t),Nw=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,Gw=t=>10===t?Nw:t===Math.E?Math.exp:e=>Math.pow(t,e),Ww=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Uw=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),Yw=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function Kw(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 Xw(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function $w(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),$w(t,i,s)*(e/(1-i))}function Zw(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function Jw(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 eC{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=Zw(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 iC=Symbol("implicit");class sC extends eC{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=Pw.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=iC}clone(){const t=(new sC).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!==iC)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 rC extends sC{constructor(t){super(),this.type=Pw.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:nC(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 nC(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 rC(!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:aC}=be;function oC(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=aC(ve.parseColorString(t),s);return t=>e(t).formatRgb()}return St(Number(t),Number(e))}return e instanceof _e?aC(t,e):e instanceof ve?aC(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 lC extends eC{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:zw,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zw;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=zw,this._piecewise=Xw,this._interpolate=oC}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?Jw:Xw,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:zw),this.rescale(i)):this._clamp!==zw}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 hC=Math.sqrt(50),cC=Math.sqrt(10),dC=Math.sqrt(2),uC=[1,2,5,10],pC=(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=vC(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?mC(0,-(e-1)/s,s):mC((e-1)/s,0,s)},gC=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 pC(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return pC(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=mC(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=mC(t,e,l);return n&&r.reverse(),r})),vC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=uC[0];return i>=hC?s=uC[3]:i>=cC?s=uC[2]:i>=dC&&(s=uC[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function _C(t,e,i){const s=(e-t)/Math.max(0,i);return vC(s)}function yC(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=_C(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 xC(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 SC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),AC=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})),kC=mt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=fC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?SC(t,e,n):SC(t,e,tC(n)),h=SC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),MC=mt(((t,e,i,s,n)=>yC(s(t),s(e),i).map((t=>tC(n(t))))));class TC extends lC{constructor(){super(...arguments),this.type=Pw.Linear}clone(){return(new TC).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 gC(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=fC(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 yC(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=xC(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=bC(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=bC(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=bC(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function wC(t){return e=>-t(-e)}function CC(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class EC extends lC{constructor(){super(Ww(10),Gw(10)),this.type=Pw.Log,this._limit=CC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new EC).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=Ww(this._base),s=Gw(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=wC(i),this._pows=wC(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=Hw,this.untransformer=Vw):(this._logs=i,this._pows=s,this._limit=CC(),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 zw}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 AC(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 kC(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 MC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return MC(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=xC(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=Qw(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 PC extends TC{constructor(){super(Uw(1),Yw(1)),this.type=Pw.Symlog,this._const=1}clone(){return(new PC).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=Uw(t),this.untransformer=Yw(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 AC(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 kC(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 MC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return MC(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=xC(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=Qw(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 BC{constructor(){this.type=Pw.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 BC).domain(this._domain).range(this._range).unknown(this._unknown)}}const RC=t=>t.map(((t,e)=>({index:e,value:t}))),LC=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 OC(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function IC(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=GM(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=DC(S,y,m[0],m[m.length-1]):a&&c&&s===e.length-1?T=DC(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=DC(A,b,m[0],m[m.length-1]):a&&d&&s===e.length-1?w=DC(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},jC=(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=GM(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=lw(o,hw(s,o,e,n));return aw(l,hw(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},zC={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&OC(i.AABBBounds,t.AABBBounds,e)||(i=t,0))))}},HC=(t,e,i,s)=>FC(t,e,i).map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),VC=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},NC=(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&&!VC(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?NC(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&&LC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},UC=(t,e)=>{if(Dw(t.type))return((t,e)=>{if(!Dw(t.type))return RC(t.domain());const i=t.range(),s=Math.abs(i[i.length-1]-i[0]);if(s<2)return RC([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=FC(t,h,e).map(((t,e)=>({AABBBounds:t,value:h[e]})));for(;n.length>=3&&IC(n,i);)n=zC.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 RC(h)})(t,e);if(jw(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?RC([s[s.length-1]]):RC([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=HC(t,s,e,c),l=Math.min(...n.map((t=>t[2]))),h=GC(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=HC(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 RC(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=jC(t,i,e),r=$(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=WC(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 RC(c)})(t,e)}return RC(t.domain())};function YC(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 KC(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 XC(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=YC(t,!!n),o=YC(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=KC(e,t,!1,!!n),o=KC(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=YC(t,!!n),o=YC(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class $C extends xb{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&ow(this._innerView),this.removeAllChild(!0),this._innerView=um.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 lw(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?`${tw.grid}-sub`:`${tw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=YC(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=KC(t,o,!1,!!a)}const u=um.path(Object.assign({path:c,z:l},d(r)?z({},this.skipDefault?null:$C.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=YC(o,!!a),f=Rt(o[0].x-o[1].x),v=Rt(o[0].y-o[1].y),_=um.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:$C.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,Mw);var ZC=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(JC,Ew);const QC="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",tE={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:QC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:QC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},eE={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 iE;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(iE||(iE={}));var sE=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=iE.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=iE.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=iE.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=iE.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=iE.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t),"browser"===E_.env&&(E_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),E_.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===iE.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===iE.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=iE.endHandler):h+=l:this._activeTag===iE.endHandler&&(c+l{t.preventDefault();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===iE.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"===E_.env&&(E_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),E_.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===iE.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===iE.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=sE(i,["formatMethod"]),{formatMethod:a}=s,o=sE(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:V={},brushSelect:N,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=V.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:N?"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),N&&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:N?"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:N?"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"},eE.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=V.symbolType)&&void 0!==y?y:"square"},eE.horizontal),V),{pickable:!G&&(null===(b=V.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},eE.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},eE.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"},eE.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=V.symbolType)&&void 0!==R?R:"square"},eE.vertical),V),{pickable:!G&&(null===(L=V.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},eE.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},eE.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 vy(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 QM(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 aE,oE,lE,hE;function cE(){iM(),ZM()}function dE(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 uE(t,e){const{dx:i,dy:s}=dE(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}rE.defaultAttributes=tE,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"}(aE||(aE={})),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"}(oE||(oE={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(lE||(lE={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(hE||(hE={}));class pE extends xb{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=cw(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=dw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=uw(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=um.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=um.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=um.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 gE(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 mE(t,e,i,s){t&&(gE(t.startSymbol,e,i,s),t.lines.forEach((t=>gE(t,e,i,s))),gE(t.line,e,i,s),gE(t.endSymbol,e,i,s))}function fE(t,e,i,s){t&&(gE(t.getTextShape(),e,i,s),gE(t.getBgRect(),e,i,s))}function vE(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 _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,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;gE(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)})),gE(t.endSymbol,s+r+a,o,n),gE(e.getTextShape(),s+r+a+o,l,n),gE(e.getBgRect(),s+r+a+o,l,n)}function xE(t,e,i,s,n){mE(t,s,i,n),fE(e,s,i,n)}function SE(t,e,i,s,n){gE(t,s,i,n),fE(e,s,i,n)}function AE(t,e,i,s,n){gE(t,s,i,n),fE(e,s,i,n)}function kE(t,e,i,s,n,r){var a;mE(t,n,s,r),gE(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?fE(i,n,s,r):gE(i,n,s,r)}function ME(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;gE(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)})),gE(e,n+o+l,h,r),gE(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(gE(i.getTextShape(),n+o+l+h+c,d,r),gE(i.getBgRect(),n+o+l+c,d,r)):gE(i,n+o+l+c,d,r)}function TE(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?bE(t,e,s,r,a):"fadeIn"===i&&xE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?bE(t,e,s,n,a):"fadeIn"===i&&xE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){_E(t,s,i,n),yE(e,s,i,n)}(t,e,i,s,n)}}function wE(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&&SE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&SE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){vE(t,s,i,n),yE(e,s,i,n)}(t,e,i,s,n)}}function CE(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&&AE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&AE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){vE(t,s,i,n),yE(e,s,i,n)}(t,e,i,s,n)}}function EE(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?kE(n,r,e,i,s,o):"callIn"===t&&ME(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?kE(n,r,e,i,s,a):"callIn"===t&&ME(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;_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)}(n,r,e,t,i,s)}}const PE={type:"clipIn",duration:500,easing:"linear",delay:0},BE={type:"fadeIn",duration:500,easing:"linear",delay:0},RE={type:"callIn",duration:500,easing:"linear",delay:0},LE={type:"fadeOut",duration:500,easing:"linear",delay:0};class OE extends pE{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=PE,this.defaultExitAnimation=LE}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;uE(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 QM(Object.assign(Object.assign({},e),{state:{panel:z({},TM,null==i?void 0:i.labelBackground),text:z({},TM,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({},TM,null==e?void 0:e.labelBackground),text:z({},TM,null==e?void 0:e.label)}})),this.setLabelPos())}}const IE=.001,DE={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:aE.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]}},FE={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"}}},jE={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:lE.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]}},zE={interactive:!0,label:{position:oE.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}},HE={interactive:!0,label:{position:lE.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}},VE={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"}},NE={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"}},GE={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 WE(){UE._animate=TE}cE(),qT();class UE extends OE{markerAnimate(t){UE._animate&&this._animationConfig&&UE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UE.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(RM(t)?t:t-Math.PI)+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}getTextStyle(t,e,i){return LM(Math.abs(e),Math.PI/2,IE)||LM(Math.abs(e),3*Math.PI/2,IE)?OM(i,e,t):RM(e)?FE.postiveXAxis[t]:FE.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new JT({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},TM,null==a?void 0:a.line),startSymbol:z({},TM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},TM,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({},TM,null==a?void 0:a.line),startSymbol:z({},TM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},TM,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 YE(){KE._animate=wE}UE.defaultAttributes=DE,cE(),cM();class KE extends pE{markerAnimate(t){KE._animate&&this._animationConfig&&KE._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({},KE.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=BE,this.defaultExitAnimation=LE}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({},NE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;uE(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=um.polygon(Object.assign({points:e},s));r.states=z({},TM,null==n?void 0:n.area),r.name="mark-area-polygon",this._area=r,t.add(r);const a=new QM(Object.assign(Object.assign({},i),{state:{panel:z({},TM,null==n?void 0:n.labelBackground),text:z({},TM,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({},TM,null==s?void 0:s.area)),this._label&&this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},e),{state:{panel:z({},TM,null==s?void 0:s.labelBackground),text:z({},TM,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}}KE.defaultAttributes=zE,cE(),ZT();class XE extends OE{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,{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 lE.arcInnerStart:l=s;case lE.arcOuterStart:l=s;break;case lE.arcInnerEnd:l=n;case lE.arcOuterEnd:l=n;break;case lE.center:case lE.arcInnerMiddle:case lE.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 VE[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 QT({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},TM,null==o?void 0:o.line),startSymbol:z({},TM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},TM,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({},TM,null==o?void 0:o.line),startSymbol:z({},TM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},TM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}}XE.defaultAttributes=jE,cE(),Xk();class $E extends pE{markerAnimate(t){$E._animate&&this._animationConfig&&$E._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({},$E.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcArea",this.defaultUpdateAnimation=BE,this.defaultExitAnimation=LE}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 lE.center:h=(i+s)/2,c=(n+r)/2;break;case lE.arcInnerStart:h=i,c=n;break;case lE.arcOuterStart:h=s,c=n;break;case lE.arcInnerEnd:h=i,c=r;break;case lE.arcOuterEnd:h=s,c=r;break;case lE.arcInnerMiddle:h=i,c=(n+r)/2;break;case lE.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({},VE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;uE(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=um.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));h.states=z({},TM,null==l?void 0:l.area),h.name="polar-mark-area-area",this._area=h,t.add(h);const c=new QM(Object.assign(Object.assign({},o),{state:{panel:z({},TM,null==l?void 0:l.labelBackground),text:z({},TM,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({},TM,null==o?void 0:o.area)),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},a),{state:{panel:z({},TM,null==o?void 0:o.labelBackground),text:z({},TM,null==o?void 0:o.label)}})),this.setLabelPos())}isValidPoints(){return!0}}function qE(){ZE._animate=EE}$E.defaultAttributes=HE,cE(),qT(),ZT(),_M(),nM(),aM();class ZE extends pE{markerAnimate(t){ZE._animate&&this._animationConfig&&ZE._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ZE.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=RE,this.defaultExitAnimation=LE,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return LM(Math.abs(s),Math.PI/2,IE)||LM(Math.abs(s),3*Math.PI/2,IE)?OM(t,s,n):RM(s)?GE.postiveXAxis[n]:GE.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=hE.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({},TM,null==m?void 0:m.textBackground),text:z({},TM,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({},TM,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({},TM,null==m?void 0:m.image));const y=RM(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=um.symbol(Object.assign(Object.assign({},i),r)),h.states=z({},TM,null==s?void 0:s.symbol)):"text"===n?h=new QM(Object.assign(Object.assign({},i),{state:{panel:z({},TM,null==s?void 0:s.textBackground),text:z({},TM,null==s?void 0:s.text)}})):"richText"===n?(h=um.richtext(Object.assign(Object.assign({},i),a)),h.states=z({},TM,null==s?void 0:s.richText)):"image"===n?(h=um.image(Object.assign(Object.assign({},i),o)),h.states=z({},TM,null==s?void 0:s.image)):"custom"===n&&l&&(h=l(),h.states=z({},TM,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=LM(c,0,IE)||LM(d,0,IE),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(aP.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(aP.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===aP.focus||"focus"===o){const s=a.hasState(nP.focus);a.toggleState(nP.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[nP.unSelected,nP.unSelectedHover,nP.focus],t),this._setLegendItemState(e,nP.selected,t)})):(this._setLegendItemState(a,nP.selected,t),this._removeLegendItemState(a,[nP.unSelected,nP.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[nP.selected,nP.selectedHover,nP.focus],t),this._setLegendItemState(e,nP.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(nP.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(nP.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(rP.legendItemClick,a,t);i?(this._removeLegendItemState(a,[nP.selected,nP.selectedHover],t),this._setLegendItemState(a,nP.unSelected,t)):(this._setLegendItemState(a,nP.selected,t),this._removeLegendItemState(a,[nP.unSelected,nP.unSelectedHover],t))}else this._setLegendItemState(a,nP.selected,t),this._removeLegendItemState(a,[nP.unSelected,nP.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[nP.selected,nP.selectedHover],t),this._setLegendItemState(e,nP.unSelected,t))}))}this._dispatchLegendEvent(rP.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,nP.selected),this._removeLegendItemState(e,[nP.unSelected,nP.unSelectedHover])):(this._removeLegendItemState(e,[nP.selected,nP.selectedHover]),this._setLegendItemState(e,nP.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=eP,spaceRow:h=iP}=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;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):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=um.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,aP.item,t,w)):(w=um.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,aP.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?nP.selected:nP.unSelected);const C=um.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=um.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,aP.itemShape,t,w,S.state),s.addState(e?nP.selected:nP.unSelected),C.add(s)}let O=0;if(d){const e=R(g,"size",10);E=um.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},g),{visible:!0,pickMode:"imprecise",boundsPadding:T})),this._appendDataToShape(E,aP.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=XM(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,aP.itemLabel,t,w,A.state),D.addState(e?nP.selected:nP.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=XM(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,aP.itemValue,t,w,k.state),r.addState(e?nP.selected:nP.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(),V=p(this.attribute.item.width)?this.attribute.item.width:z+T[1]+T[3],N=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=V,w.attribute.height=N,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 tP(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 tP(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 EM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:12},t),{width:e})):new EM(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=um.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=eP,spaceRow:a=iP}=s,o=this._itemsContainer,{space:l=sP,defaultCurrent:h=1}=n,c=cP(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 _=um.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(nP.selected)?this._setLegendItemState(t,nP.selectedHover,e):this._setLegendItemState(t,nP.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===aP.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(rP.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(nP.unSelectedHover)||t.hasState(nP.selectedHover))&&(i=!0),t.removeState(nP.unSelectedHover),t.removeState(nP.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(nP.unSelectedHover)&&!t.hasState(nP.selectedHover)||(i=!0),t.removeState(nP.unSelectedHover),t.removeState(nP.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===aP.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(rP.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(rP.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!==aP.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(rP.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!==aP.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(rP.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(nP.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({},dP,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(nP.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 pP;function gP(t){return y(t)?t:[t,t]}function mP(t){return t?"ew-resize":"ns-resize"}uP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:eP,spaceRow:iP,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:sP,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"}(pP||(pP={})),lP();class fP extends xb{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({},fP.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"===E_.env?(E_.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),E_.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"===E_.env?(E_.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),E_.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"===E_.env?(E_.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),E_.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"===E_.env?(E_.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),E_.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:gP(d)[0],endValue:gP(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const m=um.group({x:0,y:0});m.name=pP.innerView,this.add(m),this._innerView=m;let f,v=0;if(r&&r.visible){f=um.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=pP.startText,m.add(f);const e=p(r.space)?r.space:0;v+=(g?f.AABBBounds.width():f.AABBBounds.height())+e}const _=um.group({x:g?v:0,y:g?0:v});m.add(_);const y=um.group({x:0,y:0});let b;if(y.name=pP.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=um.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=pP.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=um.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=pP.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]=gP(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":mP(p)},r));if(v.name=pP.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=f,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=pP.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":mP(p)},r));if(i.name=pP.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(m,"end");e.name=pP.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=um.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=pP.trackContainer;const f=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===f?"pointer":mP(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=um.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=pP.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return um.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":mP(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),um.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=um.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=um.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===pP.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===pP.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===pP.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===pP.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}}}fP.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}}},hP(),lP();class vP extends oP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},vP.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 _P(){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`}vP.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"}}},hP(),lP(),lM();class yP extends oP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},yP.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=um.group({x:0,y:0});this._innerView.add(x);const S=new fP({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:_P(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=um.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))}}yP.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)"}},iM(),bM(),gM();let bP=class t extends xb{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,V,N,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},wM),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},wM),$),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!==(V=K.width)&&void 0!==V?V: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!==(N=$.width)&&void 0!==N?N: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"))}}}};bP.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 xP={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"}}};iM(),bM(),gM();let SP=class extends xb{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==e)return void(o&&o.hideAll());if(p(i))if(!1!==i.visible){const t=z({},R(xP,"title.style"),i.style);UM(t)?this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},KM(t)),{visible:i.visible,x:0,y:0}),"richtext"):this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},t),{lineHeight:p(t.lineHeight)?t.lineHeight:t.fontSize,visible:i.visible,x:0,y:0}),"text"),i.autoFit&&k(a)&&this._setLocalAutoFit(a,this._title,i),i.autoLimit&&k(r)&&this._title.setAttribute("maxLineWidth",a)}else{const t=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}if(p(s)){const t=Y(s),e=[];t.forEach(((t,s)=>{if(!1!==t.visible){const n=z({},R(xP,"content.style"),t.style);let l;l=UM(n)?o.createOrUpdateChild("indicator-content-"+s,Object.assign(Object.assign({},KM(n)),{visible:i.visible,x:0,y:0}),"richtext"):o.createOrUpdateChild("indicator-content-"+s,Object.assign(Object.assign({},n),{lineHeight:p(n.lineHeight)?n.lineHeight:n.fontSize,visible:t.visible,x:0,y:0}),"text"),t.autoFit&&k(a)&&this._setLocalAutoFit(a,l,t),t.autoLimit&&k(r)&&l.setAttribute("maxLineWidth",a),e.push(l)}else{const t=o.find((t=>t.name==="indicator-content-"+s),!1);t&&o.removeChild(t)}})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.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=WM(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 AP extends _g{constructor(t){super(t)}}var kP,MP;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(kP||(kP={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(MP||(MP={}));class TP extends xb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},TP.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"},TP.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"},TP.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},TP.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},TP.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 AP(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new AP(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new AP(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(kP.OnPlay)},this.pause=()=>{this._dispatchEvent(kP.OnPause)},this.forward=()=>{this._dispatchEvent(kP.OnForward)},this.backward=()=>{this._dispatchEvent(kP.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()}}TP.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},TP.defaultAttributes={[MP.Start]:{},[MP.Pause]:{},[MP.Backward]:{},[MP.Forward]:{}};const wP={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},CP=[200,10];var EP,PP;!function(t){t.Default="default",t.Reverse="reverse"}(EP||(EP={})),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"}(PP||(PP={}));const BP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===EP.Default&&s===i})({direction:e,maxIndex:i,dataIndex:n})||(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===EP.Reverse&&s===i})({direction:e,minIndex:s,dataIndex:n})},RP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===EP.Default&&s===i})({direction:e,minIndex:s,dataIndex:n})||(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===EP.Reverse&&s===i})({direction:e,maxIndex:i,dataIndex:n})},LP=t=>"top"===t||"bottom"===t;class OP extends xb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},OP.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(LP(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:CP[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:CP[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 fP(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 LP(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 TP(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=LP(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:CP[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?(LP(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:LP(this._orient)?t+s:(this._size.width-r)/2,y:LP(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:LP(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:LP(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:LP(this._orient)?t+s:(this._size.width-r)/2,y:LP(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 IP(){lP(),iM(),_M()}OP.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({},wP),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},wP),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},wP),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},wP),{key:"backward",position:"start"})}},IP();class DP extends OP{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:EP.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(kP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(kP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(kP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(kP.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(PP.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(BP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||RP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===EP.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(PP.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=E_.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(PP.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(PP.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=E_.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(),E_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(PP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,E_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(PP.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(PP.change),this.dispatchCustomEvent(PP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var FP,jP=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())}))};IP();class zP extends OP{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(kP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(kP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(kP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(kP.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(PP.change))},this.play=()=>jP(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(PP.play),this._rafId=E_.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=E_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,E_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(PP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,E_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(PP.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(PP.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(PP.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"}(FP||(FP={}));const HP={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}},VP=5;const NP={debounce:bt,throttle:xt};iM(),cM();let GP=class t extends xb{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:NP[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(FP.brushClear,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._container.incrementalClearChild(),this._brushMaskAABBBoundsDict={}):(this._activeDrawState&&this._dispatchEvent(FP.drawEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._activeMoveState&&this._dispatchEvent(FP.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=HP.trigger,updateTrigger:e=HP.updateTrigger,endTrigger:i=HP.endTrigger,resetTrigger:s=HP.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(FP.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(FP.moveStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_drawing(t){var e,i;const s=this.eventPosToStagePos(t),{sizeThreshold:n=VP,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(FP.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(FP.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=um.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)})},UP=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}},YP={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:kM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:kM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:kM,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},KP=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];iM(),uM(),_M(),bM(),gM();let XP=class t extends xb{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:BM(u)&&BM(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:BM(u)&&BM(u.value)},UP(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:BM(u)&&BM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:BM(u)&&BM(u.value)},UP(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},wM),u.value),visible:BM(u)&&BM(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=BM(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 _=BM(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(!BM(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)+(BM(n.key)?r+n.key.spacing:0)+(BM(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&&($M(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:BM(n.key)||"right"===c||(t="left"),m.setAttribute("textAlign",t),$M(c,m,t,u,a),m.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(BM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Dc(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(BM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},UP(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},UP(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},wM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(BM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},UP(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},UP(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=>KP.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)&&BM(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=BM(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=GM(u),y=GM(p);let b=0;if(BM(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(BM(p)){const{width:t,height:e}=y.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}f&&gg[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 WP({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return WP({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};XP.defaultAttributes=YP;const $P=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 ZP(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function JP(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function QP(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 tB(t,e){const i=QP(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 eB(t,e){const i=iB(t),s=iB(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 iB(t,e={x:0,y:0}){return $t.distancePP(t,e)}function sB(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 nB(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const rB=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var oB,lB;!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"}(oB||(oB={})),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.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(lB||(lB={}));const hB="__VCHART",cB=500,dB=500,uB=`${hB}_LABEL_LIMIT`,pB=`${hB}_LABEL_ALIGN`,gB=`${hB}_LABEL_TEXT`,mB=`${hB}_LABEL_VISIBLE`,fB=`${hB}_LABEL_X`,vB=`${hB}_LABEL_Y`,_B=`${hB}_ARC_TRANSFORM_VALUE`,yB=`${hB}_ARC_RATIO`,bB=`${hB}_ARC_START_ANGLE`,xB=`${hB}_ARC_END_ANGLE`,SB=`${hB}_ARC_K`,AB=`${hB}_ARC_MIDDLE_ANGLE`,kB=`${hB}_ARC_QUADRANT`,MB=`${hB}_ARC_RADIAN`,TB=-Math.PI/2,wB=3*Math.PI/2,CB=-90,EB=.6;var PB,BB,RB,LB,OB,IB,DB,FB,jB,zB,HB,VB,NB,GB,WB;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(PB||(PB={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(BB||(BB={})),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"}(RB||(RB={})),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"}(LB||(LB={})),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"}(OB||(OB={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(IB||(IB={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(DB||(DB={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(FB||(FB={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(jB||(jB={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(zB||(zB={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(HB||(HB={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(VB||(VB={})),t.VGRAMMAR_HOOK_EVENT=void 0,(NB=t.VGRAMMAR_HOOK_EVENT||(t.VGRAMMAR_HOOK_EVENT={})).BEFORE_EVALUATE_DATA="beforeEvaluateData",NB.AFTER_EVALUATE_DATA="afterEvaluateData",NB.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",NB.AFTER_EVALUATE_SCALE="afterEvaluateScale",NB.BEFORE_PARSE_VIEW="beforeParseView",NB.AFTER_PARSE_VIEW="afterParseView",NB.BEFORE_TRANSFORM="beforeTransform",NB.AFTER_TRANSFORM="afterTransform",NB.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",NB.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",NB.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",NB.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",NB.BEFORE_STAGE_RESIZE="beforeStageResize",NB.AFTER_STAGE_RESIZE="afterStageResize",NB.BEFORE_VRENDER_DRAW="beforeVRenderDraw",NB.AFTER_VRENDER_DRAW="afterVRenderDraw",NB.BEFORE_MARK_JOIN="beforeMarkJoin",NB.AFTER_MARK_JOIN="afterMarkJoin",NB.BEFORE_MARK_UPDATE="beforeMarkUpdate",NB.AFTER_MARK_UPDATE="afterMarkUpdate",NB.BEFORE_MARK_STATE="beforeMarkState",NB.AFTER_MARK_STATE="afterMarkState",NB.BEFORE_MARK_ENCODE="beforeMarkEncode",NB.AFTER_MARK_ENCODE="afterMarkEncode",NB.BEFORE_DO_LAYOUT="beforeDoLayout",NB.AFTER_DO_LAYOUT="afterDoLayout",NB.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",NB.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",NB.BEFORE_DO_RENDER="beforeDoRender",NB.AFTER_DO_RENDER="afterDoRender",NB.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",NB.AFTER_MARK_RENDER_END="afterMarkRenderEnd",NB.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",NB.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",NB.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",NB.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",NB.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",NB.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",NB.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",NB.BEFORE_ELEMENT_STATE="beforeElementState",NB.AFTER_ELEMENT_STATE="afterElementState",NB.BEFORE_ELEMENT_ENCODE="beforeElementEncode",NB.AFTER_ELEMENT_ENCODE="afterElementEncode",NB.ANIMATION_START="animationStart",NB.ANIMATION_END="animationEnd",NB.ELEMENT_ANIMATION_START="elementAnimationStart",NB.ELEMENT_ANIMATION_END="elementAnimationEnd",NB.ALL_ANIMATION_START="allAnimationStart",NB.ALL_ANIMATION_END="allAnimationEnd",function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(GB||(GB={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(WB||(WB={}));const UB="__vgrammar_scene_item__",YB=[RB.line,RB.area],KB=[RB.arc3d,RB.rect3d,RB.pyramid3d],XB="key",$B=[{}],qB=["key"],ZB=!0,JB=!0,QB=!1,tR=!0,eR="VGRAMMAR_IMMEDIATE_ANIMATION",iR=0,sR=1e3,nR=0,rR=0,aR=!1,oR=!1,lR="quintInOut",hR={stopWhenStateChange:!1,immediatelyApply:!0};function cR(t,e){return Y(t).reduce(((t,i)=>{const s=_(i)?e.getGrammarById(i):i;return s&&t.push(s),t}),[])}function dR(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 cR(t.dependency,e);var i;return[]}function uR(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function pR(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 gR(t,e){return mR(t)?t.output():e[t]}const mR=t=>t&&!u(t.grammarType),fR=t=>d(t)?t:e=>e[t];function vR(t){return!!(null==t?void 0:t.scale)}function _R(t){return!!(null==t?void 0:t.field)}function yR(t,e){if(!t)return[];let i=[];return t.scale&&(i=mR(t.scale)?[t.scale]:Y(e.getScaleById(t.scale))),i.concat(dR(t,e))}function bR(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 xR(t,e,i,s,n){i&&(uR(i)?e.forEach((e=>{const n=pR(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 RB.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case RB.group:case RB.rect:case RB.image:return["width","height","y1"].includes(e);case RB.path:case RB.shape:return["path","customPath"].includes(e);case RB.line:return"defined"===e;case RB.area:return["x1","y1","defined"].includes(e);case RB.rule:return["x1","y1"].includes(e);case RB.symbol:return"size"===e;case RB.polygon:return"points"===e;case RB.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(vR(l)){const t=gR(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?hb(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(_R(l)){const t=hb(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=pR(l,s,e.datum,t)}))})))}function SR(t,e,i,s){if(!t)return null;if(uR(t))return pR(t,s,e,i);const n={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(vR(h)){const t=gR(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?hb(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(_R(h)){const t=hb(h.field);n[r]=t(e)}else n[r]=pR(h,s,e,i)})),n}class AR{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 kR=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]}};kR._plotMarks={},kR._marks={},kR._components={},kR._graphicComponents={},kR._transforms={},kR._grammars={},kR._glyphs={},kR._animations={},kR._interactions={},kR._graphics={},kR.registerGlyph=(t,e,i,s,n)=>(kR._glyphs[t]=new AR(e,i,s,n),kR._glyphs[t]),kR.registerAnimationType=(t,e)=>{kR._animations[t]=e},kR.getAnimationType=t=>kR._animations[t],kR.registerInteraction=(t,e)=>{kR._interactions[t]=e},kR.registerGraphic=(t,e)=>{kR._graphics[t]=e},kR.getGraphicType=t=>kR._graphics[t],kR.createGraphic=(t,e)=>{const i=kR._graphics[t];return i?i(e):null};const MR=t=>!!RB[t];function TR(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var s;const n=kR.getGraphicType(e)?kR.createGraphic(e,i):kR.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 wR=t=>{t&&(t[UB]=null,t.release(),t.parent&&t.parent.removeChild(t))},CR=["fillOpacity"],ER=(t,e,i)=>{var s;return"fillOpacity"===e?(t.fillOpacity=null!==(s=i.fillOpacity)&&void 0!==s?s:1,["fillOpacity"]):[]};const PR={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"}],[RB.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"}],[RB.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"}],[RB.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 BR=(t,e,i,s)=>{const n={},r=e?Object.keys(e):[],a=_(t)?PR[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||(CR.includes(r)?ER(n,r,e):n[r]=e[r])}))}else r.forEach((t=>{CR.includes(t)?ER(n,t,e):n[t]=e[t]}));return n},RR=(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),LR=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],OR=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(LR);function IR(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)?OR:LR,r=[];let a=null;return t.forEach(((t,e)=>{a&&n.every((e=>RR(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=DR(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function DR(t){const e={};return t?(Object.keys(t).forEach((i=>{"x"!==i&&"y"!==i&&"x1"!==i&&"y1"!==i&&"defined"!==i&&"size"!==i&&"width"!==i&&"height"!==i&&"context"!==i&&(e[i]=t[i])})),e):e}let FR=class{constructor(t){this.data=null,this.states=[],this.diffState=BB.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:{}})));xR(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?BR(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[UB]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?BR(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t)))}updateGraphicItem(){if(!this.graphicItem)return;this.diffState===BB.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&&(wR(this.graphicItem),this.graphicItem[UB]=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=fR(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(pR(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===BB.unChange&&(this.diffState=BB.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&(this.mark.isCollectionMark()&&delete t.defined,Object.assign(e,t)),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==BB.enter&&this.diffState!==BB.update||!this.states.length||this.useStates(this.states),this.mark.markType===RB.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 hl))}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[PB.update],a=e[PB.enter],o=e[PB.exit],l=this.mark.isLargeMode()||n&&!this.mark.getSpec().enableSegments;this.diffState===BB.enter?(a&&xR(this,t,a,s,l),r&&xR(this,t,r,s,l)):this.diffState===BB.update?((n&&a||i)&&xR(this,t,a,s,l),r&&xR(this,t,r,s,l)):this.diffState===BB.exit&&o&&(i&&xR(this,t,a,s,l),xR(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)pb(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[RB.line,RB.area,RB.largeRects,RB.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(s=l.nextAttrs)||void 0===s?void 0:s.points)&&(!0===i||bR(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[PB.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=DR(h),e===RB.line||e===RB.area){const i=function(t,e,i,s){return t&&t.length&&(1!==t.length||e)?t.some((t=>bR(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===RB.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=IR(e.items,e.points,i);if(s)return void s.forEach((e=>{t.push(e)}))}const n=DR(e.items[0]);n.points=e.points,t.push(n)})),t}return s?IR(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=SR(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=IR(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t)}else h.points=i,h.segments=null}else e===RB.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===RB.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}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&&(wR(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 jR{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 zR=(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 HR extends jR{constructor(t,e){super(t,e),this.type=HR.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({},HR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=zR(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()}}HR.type="element-select",HR.defaultOptions={state:WB.selected,trigger:"click"};class VR extends jR{constructor(t,e){super(t,e),this.type=VR.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{this.reset(t.element)},this.options=Object.assign({},VR.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=zR(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 NR(t){if(t)return t.type===Pw.Band?t.bandwidth():t.type===Pw.Point?t.step():void 0}VR.type="element-highlight",VR.defaultOptions={highlightState:WB.highlight,blurState:WB.blur,trigger:"pointerover",triggerOff:"pointerout"};class GR{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 WR=()=>{U(HR,GR),kR.registerInteraction(HR.type,HR)},UR=()=>{U(VR,GR),kR.registerInteraction(VR.type,VR)},YR=(t,e)=>mR(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,KR=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,s)=>{const n=t[s];return i[s]=YR(n,e),i}),{}):t.map((t=>YR(t,e))):t;let XR=-1;class $R extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++XR}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(dR(this.spec[e],this.view)),this.spec[e]=t,this.attach(dR(t,this.view)),this.commit(),this}}const qR=(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=dR(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}},ZR=(t,e)=>{const i=kR.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(cR(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(y(e)){const s=e.map((e=>qR(t,e,i)));return{references:s.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:s.map((t=>t.value))}}return qR(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}},JR=(t,e)=>{if(null==t?void 0:t.length){const i=[];let s=[];return t.forEach((t=>{var n;const r=ZR(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},QR={csv:Ur,dsv:Wr,tsv:Yr,json:function(t){if(!_(t))return Y(t);try{return Y(JSON.parse(t))}catch(t){return[]}}};class tL extends $R{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||!QR[e.type])return Y(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return QR[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?dR(t.format,this.view)[0]:null;if(s&&e.push(s),t.values){const s=dR(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=dR(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=mR(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=JR(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=JR(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 eL="window",iL="view",sL={trap:!1},nL="width",rL="height",aL="viewWidth",oL="viewHeight",lL="padding",hL="viewBox",cL="autoFit";function dL(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 uL(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,dL(t,e,n,s)}class pL{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 dL(this.nodes,e,0,this.compare),uL(this.nodes,e,null,this.compare)}return this.nodes.push(t),dL(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)),dL(this.nodes,e,0,this.compare),uL(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,uL(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class gL{constructor(t){this.list=[],this.ids={},this.idFunc=t||cb}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 mL{constructor(){this.grammars=[],this.logger=rt.getInstance(),this._curRank=0,this._committed=new gL((t=>t.uid)),this._heap=new pL(((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 gL((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 fL=(t,e,i,s,n)=>{const r=t=>{if(n||!t||s&&!s(t)||i.call(null,t),t.markType===RB.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}n&&(!t||s&&!s(t)||i.call(null,t))};r(t)};class vL{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 Xd(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Ol.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 Z_(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 Xb(o)),null===(r=this._eventConfig)||void 0===r?void 0:r.gesture){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new Zb(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 _L(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 yL(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 bL(t,e,i,s,n){if(n===eL){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{yL(t,_L(t),!1)}))}));const e=_L(t);yL(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e}class xL extends $R{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?pR(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}},ML=(t,e)=>e&&e.debounce?bt(t,e.debounce):e&&e.throttle?xt(t,e.throttle):t;class TL extends FR{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 xR(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[UB]=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?BR(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);this.graphicItem||this.initGraphicItem(),this.diffState===BB.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==BB.enter&&this.diffState!==BB.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.diffState===BB.enter&&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=BR(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=PR[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===RB.shape&&(o.datum=d[0].datum)})),s}}_generateGlyphItems(t,e,i){const s=e.map((t=>Object.assign({},t,{nextAttrs:i})));return YB.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)pb(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[UB]=null})),this.glyphGraphicItems=null),super.release()}}const wL=t=>t.markType===RB.glyph?new TL(t):new FR(t);function CL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(XB,i?t.slice().sort(i):t.slice()),{keys:qB,data:s};const n=fR(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 EL{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?CL(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 PL=(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=bR(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=bR(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 BL=(t,e,i,s,n)=>d(i)?i(t.getDatum(),t,n):i;class RL extends gc{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 LL extends gc{getEndProps(){return this.to}onBind(){var t;const e=null!==(t=this.target.constructor.NOWORK_ANIMATE_ATTR)&&void 0!==t?t:Dd,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)}}fc.mode|=Ao.SET_ATTR_IMMEDIATELY;let OL=0;const IL=t=>!u(t)&&(t.prototype instanceof gc||"onBind"in t.prototype&&"onStart"in t.prototype&&"onEnd"in t.prototype&&"onUpdate"in t.prototype);class DL{constructor(t,e,i){this.id=OL++,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||!kR.getAnimationType(e.type))return null;const r=kR.getAnimationType(e.type)(t,n,i);return PL(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?BL(t,0,n[i].from,0,s):void 0,e.to[i]=l?BL(t,0,n[i].to,0,s):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),PL(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=IL(o);return u(o)||IL(o)?h?new o(r.from,r.to,a,t.easing,l):r.to?new LL(r.from,r.to,a,t.easing):void 0:new RL(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 Wc(a,e))}r>0&&t.wait(r)}}function FL(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(jL(i,t[i]))})),e}function jL(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:iR,totalTime:h.totalTime,oneByOne:null!==(i=h.oneByOne)&&void 0!==i?i:oR,loop:null!==(s=h.loop)&&void 0!==s?s:aR,controlOptions:z({},hR,null!==(n=h.controlOptions)&&void 0!==n?n:{}),timeSlices:[{duration:null!==(r=h.duration)&&void 0!==r?r:sR,delay:null!==(a=h.delay)&&void 0!==a?a:nR,delayAfter:null!==(o=h.delayAfter)&&void 0!==o?o:rR,effects:[{type:h.type,channel:h.channel,custom:h.custom,easing:null!==(l=h.easing)&&void 0!==l?l:lR,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:iR,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:oR,loop:null!==(d=t.loop)&&void 0!==d?d:aR,controlOptions:z({},hR,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:nR,delayAfter:null!==(i=t.delayAfter)&&void 0!==i?i:rR,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:lR,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 zL(t,e,i){return d(t)?t.call(null,e.getDatum(),e,i):t}class HL{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 VL{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=FL(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=FL(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!==BB.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 HL(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=jL(eR,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 HL(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===BB.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 DL(s,i,e);if(l.animate(n,r),!l.isAnimating)return;s.diffState===BB.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=pR(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,s,n){const r=[],a=zL(t.startTime,e,n),o=zL(t.totalTime,e,n),l=zL(t.oneByOne,e,n),h=zL(t.loop,e,n);let c=0;t.timeSlices.forEach((t=>{var i;const a=zL(t.delay,e,n),l=zL(t.delayAfter,e,n),h=null!==(i=zL(t.duration,e,n))&&void 0!==i?i:o/s,d=Y(t.effects).map((t=>Object.assign({},t,{customParameters:zL(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===BB.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===BB.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===eR,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===BB.exit&&0===o[BB.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 NL extends $R{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new VL(this,{}),this.differ=new EL([]),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===BB.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(e,i){var s;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===VB.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:$B,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===RB.group)return;const e=CL(null!=t?t:$B,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(BB.update,t,e,i)}encodeState(t,e,i,s){if(t===BB.enter&&(this._isReentered=!0),this.spec.encode[t]){const n=this.spec.encode[t];if(uR(n))this.detach(yR(n,this.view));else{const r=_(e);r&&s||!r&&i?(Object.keys(n).forEach((t=>{this.detach(yR(n[t],this.view))})),this.spec.encode[t]={}):r?this.detach(yR(n[e],this.view)):Object.keys(e).forEach((t=>{this.detach(yR(n[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),_(e)?(this.spec.encode[t][e]=i,this.attach(yR(i,this.view))):uR(e)?(this.spec.encode[t]=e,this.attach(yR(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(yR(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=JR(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=JR(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 YB.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!==BB.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===GB.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&&!uR(n)&&Object.keys(n).forEach((t=>{vR(n[t])&&(e[t]=gR(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];uR(s)||Object.keys(s).forEach((t=>{_R(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[UB];if((null==s?void 0:s.mark)===this){const i=bL(this.view,t,s,0,iL);this.emitGrammarEvent(e,i,s)}},this.initEvent()),this.animate||(this.animate=new VL(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=gR(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!==RB.group){if(!this.graphicItem){const t=TR(this,RB.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||KB.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||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==RB.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=fR(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:()=>XB),a=fR(null!==(n=this.spec.groupBy)&&void 0!==n?n:()=>XB),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===BB.enter))),c=[];this.differ.setCallback(((t,e,i)=>{const s=t;let n;if(u(e))n=this.elementMap.get(s),n&&(n.diffState=BB.exit);else if(u(i)){n=this.elementMap.has(s)?this.elementMap.get(s):wL(this),n.diffState===BB.exit&&(n.diffState=BB.enter,this.animate.getElementAnimators(n,BB.exit).forEach((t=>t.stop("start")))),n.diffState=BB.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=BB.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:$B;l||this.differ.setCurrentData(CL(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]=SR(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[PB.group],s);e.forEach((t=>{this.markType===RB.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._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:TR(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!==RB.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=fR(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:()=>XB),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=wL(this);e.diffState=BB.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=wL(this);i.diffState=BB.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!==RB.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=TR(this,RB.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!==BB.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:PR[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=BB.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&&wR(this.graphicItem),this.detachAll(),super.release()}}let GL=class extends NL{constructor(t,e){super(t,RB.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===RB.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 PR.rect}evaluateJoin(t){if(!this.elements.length){const t=wL(this);t.updateData(XB,$B,(()=>""),this.view),this.elements=[t],this.elementMap.set(XB,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 xR(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[PB.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:TR(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 WL(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 UL(t,e){return Math.min(t<0?t+e:t-1,e)}function YL(t,e,i){let s=UL(t,i),n=UL(e,i);if(k(t)||k(e)?k(t)?k(e)||(s=UL(Math.max(0,n-1),i)):n=UL(s+1,i):(s=1,n=2),s>n){const t=n;n=s,s=t}return{start:s,end:n}}const KL=(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=>WL(t,i))),u=l.map((t=>WL(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}=YL(e,i,r),{start:h,end:c}=YL(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()}))},XL={[LB.axis]:0,[LB.legend]:1,[LB.slider]:2,[LB.player]:3,[LB.datazoom]:4},$L=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=XL[t.componentType])&&void 0!==s?s:1/0},qL=(t,e,i,s)=>{const n=i.clone(),r=t.getSpec().layout,a=gb(r.maxChildWidth,n.width()),o=gb(r.maxChildHeight,n.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=kL(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&&d$L(t)-$L(e)));for(let t=0,e=f.length;t{null==t||t.forEach((t=>{var s;if(t.markType!==RB.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=qL(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(aL,o),i.updateSignal(oL,l),i.updateSignal(lL,h)}else qL(t,n,a,e);else"grid"===r.display&&KL(t,n,a);ZL(n,e,i)}}))};class JL extends NL{constructor(t,e,i){super(t,RB.glyph,i),this.glyphType=e,this.glyphMeta=kR.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(!kR.getGraphicType(RB.glyph))return;const s=kR.createGraphic(RB.glyph,i),n=e.getMarks(),r=Object.keys(n).map((t=>{if(kR.getGraphicType(n[t])){const e=kR.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 QL=Symbol.for("key");class tO{diffGrammar(t,e){return function(t,e,i){const s={enter:[],exit:[],update:[]},n=new EL(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(CL(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!==RB.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==RB.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=CL(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=CL(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=fR(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 EL(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(CL(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:QL})),r=CL(e,(t=>{var e;return null!==(e=s(t))&&void 0!==e?e:QL}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==QL){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=pR(i.animation.delay,n,o,l),d=pR(i.animation.duration,n,o,l),u=pR(i.animation.oneByOne,n,o,l),p=pR(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)?Md:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Td)(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);xd(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)?Md:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Td)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>vd(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>yd(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 bd({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:xc,null!==(l=i.easing)&&void 0!==l?l:Sc))}))}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 Sd({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:xc,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Sc))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):xd(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 eO{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 iO extends eO{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===RB.group&&s.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===RB.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=>{const s=t.mark;s.markType===RB.group&&s.includesChild(e,!1)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===RB.group&&e.includesChild(s,!1)&&(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 sO{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 nO extends NL{addGraphicItem(t,e){const i=t&&t.limitAttrs,s=TR(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?RB.richtext:RB.text,t);return super.addGraphicItem(t,e,s)}release(){super.release()}}nO.markType=RB.text;const rO={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)"}}},aO={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},oO=Object.assign({},rO);oO.axis=Object.assign({},oO.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),oO.circleAxis=Object.assign({},oO.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),oO.grid=Object.assign({},oO.grid,{style:{stroke:"#404349"}}),oO.circleGrid=Object.assign({},oO.circleGrid,{style:{stroke:"#404349"}}),oO.rectLabel=Object.assign({},oO.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),oO.lineLabel=Object.assign({},oO.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),oO.symbolLabel=Object.assign({},oO.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),oO.title=Object.assign({},oO.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const lO={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:aO,components:oO},hO={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:aO,components:rO};let cO=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")}};cO._themes=new Map,cO.registerTheme("default",hO),cO.registerTheme("dark",lO);class dO extends NL{constructor(t,e,i,s){super(t,RB.component,i),this._componentDatum={[XB]: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:kR.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,XB)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[XB]+=1}evaluateJoin(t){return this.spec.key=XB,t?(t[XB]=this._componentDatum[XB],this._componentDatum=t):this._componentDatum={[XB]:this._componentDatum[XB]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}class uO 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[UB],n=bL(0,t,s,0,iL);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(mR(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)):MR(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 xL(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 tL(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=kR.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=kR.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 RB.group:n=new GL(this,s);break;case RB.glyph:n=new JL(this,null==i?void 0:i.glyphType,s);break;case RB.component:n=kR.hasComponent(null==i?void 0:i.componentType)?kR.createComponent(null==i?void 0:i.componentType,this,s,null==i?void 0:i.mode):new dO(this,null==i?void 0:i.componentType,s,null==i?void 0:i.mode);break;case RB.text:n=new nO(this,t,s);break;default:n=kR.hasMark(t)?kR.createMark(t,this,s):new NL(this,t,s)}return this.grammars.record(n),this._dataflow.add(n),n}group(t){return this.mark(RB.group,t)}glyph(t,e){return this.mark(RB.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(RB.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(RB.component,t,{componentType:LB.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(RB.component,t,{componentType:LB.grid,mode:e})}legend(t){return this.mark(RB.component,t,{componentType:LB.legend})}slider(t){return this.mark(RB.component,t,{componentType:LB.slider})}label(t){return this.mark(RB.component,t,{componentType:LB.label})}datazoom(t){return this.mark(RB.component,t,{componentType:LB.datazoom})}player(t){return this.mark(RB.component,t,{componentType:LB.player})}title(t){return this.mark(RB.component,t,{componentType:LB.title})}scrollbar(t){return this.mark(RB.component,t,{componentType:LB.scrollbar})}customized(t,e){const i=kR.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&&AL.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&(wR(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_"+ ++SL;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(cO.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(nL,t.width),this.updateSignal(rL,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=kR.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=VB.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var s,n,r,a,o;return[{id:nL,value:null!==(s=t[nL])&&void 0!==s?s:0},{id:rL,value:null!==(n=t[rL])&&void 0!==n?n:0},{id:lL,value:kL(null!==(a=null!==(r=t[lL])&&void 0!==r?r:e[lL])&&void 0!==a?a:null==i?void 0:i.padding)},{id:aL,update:{callback:(t,e)=>{const i=kL(e[lL]);return e[nL]-i.left-i.right},dependency:[nL,lL]}},{id:oL,update:{callback:(t,e)=>{const i=kL(e[lL]);return e[rL]-i.top-i.bottom},dependency:[rL,lL]}},{id:hL,update:{callback:(t,e)=>{const i=kL(e[lL]);return(t||new Zt).setValue(i.left,i.top,i.left+e[aL],i.top+e[oL])},dependency:[aL,oL,lL]}},{id:cL,value:null!==(o=t[cL])&&void 0!==o?o:e[cL]}]})(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===RB.glyph?{glyphType:t.glyphType}:t.type===RB.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=cO.getTheme(t))&&void 0!==e?e:cO.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(nL);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(rL);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(aL);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(oL);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(lL);if(arguments.length){const i=kL(t);return this.updateSignal(e,i),i}return kL(e.output())}autoFit(t){const e=this.getSignalById(cL);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(hL);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=VB.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===RB.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var e;const i=this._options.doLayout||ZL;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=>{fL(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),fL(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=ZB,morph:o=JB,morphAll:l=QB,animation:h={},enableExitAnimation:c=tR}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:lR,delay:null!==(i=h.delay)&&void 0!==i?i:nR,duration:null!==(s=h.duration)&&void 0!==s?s:sR,oneByOne:null!==(n=h.oneByOne)&&void 0!==n?n:oR,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=VB.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=VB.reevaluate,this._dataflow.evaluate()),this._layoutState=VB.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=>!AL.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 fL(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(nL,t)),e!==this.height()&&(s=!0,this.updateSignal(rL,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]:iL;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):MR(t)?(i.markType=t,i.source=e):i.source=t===eL?eL: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=cR(l,this),v=ML(((t,e)=>{const s=c===iL&&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===eL&&(t=bL(0,t,e,0,eL));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===iL){if(function(t,e,i){const s=null==t?void 0:t[e];return!(!1===s||g(s)&&!s[i])}(this._eventConfig,iL,d))return this.addEventListener(d,v,sL),()=>{this.removeEventListener(d,v)}}else if(c===eL)return E_.addEventListener(d,v),this._eventListeners.push({type:d,source:E_,handler:v}),()=>{E_.removeEventListener(d,v);const t=this._eventListeners.findIndex((t=>t.type===d&&t.source===E_&&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=kR.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 vL(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e;this.grammars=new eO((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new iO((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 mL,this.animate=new sO(this),this._morph=new tO,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,[iL,eL]),e}(this._options.eventConfig),this._theme=this._options.disableTheme?null:cO.getDefaultTheme(),this.parseBuiltIn(),(e=this._options).mode&&E_.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=VB.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!==RB.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=E_.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&E_.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(),kR.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 pO=()=>{fM(),lM(),kR.registerGraphic(RB.path,Vg)},gO=()=>{fM(),uM(),kR.registerGraphic(RB.rect,Mg)},mO=()=>{fM(),aM(),kR.registerGraphic(RB.rule,Sg)},fO=()=>{fM(),_M(),kR.registerGraphic(RB.symbol,yg)},vO=()=>{fM(),bM(),gM(),kR.registerGraphic(RB.text,gp)},_O=()=>{fM(),tM(),kR.registerGraphic(RB.glyph,wg)},yO=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},bO=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},xO=(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(_b(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},SO=(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&&_b(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},AO=yO(xO),kO=bO(xO);const MO=(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(_b(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},TO=(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&&_b(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},wO=yO(MO),CO=bO(MO);const EO=(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`},PO=(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`},BO=(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)?PO:EO,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)}}:{}},RO=(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}},LO=(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})}},OO=(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 IO extends dO{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 DO=(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 FO extends IO{constructor(t,e,i){super(t,LB.axis,e),this.spec.componentType=LB.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=kR.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=SR(n,e,i,s);const h=pR(this.spec.inside,s,e,i),c=pR(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(DO(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=pR(this.spec.tickCount,s,e,i);switch(this._getAxisComponentType()){case IB.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 IB.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?IB.circleAxis:IB.lineAxis,this._axisComponentType}}FO.componentType=LB.axis;let jO=class extends dO{constructor(t,e){super(t,LB.label,e),this.spec.componentType=LB.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=pR(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=pR(s,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case RB.line:case RB.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case RB.rect:case RB.rect3d:case RB.interval:g=p.rectLabel;break;case RB.symbol:case RB.circle:case RB.cell:g=p.symbolLabel;break;case RB.arc:case RB.arc3d:g=p.arcLabel;break;case RB.polygon:case RB.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=SR(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=SR(i,t,e,d);m.push(z({},f,s))}));else{const t=SR(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}};jO.componentType=LB.label;const zO=()=>{kR.registerGraphicComponent(LB.label,(t=>new $T(t))),kR.registerComponent(LB.label,jO)};class HO extends IO{constructor(t,e,i){super(t,LB.grid,e),this.spec.componentType=LB.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=kR.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=SR(s,t,e,i);const d=pR(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 DB.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 DB.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=pR(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(DO(h,n,s,d,this.spec.layout,!0),c))}this._getGridComponentType()===DB.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=pR(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case DB.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 DB.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=DB.circleAxisGrid:this._gridComponentType=DB.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case IB.circleAxis:this._gridComponentType=DB.circleAxisGrid;break;case IB.lineAxis:default:this._gridComponentType=DB.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()?DB.lineAxisGrid:DB.circleAxisGrid:DB.lineAxisGrid}else this._gridComponentType=DB.lineAxisGrid;return this._gridComponentType}}HO.componentType=LB.grid;const VO=(t,e,i)=>e.filter((e=>t.callback(e,i))),NO=(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 GO(t){return t.reduce(((t,e)=>t+e),0)}const WO={min:$,max:X,average:function(t){return 0===t.length?0:GO(t)/t.length},sum:GO};function UO(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 YO(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 KO(t,e,i,s){return YO(t,e,i,"min",s)}function XO(t,e,i,s){return YO(t,e,i,"max",s)}function $O(t,e,i,s){return YO(t,e,i,"average",s)}function qO(t,e,i,s){return YO(t,e,i,"sum",s)}const ZO=(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=UO;if("min"===n?l=KO:"max"===n?l=XO:"average"===n?l=$O:"sum"===n&&(l=qO),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[]},JO="_mo_hide_";const QO=(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(JO)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(JO,!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(JO,!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},tI=()=>{kR.registerTransform("filter",{transform:VO,markPhase:"beforeJoin"},!0)},eI=()=>{kR.registerTransform("map",{transform:NO,markPhase:"beforeJoin"},!0)},iI=()=>{kR.registerTransform("sampling",{transform:ZO,markPhase:"afterEncode"},!0)},sI=()=>{kR.registerTransform("markoverlap",{transform:QO,markPhase:"afterEncode"},!0)},nI=(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}}},rI=(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}}},aI=(t,e,i)=>{var s,n,r,a;const o=null!==(s=t.getFinalGraphicAttributes())&&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}}},oI=(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}}},lI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("y",!1),i=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1),n=t.getGraphicAttribute("y",!1),r=t.getGraphicAttribute("y1",!1),a=t.getGraphicAttribute("height",!1),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}}}}},hI=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("y",!1),i=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("x",!1),i=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("x1",!1),n=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicAttribute("height",!1),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 cI=(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.getGraphicAttribute("x",!1),r=t.getGraphicAttribute("x1",!1),a=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);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 dI=(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.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);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.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);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 uI=(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.getGraphicAttribute("y",!1),r=t.getGraphicAttribute("y1",!1),a=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("y",!1),n=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);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 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.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);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.getGraphicAttribute("y",!1),n=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);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)},gI=(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.getFinalGraphicAttributes();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.getFinalGraphicAttributes();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)},mI=(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.getFinalGraphicAttributes();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)},fI=(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.getFinalGraphicAttributes(),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.getFinalGraphicAttributes();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)},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=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.getFinalGraphicAttributes();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)},_I=(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((()=>Object.assign(n)))},yI=(t,e,i)=>({from:{points:_I(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),bI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:_I(t,e)}}),xI=(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),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}})),SI=(t,e,i)=>({from:{points:xI(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),AI=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:xI(t,e,i)}}),kI=(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),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,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)=>{var s,n;const{offset:r=0,orient:a,direction:o,point:l}=null!=e?e:{};let h=0,c=0;"negative"===a&&(i.group?(h=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),c=null!==(n=i.groupHeight)&&void 0!==n?n:i.group.getBounds().height(),i.groupWidth=h,i.groupHeight=c):(h=i.width,c=i.height)),h+=r,c+=r;const u=d(l)?l.call(null,t.getDatum(),t,i):l,p=u&&k(u.x)?u.x:h,g=u&&k(u.y)?u.y:c,m=t.getFinalGraphicAttributes();switch(o){case"x":return{from:{x:p},to:{x:null==m?void 0:m.x}};case"y":return{from:{y:g},to:{y:null==m?void 0:m.y}};default:return{from:{x:p,y:g},to:{x:null==m?void 0:m.x,y:null==m?void 0:m.y}}}},CI=(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}}}},EI=(t,e,i)=>{var s,n,r,a;const o=t.getFinalGraphicAttributes();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}}}},PI=(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}}}},BI={symbol:["_mo_hide_","visible"]},RI=(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=BI[t.mark.markType])&&r.forEach((t=>{delete s[t],delete n[t]})),Object.keys(n).forEach((t=>{pb(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}},LI=(t,e,i)=>{var s,n;const r=null!==(n=null===(s=t.getFinalGraphicAttributes())||void 0===s?void 0:s.angle)&&void 0!==n?n:0;let a=0;return a=ut(r/(2*Math.PI),0)?Math.round(r/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(r/(2*Math.PI))*Math.PI*2:Math.floor(r/(2*Math.PI))*Math.PI*2,{from:{angle:a},to:{angle:r}}},OI=(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}}},II=()=>{kR.registerAnimationType("clipIn",nI)},DI=()=>{kR.registerAnimationType("clipOut",rI)},FI=()=>{kR.registerAnimationType("fadeIn",aI)},jI=()=>{kR.registerAnimationType("fadeOut",oI)},zI=()=>{kR.registerAnimationType("growCenterIn",lI)},HI=()=>{kR.registerAnimationType("growCenterOut",hI)},VI=()=>{kR.registerAnimationType("growHeightIn",uI)},NI=()=>{kR.registerAnimationType("growHeightOut",pI)},GI=()=>{kR.registerAnimationType("growWidthIn",cI)},WI=()=>{kR.registerAnimationType("growWidthOut",dI)},UI=()=>{kR.registerAnimationType("growPointsIn",yI)},YI=()=>{kR.registerAnimationType("growPointsOut",bI)},KI=()=>{kR.registerAnimationType("growPointsXIn",SI)},XI=()=>{kR.registerAnimationType("growPointsXOut",AI)},$I=()=>{kR.registerAnimationType("growPointsYIn",MI)},qI=()=>{kR.registerAnimationType("growPointsYOut",TI)},ZI=()=>{kR.registerAnimationType("growAngleIn",gI)},JI=()=>{kR.registerAnimationType("growAngleOut",mI)},QI=()=>{kR.registerAnimationType("growRadiusIn",fI)},tD=()=>{kR.registerAnimationType("growRadiusOut",vI)},eD=()=>{kR.registerAnimationType("moveIn",wI)},iD=()=>{kR.registerAnimationType("moveOut",CI)},sD=()=>{kR.registerAnimationType("scaleIn",EI)},nD=()=>{kR.registerAnimationType("scaleOut",PI)},rD=()=>{kR.registerAnimationType("rotateIn",LI)},aD=()=>{kR.registerAnimationType("rotateOut",OI)},oD=()=>{kR.registerAnimationType("update",RI)};class lD extends NL{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=uR(e)?null:Object.keys(e).reduce(((t,s)=>(vR(e[s])&&(t[s]=gR(e[s].scale,i)),t)),{});this._encoders[t]={callback:(t,i,n)=>{const r=SR(e,t,i,n);if(u(r.size)){const t=s.x?NR(s.x):void 0,e=s.y?NR(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(PR.symbol)}release(){super.release(),this._encoders=null}}lD.markType=RB.cell;const hD=["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 cD,dD,uD;t.ChartEvent=void 0,(cD=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",cD.rendered="rendered",cD.renderFinished="renderFinished",cD.animationFinished="animationFinished",cD.regionSeriesDataFilterOver="regionSeriesDataFilterOver",cD.afterInitData="afterInitData",cD.afterInitEvent="afterInitEvent",cD.afterInitMark="afterInitMark",cD.rawDataUpdate="rawDataUpdate",cD.viewDataFilterOver="viewDataFilterOver",cD.viewDataUpdate="viewDataUpdate",cD.viewDataStatisticsUpdate="viewDataStatisticsUpdate",cD.markDeltaYUpdate="markDeltaYUpdate",cD.viewDataLabelUpdate="viewDataLabelUpdate",cD.scaleDomainUpdate="scaleDomainUpdate",cD.scaleUpdate="scaleUpdate",cD.dataZoomChange="dataZoomChange",cD.drill="drill",cD.layoutStart="layoutStart",cD.layoutEnd="layoutEnd",cD.layoutRectUpdate="layoutRectUpdate",cD.playerPlay="playerPlay",cD.playerPause="playerPause",cD.playerEnd="playerEnd",cD.playerChange="playerChange",cD.playerForward="playerForward",cD.playerBackward="playerBackward",cD.scrollBarChange="scrollBarChange",cD.brushStart="brushStart",cD.brushChange="brushChange",cD.brushEnd="brushEnd",cD.brushClear="brushClear",cD.legendSelectedDataChange="legendSelectedDataChange",cD.legendFilter="legendFilter",cD.legendItemClick="legendItemClick",cD.legendItemHover="legendItemHover",cD.legendItemUnHover="legendItemUnHover",cD.tooltipShow="tooltipShow",cD.tooltipHide="tooltipHide",cD.tooltipRelease="tooltipRelease",cD.afterResize="afterResize",cD.afterRender="afterRender",cD.afterLayout="afterLayout",t.Event_Source_Type=void 0,(dD=t.Event_Source_Type||(t.Event_Source_Type={})).chart="chart",dD.window="window",dD.canvas="canvas",t.Event_Bubble_Level=void 0,(uD=t.Event_Bubble_Level||(t.Event_Bubble_Level={})).vchart="vchart",uD.chart="chart",uD.model="model",uD.mark="mark";const pD=`${hB}_waterfall_default_seriesField`,gD=`${hB}_CORRELATION_X`,mD=`${hB}_CORRELATION_Y`,fD=`${hB}_CORRELATION_SIZE`,vD=`${hB}_MEASURE_CANVAS_ID`,_D=`${hB}_DEFAULT_DATA_INDEX`,yD=`${hB}_DEFAULT_DATA_KEY`,bD=`${hB}_DEFAULT_DATA_SERIES_FIELD`,xD=`${hB}_DEFAULT_SERIES_STYLE_NAME`;var SD;t.AttributeLevel=void 0,(SD=t.AttributeLevel||(t.AttributeLevel={}))[SD.Default=0]="Default",SD[SD.Theme=1]="Theme",SD[SD.Chart=2]="Chart",SD[SD.Base_Series=3]="Base_Series",SD[SD.Series=4]="Series",SD[SD.Mark=5]="Mark",SD[SD.User_Chart=6]="User_Chart",SD[SD.User_Series=7]="User_Series",SD[SD.User_Mark=8]="User_Mark",SD[SD.Built_In=99]="Built_In";const AD=`${hB}_STACK_KEY`,kD=`${hB}_STACK_START`,MD=`${hB}_STACK_END`,TD=`${hB}_STACK_START_PERCENT`,wD=`${hB}_STACK_END_PERCENT`,CD=`${hB}_STACK_START_OffsetSilhouette`,ED=`${hB}_STACK_END_OffsetSilhouette`,PD=`${hB}_STACK_TOTAL`,BD=`${hB}_STACK_TOTAL_PERCENT`,RD=`${hB}_STACK_TOTAL_TOP`,LD=`${hB}_SEGMENT_START`,OD=`${hB}_SEGMENT_END`;var ID,DD;t.LayoutZIndex=void 0,(ID=t.LayoutZIndex||(t.LayoutZIndex={}))[ID.Axis_Grid=50]="Axis_Grid",ID[ID.CrossHair_Grid=100]="CrossHair_Grid",ID[ID.Region=450]="Region",ID[ID.Mark=300]="Mark",ID[ID.Node=400]="Node",ID[ID.Axis=100]="Axis",ID[ID.MarkLine=500]="MarkLine",ID[ID.MarkArea=100]="MarkArea",ID[ID.MarkPoint=500]="MarkPoint",ID[ID.DataZoom=500]="DataZoom",ID[ID.ScrollBar=500]="ScrollBar",ID[ID.Player=500]="Player",ID[ID.Legend=500]="Legend",ID[ID.CrossHair=500]="CrossHair",ID[ID.Indicator=500]="Indicator",ID[ID.Title=500]="Title",ID[ID.Label=500]="Label",ID[ID.Brush=500]="Brush",ID[ID.CustomMark=500]="CustomMark",ID[ID.Interaction=700]="Interaction",t.LayoutLevel=void 0,(DD=t.LayoutLevel||(t.LayoutLevel={}))[DD.Indicator=10]="Indicator",DD[DD.Region=20]="Region",DD[DD.Axis=30]="Axis",DD[DD.DataZoom=40]="DataZoom",DD[DD.Player=40]="Player",DD[DD.ScrollBar=40]="ScrollBar",DD[DD.Legend=50]="Legend",DD[DD.Title=70]="Title",DD[DD.CustomMark=70]="CustomMark";const FD=["linear","radial","conical"],jD={x0:0,y0:0,x1:1,y1:1},zD={x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},HD={x:.5,y:.5,startAngle:0,endAngle:2*Math.PI},VD={linear:jD,radial:zD,conical:HD},ND={label:{name:"label",type:"text"}},GD=`${hB}_rect_x`,WD=`${hB}_rect_x1`,UD=`${hB}_rect_y`,YD=`${hB}_rect_y1`,KD=Object.assign(Object.assign({},ND),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),XD=Object.assign(Object.assign({},ND),{bar3d:{name:"bar3d",type:"rect3d"}}),$D={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},qD=Object.assign(Object.assign({},ND),$D),ZD=Object.assign(Object.assign({},ND),{point:{name:"point",type:"symbol"}}),JD=Object.assign(Object.assign(Object.assign({},ND),$D),{area:{name:"area",type:"area"}}),QD=Object.assign(Object.assign(Object.assign({},ND),$D),{area:{name:"area",type:"area"}}),tF=Object.assign(Object.assign({},ND),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),eF=Object.assign(Object.assign({},ND),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}}),iF=Object.assign(Object.assign({},ND),{rose:{name:"rose",type:"arc"}}),sF=Object.assign(Object.assign({},ND),{area:{name:"area",type:"path"}}),nF=Object.assign(Object.assign({},ND),{group:{name:"group",type:"group"}}),rF=Object.assign(Object.assign({},nF),{track:{name:"track",type:"arc"},progress:{name:"progress",type:"arc"}}),aF=Object.assign(Object.assign({},ND),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),oF=Object.assign(Object.assign({},ND),{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"}}),lF=Object.assign(Object.assign({},ND),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"}}),hF=Object.assign(Object.assign({},ND),{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"}}),cF=Object.assign(Object.assign({},ND),{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"}}),dF=Object.assign(Object.assign({},ND),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),uF=Object.assign(Object.assign({},KD),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),pF=Object.assign(Object.assign({},ND),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),gF=Object.assign(Object.assign({},ND),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),mF=Object.assign(Object.assign({},ND),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}}),fF=Object.assign(Object.assign({},nF),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),vF=Object.assign(Object.assign({},ND),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),_F=Object.assign(Object.assign({},ND),{sunburst:{name:"sunburst",type:"arc"}}),yF=Object.assign(Object.assign({},KD),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),bF=Object.assign(Object.assign({},XD),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),xF=Object.assign(Object.assign({},ND),{circlePacking:{name:"circlePacking",type:"arc"}}),SF=Object.assign(Object.assign({},ND),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}}),AF=Object.assign(Object.assign({},ND),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),kF=Object.assign({},JD),MF=Object.assign(Object.assign({},ND),{liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"symbol"}}),TF=Object.assign(Object.assign({},ND),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});var wF;!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"}(wF||(wF={}));const CF={[oB.bar]:KD,[oB.bar3d]:XD,[oB.line]:qD,[oB.scatter]:ZD,[oB.area]:JD,[oB.radar]:QD,[oB.pie]:tF,[oB.pie3d]:eF,[oB.rose]:iF,[oB.geo]:ND,[oB.map]:sF,[oB.circularProgress]:rF,[oB.link]:aF,[oB.dot]:oF,[oB.wordCloud]:lF,[oB.wordCloud3d]:lF,[oB.funnel]:hF,[oB.funnel3d]:cF,[oB.linearProgress]:dF,[oB.waterfall]:uF,[oB.boxPlot]:pF,[oB.treemap]:gF,[oB.sankey]:mF,[oB.gauge]:fF,[oB.gaugePointer]:vF,[oB.sunburst]:_F,[oB.rangeColumn]:yF,[oB.rangeColumn3d]:bF,[oB.circlePacking]:xF,[oB.heatmap]:SF,[oB.correlation]:AF,[oB.rangeArea]:kF,[oB.liquid]:MF,[oB.venn]:TF};function EF(t){var e,i;const{type:s}=t;return s===oB.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}const PF={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},BF={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function RF(t,e){var i;if(!t)return[];const s=zF(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?FF(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>DF(i)?OF(t,i,e):i)).filter(p)}))):i.map((i=>DF(i)?OF(t,i,e):i)).filter(p):[]}return[]}function LF(t,e){var i,s;return FF(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 OF(t,e,i){var s;const n=zF(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=PF[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=BF[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 IF=(t,e,i)=>{if(e&&DF(t)){const s=OF(e,t,i);if(s)return s}return t};function DF(t){return t&&"palette"===t.type&&!!t.key}function FF(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function jF(t){return y(t)?{dataScheme:t}:t}function zF(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=EF(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 HF extends sC{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(!FF(this._range))return void super.range(this._range);const t=LF(this._range,this._domain);super.range(t)}}const VF={linear:TC,band:rC,point:class extends rC{constructor(t){super(!1),this.type=Pw.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:sC,threshold:BC,colorOrdinal:HF};function NF(t){const e=VF[t];return e?new e:null}function GF(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 WF(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function UF(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function YF(t){return!!_(t)&&(!!t.endsWith("%")&&sb(t.substring(0,t.length-1)))}function KF(t,e,i,s=0){var n,r;return S(t)?t:YF(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 XF(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]=KF(t[s],e.size,i)}))})),o}function $F(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)||YF(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 qF(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const ZF=(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},JF=[{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"]}],QF={default:{dataScheme:JF,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)"}}},tj="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",ej={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:tj,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:tj,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:CB,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"}}}}},ij={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}}},sj=Object.assign(Object.assign({},ij),{label:{space:0}}),nj={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}}}}},rj="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;",aj={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:rj,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:rj,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}}}},oj={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}},lj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}},hj={horizontal:Object.assign(Object.assign({},oj),{rail:{width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:lj}),vertical:Object.assign(Object.assign({},oj),{rail:{width:8,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:lj})},cj={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}},dj={horizontal:Object.assign(Object.assign({},oj),{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:cj}),vertical:Object.assign(Object.assign({},oj),{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:cj})},uj={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"}}}}},pj={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"}}}}},gj={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 mj(t,e){return t&&e.key in t?t[e.key]:e.default}function fj(t){return t&&"token"===t.type&&!!t.key}const vj={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%"},_j={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:QF,token:vj,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:ej,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:hj,sizeLegend:dj,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:ij,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:sj,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:pj,markArea:uj,markPoint:gj,polarMarkLine:pj,polarMarkArea:uj,polarMarkPoint:gj,geoMarkPoint:gj,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:aj,crosshair:nj,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},yj={name:"dark",colorScheme:{default:{dataScheme:JF,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}}}}}},bj=(t,e)=>t===e||!d(t)&&!d(e)&&(y(t)&&y(e)?e.every((e=>t.some((t=>bj(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>bj(t[i],e[i])))),xj=(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]={}),xj(t[s],e.slice(1),i))};function Sj(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]=Sj(n,e)}return s}function Aj(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])?kj(t,e,r,i):Mj(t,r,s[r])}}}}function kj(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?Tj({},t[n][e.index],i):i):t[n]=s?Tj({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?Tj({},t[n][r],i):i)}else t.id===e&&(t[n]=s?Tj({},t[n],i):i)}))}function Cj(t,...e){return Tj(Ej(t),...e.map(Ej))}function Ej(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]=jF(s),e}),{}));return t}(t.colorScheme),{series:s}=t,{mark:n,markByName:r}=t;let a;return(n||r)&&(a=Object.keys(CF).reduce(((t,e)=>{var i;const a=null!==(i=null==s?void 0:s[e])&&void 0!==i?i:{};return t[e]=Pj(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 Pj(t,e,i,s){if(!CF[e])return t;const n={};return Object.values(CF[e]).forEach((({type:e,name:r})=>{n[r]=Tj({},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 Bj=["animationThreshold","colorScheme","name","padding"];function Rj(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];Bj.includes(r)?n[r]=a:f(a)?DF(a)?n[r]=IF(a,e,s):fj(a)?n[r]=mj(i,a):n[r]=Rj(a,e,i,s):n[r]=a})),n}const Lj={[_j.name]:_j},Oj=_j.name,Ij=new Map(Object.keys(Lj).map((t=>[t,Lj[t]]))),Dj=new Map(Object.keys(Lj).map((t=>[t,Rj(Lj[t])]))),Fj=new Map(Object.keys(Lj).map((t=>[t,t===Oj]))),jj=(t,e)=>{if(!t)return;const i=Nj(e);Ij.set(t,i),Dj.set(t,Rj(i)),Fj.set(t,!0)},zj=(t=Oj,e=!1)=>(Fj.has(t)&&!Fj.get(t)&&jj(t,Ij.get(t)),e?Dj.get(t):Ij.get(t)),Hj=t=>Ij.delete(t)&&Dj.delete(t)&&Fj.delete(t),Vj=t=>!!_(t)&&Ij.has(t),Nj=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:Oj;return Cj({},zj(i),t)};class Gj{static registerInstance(t){Gj.instances.set(t.id,t)}static unregisterInstance(t){Gj.instances.delete(t.id)}static getInstance(t){return Gj.instances.get(t)}static instanceExist(t){return Gj.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return Gj.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}Gj.instances=new Map;class Wj{static registerTheme(t,e){jj(t,e)}static getTheme(t,e=!1){return zj(t,e)}static removeTheme(t){return Hj(t)}static themeExist(t){return Vj(t)}static getDefaultTheme(){return Wj.themes.get(Oj)}static setCurrentTheme(t){Wj.themeExist(t)&&(Wj._currentThemeName=t,Gj.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return Wj.getTheme(Wj._currentThemeName,t)}static getCurrentThemeName(){return Wj._currentThemeName}}function Uj(t,e){return _(t)?Wj.themeExist(t)?Wj.getTheme(t,e):{}:g(t)?t:{}}function Yj(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]=Yj(t[s],e)}return i}return y(t)?t.map((t=>Yj(t,e))):t}function Kj(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]=Kj(t[s],e)}return i}return y(t)?t.map((t=>Kj(t,e))):t}Wj.themes=Ij,Wj._currentThemeName=Oj;function Xj(t,e){for(let i=0;it.key===e))}function qj(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 Zj(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:{}},iz(t,a,n[o],l,e,r))})),s?Jj(n):n}function Jj(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))):Jj(t[e].nodes);return t}function Qj(t,e){if("values"in t&&t.values.length){const i=JP(t.values,e),s=ZP(t.values,wD);t.values.forEach((t=>{t[PD]=i,t[BD]=s,delete t[RD]}));const n=t.values.reduce(((t,e)=>e[MD]>t[MD]?e:t));n[RD]=!0}else for(const i in t.nodes)Qj(t.nodes[i],e)}function tz(t){if(!t.values.length)return;const e=t.values[t.values.length-1][MD]/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[kD]=s,s+=r[MD],r[MD]=s):(r[kD]=n,n+=r[MD],r[MD]=n),r[AD]=t.key}if(i)for(let i=0;i=0?s:n;r=a>=0?1:-1,l[TD]=0===h?0:Math.min(1,l[kD]/h)*r,l[wD]=0===h?0:Math.min(1,l[MD]/h)*r}}for(const s in t.nodes)ez(t.nodes[s],e,i)}function iz(t,e,i,s,n,r,a){if("values"in e)if(n&&e.values.forEach((t=>t[MD]=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}),iz(t,e.nodes[o],i.nodes[o],s,n,r,l)}}const sz=(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]=rz(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function az(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>lz(t.style(e,i,s,n)):B(t.style)||(e.style=lz(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>lz(t.state[e](i,s,n,r)):B(t.state[e])||(i[e]=lz(t.state[e]))})),e.state=i}return e}function oz(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>lz(t[i](e,s,n,r)):B(t[i])||(e[i]=lz(t[i]))})),e}function lz(t){return(null==t?void 0:t.angle)&&(t.angle=Qt(t.angle)),t}class hz{static registerChart(t,e){hz._charts[t]=e}static registerSeries(t,e){hz._series[t]=e}static registerComponent(t,e,i){hz._components[t]={cmp:e,alwaysCheck:i}}static registerMark(t,e){hz._marks[t]=e}static registerRegion(t,e){hz._regions[t]=e}static registerTransform(t,e){hz.transforms[t]=e}static registerLayout(t,e){hz._layout[t]=e}static registerAnimation(t,e){hz._animations[t]=e}static registerImplement(t,e){hz._implements[t]=e}static registerChartPlugin(t,e){hz._chartPlugin[t]=e}static registerComponentPlugin(t,e){hz._componentPlugin[t]=e}static createChart(t,e,i){if(!hz._charts[t])return null;return new(0,hz._charts[t])(e,i)}static createChartSpecTransformer(t,e){if(!hz._charts[t])return null;const i=hz._charts[t];return new(0,i.transformerConstructor)(Object.assign({seriesType:i.seriesType},e))}static createRegion(t,e,i){if(!hz._regions[t])return null;return new(0,hz._regions[t])(e,i)}static createRegionSpecTransformer(t,e){if(!hz._regions[t])return null;return new(0,hz._regions[t].transformerConstructor)(e)}static createSeries(t,e,i){if(!hz._series[t])return null;return new(0,hz._series[t])(e,i)}static createSeriesSpecTransformer(t,e){if(!hz._series[t])return null;return new(0,hz._series[t].transformerConstructor)(e)}static createMark(t,e,i){if(!hz._marks[t])return null;const s=new(0,hz._marks[t])(e,i);return"group"===s.type&&s.setInteractive(!1),s}static getComponents(){return Object.values(hz._components)}static getComponentInKey(t){return hz._components[t].cmp}static getLayout(){return Object.values(hz._layout)}static getLayoutInKey(t){return hz._layout[t]}static getSeries(){return Object.values(hz._series)}static getSeriesInType(t){return hz._series[t]}static getRegionInType(t){return hz._regions[t]}static getAnimationInKey(t){return hz._animations[t]}static getImplementInKey(t){return hz._implements[t]}static getSeriesMarkMap(t){return hz._series[t]?hz._series[t].mark:{}}static getChartPlugins(){return Object.values(hz._chartPlugin)}static getComponentPlugins(){return Object.values(hz._componentPlugin)}static getComponentPluginInType(t){return hz._componentPlugin[t]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}}hz._charts={},hz._series={},hz._components={},hz._marks={},hz._regions={},hz._animations={},hz._implements={},hz._chartPlugin={},hz._componentPlugin={},hz.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}},hz.dataParser={csv:Ur,dsv:Wr,tsv:Yr},hz._layout={};const cz=(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))},dz=(t,e,i,s)=>{var n;const r=jw(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:uz(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("_")}`,pz=(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},gz=(t,e)=>{if(!t)return null;if(!rB(t.getRegionsInIndex(),"polar"))return null;const{x:i,y:s}=e,n=pz(t,(t=>"angle"===t.getOrient()),e),r=pz(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&&jw(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=eB({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=iB(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=dz(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&&jw(r.type)){const h=t.getCenter(),c={x:i-t.getLayoutStartPoint().x-h.x,y:s-t.getLayoutStartPoint().y-h.y};let d=eB({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=iB(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 _=dz(f,t,"polar",o);a.push({index:v,value:f,position:r.scale(f),axis:t,data:_})}})),a.length?a:null};function mz(t){return"bottom"===t||"top"===t}function fz(t){return"left"===t||"right"===t}function vz(t){return"z"===t}function _z(t,e){return UF(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function yz(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function bz(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?mz(t)?"linear":"band":mz(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const xz=t=>t.fieldX[0],Sz=t=>t.fieldY[0],Az=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},kz=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},Mz=(t,e)=>t?e?xz:Az:e?Sz:kz,Tz=(t,e,i)=>{var s,n;if(!t)return null;if(!rB(t.getRegionsInIndex(),"cartesian"))return null;const{x:r,y:a}=e,o=null!==(s=pz(t,(t=>mz(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=pz(t,(t=>fz(t.getOrient())),e))&&void 0!==n?n:[],h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{jw(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=wz(s,i,t,Mz(e,jw(s.getScale().type)));n&&u.push(n)}}else{const n=h.size>0;if((n?h:c).has(s)){const r=wz(s,i,t,Mz(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},wz=(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 Cz(t,a,s)},Cz=(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=dz(e,t,"cartesian",null!=i?i:mz(t.getOrient())?xz:Sz);return{index:n,value:e,position:s.scale(e),axis:t,data:r}};class Ez{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:Xy)("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:Xy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s;const n=null!==(i=Tz(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(s=gz(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=>jw(t.getScale().type))),r=n.length?n:s.filter((t=>{const e=t.getOrient();return mz(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=Cz(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var Pz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Pz||(Pz={}));const Bz={[Pz.dimensionHover]:class extends Ez{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)=>!cz(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}),Qy(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}),Qy(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[Pz.dimensionClick]:class extends Ez{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 Rz=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(Bz[t]){const e=new Bz[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(Bz[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}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class Lz{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}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const Oz={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 Iz{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 Lz);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}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 Oz[a]&&(a=Oz[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.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 hD.includes(e)||Object.values(t.VGRAMMAR_HOOK_EVENT).includes(e)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&kR.hasInteraction(e)}}function Dz(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function Fz(t,e,i){t.getParser(e)||t.registerParser(e,i)}const jz=new Map;let zz;function Hz(){zz||(zz=new fa,Fz(zz,"geojson",ca),Fz(zz,"topojson",ua),Dz(zz,"simplify",Br))}function Vz(t,e,i={type:"geojson",centroid:!0}){jz.has(t)&&Ky(`map type of '${t}' already exists, will be overwritten.`),Hz();const s=new _a(zz),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}),jz.set(t,s)}function Nz(t){jz.has(t)?jz.delete(t):Ky(`map type of '${t}' does not exists.`)}function Gz(t,e=!1){let i=e;return t.latestData instanceof _a&&(i=!1),i?I(t.latestData):t.latestData.slice()}const Wz=(t,e)=>0===t.length?[]:1===t.length?Gz(t[0],null==e?void 0:e.deep):t.map((t=>Gz(t,null==e?void 0:e.deep)));function Uz(t,e,i){Dz(e=e instanceof fa?e:t.dataSet,"copyDataView",Wz);const s=new _a(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:Xz.copyDataView}),s}function Yz(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:Xy)(`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:Xy)(`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([]),Ky("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 Kz(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var Xz;!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"}(Xz||(Xz={}));const $z=(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 uO(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:tH(this._option.mode),autoFit:!1,eventConfig:{gesture:Qy(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())}clear(t,e=!1){const{chart:i}=t;i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=E_.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this._nextRafId&&(E_.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null),this._isRunning||(this.initView(),this._view&&(this._isRunning=!0,null===(e=this._view)||void 0===e||e.run(t),this._isRunning=!1,this._nextRafId&&(E_.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,this._isRunning=!0,null===(i=this._view)||void 0===i||i.run(t),this._isRunning=!1))))}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.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 Jy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function iH(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:Xy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function sH(t){t.crosshair=Y(t.crosshair||{}).map((e=>Tj({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function nH(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&&Jy(e.mode)){let t;t=_(h)?null===document||void 0===document?void 0:document.getElementById(h):h;const{width:e,height:s}=ei(t,i.width,i.height);a=e,o=s}else if(tb(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 rH(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")}),t}function aH(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"}(Jz||(Jz={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(Qz||(Qz={}));class oH{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({},oH.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]))))}}oH.defaultMarkInfo={};class lH{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new oH,this._markReverse=new oH,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement(Jz.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement(Jz.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement(Jz.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement(Jz.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement(Jz.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(Jz.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[Jz.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[Jz.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(Pz.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 hH={};Object.values(Jz).forEach((t=>{hH[t]=!0}));const cH={[Jz.STATE_HOVER]:Jz.STATE_HOVER_REVERSE,[Jz.STATE_SELECTED]:Jz.STATE_SELECTED_REVERSE,[Jz.STATE_DIMENSION_HOVER]:Jz.STATE_DIMENSION_HOVER_REVERSE};function dH(t){return cH[t]}class uH{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=dH(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=dH(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=dH(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=dH(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 pH{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 gH extends pH{constructor(){super(...arguments),this.id=ib(),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 mH extends gH{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,s){super(t),this.grammarType=Zz.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 fH extends pH{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 mH(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 vH extends fH{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 _H extends vH{constructor(){super(...arguments),this.id=ib(),this.stateKeyToSignalName=t=>`${hB}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===qz.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===qz.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?qz.none:qz.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?qz.exit:qz.appear}}}}class yH{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=>Tj({},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 bH extends pH{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=yH,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new oH,this._lastLayoutRect=null,this.id=ib(),this.userId=t.id,this._spec=t,this.effect={},this.event=new Rz(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=`${hB}_${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=hz.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 xH{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=XF($F(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:KF(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:KF(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:KF(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:KF(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:KF(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:KF(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=KF(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=KF(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]=KF(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 SH extends bH{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 xH(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 AH extends yH{_initTheme(t,e){return{spec:t,theme:this._theme}}}class kH extends SH{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=AH,this.modelType="region",this.specKey="region",this.type=kH.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.interaction=new uH,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 _H({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 lH(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 Qz)B(t.stateStyle[Qz[e]])||this.interaction.registerMark(Qz[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 MH(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 TH(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 wH(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 CH(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),wH(c,!0,u,o),s&&TH(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function EH(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),wH(c,!1,u,a),s&&TH(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function BH(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}=MH(t);s.length&&CH(s,e,i,!1,"left"),n.length&&CH(n,e,i,!0,"left"),r.length&&EH(r,e,0,"left")}(e,this,a),s.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=MH(t);s.length&&PH(s,e,i,!1,"top"),n.length&&PH(n,e,i,!0,"top"),r.length&&BH(r,e,0,"top")}(s,this,r),i.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=MH(t);s.length&&CH(s,e,i,!1,"right"),n.length&&CH(n,e,i,!0,"right"),r.length&&EH(r,e,0,"right")}(i,this,a),n.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=MH(t);s.length&&PH(s,e,i,!1,"bottom"),n.length&&PH(n,e,i,!0,"bottom"),r.length&&BH(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:Xy)("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}}}RH.type="base";const LH=["line","area","trail"];function OH(t){return LH.includes(t)}class IH extends vH{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(OH)?s:!t.mark||OH(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=>!!hH[t])).map((t=>[t,10])),s=!t.mark||OH(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(hB)));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(hB)));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(Dw(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 DH extends gH{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=Zz.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 FH extends DH{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${hB}_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 jH extends gH{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=Zz.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 IH(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 Rz(s.getOption().eventDispatcher,s.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new FH(t)}stateKeyToSignalName(t){return`${hB}_${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=Jz.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=Jz.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===qz.appear&&this.runAnimationByState(qz.normal)})):this._event.on(t.VGRAMMAR_HOOK_EVENT.AFTER_DO_RENDER,(()=>{this.runAnimationByState(qz.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),this._morph&&this._morphKey&&(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 zH extends jH{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].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))}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&&Tj(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(Fw(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=NF(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()):FD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Fw(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=LF(RF(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({},VD[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)FD.includes(null===(o=n.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(n.stroke)(t,e));else{const e=LF(RF(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 HH extends zH{constructor(){super(...arguments),this.type=HH.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)?(Ky("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?(Ky("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})}))}}HH.type="group";const VH=()=>{fM(),iM(),kR.registerGraphic(RB.group,Au),hz.registerMark(HH.type,HH)},NH={type:"clipIn"},GH={type:"fadeIn"};function WH(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 GH;default:return NH}}const UH={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"}},YH={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},KH={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},XH=()=>{hz.registerAnimation("scaleInOut",(()=>YH))},$H=()=>{hz.registerAnimation("fadeInOut",(()=>KH))},qH=(t,e)=>({appear:WH(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:zc,duration:UH.update.duration,easing:UH.update.easing}],disappear:{type:"clipOut"}}),ZH=()=>{hz.registerAnimation("line",qH)},JH=()=>{uO.useRegisters([UI,YI,KI,XI,$I,qI,II,DI])},QH={measureText:(t,e,i,s)=>((t,e,i)=>GM(t,e,i,{fontFamily:vj.fontFamily,fontSize:vj.fontSize}))(e,i,s).measure(t)};class tV{static instance(){return tV.instance_||(tV.instance_=new tV),tV.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 eV{constructor(){this.id=ib(),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))?Ky("不要重复添加相同的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 iV extends eV{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 sV{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>hz.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>hz.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>hz.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return hz.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>hz.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){hz.registerTransform(t,e)}static registerFunction(t,e){t&&e&&tV.instance().registerFunction(t,e)}static unregisterFunction(t){t&&tV.instance().unregisterFunction(t)}static getFunction(t){return t?tV.instance().getFunction(t):null}static getFunctionList(){return tV.instance().getFunctionNameList()}static registerMap(t,e,i){const s=hz.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=hz.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,jz.get(e);var e}static hideTooltip(t=[]){Gj.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,c;this.id=ib(),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 d=this._option,{dom:u,renderCanvas:p,mode:g,stage:m,poptip:f}=d,v=e(d,["dom","renderCanvas","mode","stage","poptip"]),y=Jy(g);y&&u&&(this._container=_(u)?null===document||void 0===document?void 0:document.getElementById(u):u),p&&(this._canvas=p),m&&(this._stage=m),"node"===g||this._container||this._canvas||this._stage?(y?Cx($l):"node"===g&&lA($l),this._viewBox=this._option.viewBox,this._currentThemeName=Wj.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new eH({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:p},Object.assign(Object.assign({mode:this._option.mode,stage:m,pluginList:!1!==f?["poptipForText"]:[]},v),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new Iz(this,this._compiler),this._event=new Rz(this._eventDispatcher,g),this._compiler.initView(),null===(o=this.getStage())||void 0===o||o.setTheme({text:{fontFamily:null===(l=this._currentTheme)||void 0===l?void 0:l.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!y&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),Gj.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=Tj({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=Yj(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;sV.getFunctionList()&&sV.getFunctionList().length&&(t=Kj(t,sV)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=hz.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=hz.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=hz.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 nH(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:cB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:dB})}_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,Fz(this._dataSet,"dataview",pa),Fz(this._dataSet,"array",s),Dz(this._dataSet,"stackSplit",$z),Dz(this._dataSet,"copyDataView",Wz);for(const t in hz.transforms)Dz(this._dataSet,t,hz.transforms[t]);for(const t in hz.dataParser)Fz(this._dataSet,t,hz.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),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;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,null===(s=this._compiler)||void 0===s||s.releaseGrammar(!1===(null===(n=this._option)||void 0===n?void 0:n.animation)||!1===(null===(r=this._spec)||void 0===r?void 0:r.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.reCompile&&(null===(a=this._compiler)||void 0===a||a.clear({chart:this._chart,vChart:this},!this._option.animation||!this._spec.animation),null===(o=this._compiler)||void 0===o||o.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(){var t,e;this._option.animation&&(null===(t=this._chart)||void 0===t||t.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(qz.update,!0)})),null===(e=this._chart)||void 0===e||e.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(qz.update,!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,Gj.unregisterInstance(this)}updateData(t,e,s){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s)}))}_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){return u(this._dataSet)?this:this._chart?(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){if(this._chart)return this._chart.updateFullData(t),e&&this._compiler.render(),this;const i=Y(this._spec.data);return Y(t).forEach((t=>{var e;const{id:s,values:n,parser:r,fields:a}=t,o=i.find((t=>t.name===s));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 s=Yz(t,this._dataSet,i,{onError:null===(e=this._option)||void 0===e?void 0:e.onError});y(this._spec.data)&&this._spec.data.push(s)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i){const s=this._updateSpec(t,e);return s?(this.updateCustomConfigAndRerender(s,!0,{morphConfig:i,transformSpec:s.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){var i,s;const n=this._spec;if(!this._setNewSpec(t,e))return;G(n.theme,this._spec.theme)||this._setCurrentTheme();const r=this._shouldChartResize(n);return null===(s=null===(i=this._compiler)||void 0===i?void 0:i.getVGrammarView())||void 0===s||s.updateLayoutTag(),this._spec.type!==n.type?{reTransformSpec:!0,change:!0,reMake:!0,reCompile:!1,reSize:r}:(this._initChartSpec(this._spec,"render"),rH(this._chart.updateSpec(this._spec),{reTransformSpec:!1,change:r,reMake:!1,reCompile:!1,reSize:r}))}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)||wj(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)||wj(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=Tj({},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=Uj(this._currentThemeName,!0);else if(_(s)&&(!n||_(n))||_(n)&&(!s||_(s))){const t=Cj({},Uj(this._currentThemeName,!0),Uj(s,!0),Uj(n,!0));this._currentTheme=t}else{const t=Cj({},Uj(this._currentThemeName),Uj(s),Uj(n));this._currentTheme=Rj(t)}var r;r=R(this._currentTheme,"component.poptip"),z(eT.poptip,tT,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=!!Jy(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?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return Uj(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){if(!Wj.themeExist(t))return this;const e=this._setCurrentTheme(t);return yield this.updateCustomConfigAndRerender(e,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){if(!Wj.themeExist(t))return this;const e=this._setCurrentTheme(t);return this.updateCustomConfigAndRerender(e,!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}}_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 iH(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(!Jy(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)?null===document||void 0===document?void 0:document.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?qF(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 Ky("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?qF(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Ky("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return tV.instance().getFunction(t)}registerFunction(t,e){t&&e&&tV.instance().registerFunction(t,e)}unregisterFunction(t){t&&tV.instance().unregisterFunction(t)}getFunctionList(){return tV.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}_initChartPlugin(){const t=hz.getChartPlugins();t.length>0&&(this._chartPlugin=new iV(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}}}sV.InstanceManager=Gj,sV.ThemeManager=Wj,sV.globalConfig={uniqueTooltip:!0},sV.Utils=QH,sV.vglobal=E_;hz.registerRegion("region",kH),hz.registerLayout("base",RH),VH(),uO.useRegisters([tI,eI]),uO.useRegisters([sD,nD,FI,jI,eD,iD,rD,aD,oD]),UR(),WR(),jj(yj.name,yj),rt.getInstance(nt.Error);const nV=(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(oB).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=hz.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=hz.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},rV=(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=nV(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):bj(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const m=Tj({},i),f=d(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:Tj(m,f),hasChanged:!0};const i=Tj({},t,f);xj(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 aV{constructor(t){this.id=ib(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}const oV=t=>{hz.registerChartPlugin(t.type,t)};class lV extends aV{constructor(){super(lV.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[lV.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[lV.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=Sj(this._option.globalInstance.getSpec(),["data",lV.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=Sj(this._baseChartSpec,["data",lV.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=rV(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=Sj(i,["data",lV.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()}}lV.pluginType="chart",lV.specKey="media",lV.type="MediaQueryPlugin";const hV=/\{([^}]+)\}/,cV=/\{([^}]+)\}/g,dV=/:/;class uV extends aV{constructor(){super(uV.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[uV.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)),hz.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=hV.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(cV,((t,i)=>{if(!dV.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}}uV.pluginType="chart",uV.specKey="formatter",uV.type="formatterPlugin";function pV(t){return 2===t.length&&k(t[0])&&k(t[1])&&t[1]>=t[0]}function gV(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 mV(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 fV(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 vV(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 _V(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 yV=(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 RC(v)};class bV extends aV{constructor(){super(bV.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!Dw(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&&pV(c)&&pV(d)))return;const u=gV(t,c),p=gV(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(!fV(u,p))return}else if(0===y&&0===b){if(!fV(p,u))return}else if(_||A)if(_&&!A){if(!mV(u,p))return}else if(A&&!_){if(!mV(p,u))return}else{if(m===b)return;if(m>b){if(!vV(u,p))return}else if(!vV(p,u))return}else{if(0===m&&0===y){if(!_V(u,p))return}else if(0===b&&0===g&&!_V(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){Dz(e.getOption().dataSet,"tickAlign",yV);const t={targetAxis:()=>s,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}bV.pluginType="component",bV.type="AxisSyncPlugin";const xV=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,SV=(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},gm||(gm=um.CreateGraphic("richtext",{})),gm.setAttributes(a),gm.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}},AV="vchart-tooltip-container",kV={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}};function MV(t,e){return R(e,`component.${t}`)}function TV(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=hz.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const wV={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function CV(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 EV(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 PV(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function BV(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}const RV=(t,e,i)=>{var s;const n=null!==(s="band"===e?MV("axisBand",i):["linear","log","symlog"].includes(e)?MV("axisLinear",i):{})&&void 0!==s?s:{},r=mz(t)?MV("axisX",i):fz(t)?MV("axisY",i):MV("axisZ",i);return Tj({},MV("axis",i),n,r)},LV=(t,e,i)=>{var s;const n=null!==(s="band"===e?MV("axisBand",i):"linear"===e?MV("axisLinear",i):{})&&void 0!==s?s:{},r=MV("angle"===t?"axisAngle":"axisRadius",i);return Tj({},MV("axis",i),n,r)},OV=t=>"band"===t||"ordinal"===t||"point"===t;function IV(t,e){return{id:t,label:t,value:e,rawValue:t}}function DV(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 FV(t,e,i,s){let n=0,r=t.length-1;for(;n<=r;){const a=Math.floor((n+r)/2),o=t[a];if(o[i]<=e&&o[s||i]>=e)return o;o[i]>e?r=a-1:n=a+1}return null}const jV=(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(jw(a.type))A=a.bandwidth(),0===A&&a.step&&(M=a.step());else if(Dw(a.type)){const s=e.fieldX[0],r=e.fieldX2,a=FV(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=CV(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(jw(r.type))k=r.bandwidth(),0===k&&r.step&&(T=r.step());else if(Dw(r.type)){const s=e.fieldY[0],r=e.fieldY2,a=FV(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=CV(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(HV(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&&zV(t,"top",r.label),e.visible&&zV(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(HV(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&&zV(t,"left",a.label),e.visible&&zV(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}},zV=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=TV(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},HV=(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)}))}))},VV=(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=GV(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},NV=(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=GV(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},GV=(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},WV=(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},UV={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"]},YV=(t,e)=>{var i,s;return null!==(s=null===(i=UV[t])||void 0===i?void 0:i[0])&&void 0!==s?s:e},KV=(t,e)=>{var i,s;return null!==(s=null===(i=UV[t])||void 0===i?void 0:i[1])&&void 0!==s?s:e},XV=(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}=jV(3,e,i,s,n,r,a);return o?VV(r,o,d,h):l?NV(a,l,u,c):void 0},$V={fontFamily:vj.fontFamily,spacing:10,wordBreak:"break-word"};function qV(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:$V),{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 ZV=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},JV=(t,e)=>p(e)?t.map((t=>e[t])):void 0,QV=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),tN=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function eN(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=iN(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=>QV(i,s)(t)&&QV(n,r)(t)&&(u(a)||QV([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 sV.globalConfig.uniqueTooltip&&sV.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 sV.globalConfig.uniqueTooltip&&sV.hideTooltip(u.id),d}return"none"}const iN=(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=JV(c,t);let _=JV(d,t);const y=tN(_),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(QV(c,v));if(!y&&(_=JV(d,i),!tN(_)))return;const n=e.type===oB.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=jw(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(QV(c,n));f.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=JV(d,o),!tN(_))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(QV(c,n));if(!y&&(_=JV(d,r),!tN(_)))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===oB.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(QV(c,v))).find((t=>t[g]===m));f.forEach((n=>{if(_=JV(d,i),!tN(_))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},sN=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 nN=(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 rN{constructor(){this.activeTriggerSet={mark:new Set,dimension:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set,dimension:new Set,group:new Set}}}class aN extends rN{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:lN(e.title,{seriesId:this.series.id},!0),content:hN(e.content,{seriesId:this.series.id},!0)}))})),this.spec=a,this.activeType=sN(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 oN=(t,e,i)=>{const s=d(e)?e(t):e;return i?Object.assign(Object.assign({},t),s):Object.assign(Object.assign({},s),t)},lN=(t,e,i)=>p(t)?d(t)?(...s)=>oN(t(...s),e,i):oN(t,e,i):void 0,hN=(t,e,i)=>{const s=p(t)?Y(t).map((t=>d(t)?(...s)=>Y(t(...s)).map((t=>oN(t,e,i))):oN(t,e,i))):void 0;return s},cN=(t,e,i)=>{var s;let n={};switch(t){case"mark":case"group":e&&(n=null!==(s=nN(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=nN(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},dN=(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=uN(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)&&sN(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},uN=mt((t=>t.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(p))),[]))),pN=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},gN=(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}=TV(void 0,s,t,e);i&&r&&(n=i(...r))}return n},fN=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;class vN{}vN.dom=`${hB}_TOOLTIP_HANDLER_DOM`,vN.canvas=`${hB}_TOOLTIP_HANDLER_CANVAS`;const _N=20,yN={key:"其他",value:"..."},bN=(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)},xN=(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=fN(t.title,e,i),{visible:h,value:c,valueTimeFormat:p,valueTimeFormatMode:g,valueStyle:m,hasShape:f,valueFormatter:v}=null!=l?l:{},_=!1!==mN(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:bN(mN(c,t,i,v),p,g),valueStyle:mN(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=_N}=t,x=t.othersLine?Object.assign(Object.assign({},yN),t.othersLine):yN,S=t=>{if(null==t?void 0:t.length)for(const e of t)for(const t of null!=y?y:[]){const s=SN(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=SN(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},SN=(t,e,i)=>{const s=bN(mN(e.key,t,i,e.keyFormatter),e.keyTimeFormat,e.keyTimeFormatMode),n=bN(mN(e.value,t,i,e.valueFormatter),e.valueTimeFormat,e.valueTimeFormatMode),r=!1!==mN(e.visible,t,i)&&(p(s)||p(n)),a=mN(e.isKeyAdaptive,t,i),o=mN(e.spaceRow,t,i),l=mN(e.shapeType,t,i),h=mN(e.shapeColor,t,i),c=mN(e.shapeFill,t,i),d=mN(e.shapeStroke,t,i),u=mN(e.shapeLineWidth,t,i),g=mN(e.shapeHollow,t,i),m=mN(e.keyStyle,t,i),f=mN(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 AN extends aV{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=fN(x.position,b,e),M=null!==(n=fN(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:cB,R=null!==(o=null==P?void 0:P.height)&&void 0!==o?o:dB;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(Jy(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=xV(t,e),j=xV(T,D)}}else O.width=B,O.height=R;const z=j/F;let H,V,N,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=XV(e.dimensionInfo,rB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.x,a=t.end.x)}else W=t;if(L)switch(YV(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=XV(e.dimensionInfo,rB(this._component.getRegions(),"cartesian"),l);t&&(r=t.start.y,a=t.end.y)}else U=t;if(L)switch(KV(t)){case"top":V=r-C*z-_;break;case"bottom":V=a+_;break;case"center":V=(r+a)/2-C*z/2;break;case"centerTop":V=(r+a)/2-C*z-_;break;case"centerBottom":V=(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=WV(t,c),V=WV(i,c),N=WV(e,c),G=WV(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=WV(t,c):Y(t),S(e)||d(e)?V=WV(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(N))$=B-w*z-N;else{const t=Z;switch(YV(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(V))q=V;else if(k(G))q=R-C*z-G;else{const t=J;switch(KV(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,Jy(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"===YV(A,"right")?$+=v+w/2:$+=2*v+w)},at=()=>{et()&&($=-D.x/j)},ot=()=>{it()&&(L?$=(Q-D.x)/j-w:"center"===YV(A,"right")?$-=v+w/2:$-=2*v+w)},lt=()=>{it()&&($=(Q-D.x)/j-w)},ht=()=>{st()&&(L?q=-D.y/j:"center"===KV(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"===KV(A,"bottom")?q-=_+C/2:q-=2*_+C)},ut=()=>{nt()&&(q=(tt-D.y)/j-C)};switch(YV(A,"right")){case"center":case"centerLeft":case"centerRight":et()?(rt(),lt()):(ot(),at());break;case"left":rt(),lt();break;case"right":ot(),at()}switch(KV(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({},kV),{offsetX:null!==(t=null==i?void 0:i.x)&&void 0!==t?t:kV.offsetX,offsetY:null!==(e=null==i?void 0:i.y)&&void 0!==e?e:kV.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=$F(d.padding),S=qV(Object.assign({textAlign:"right"===y?"right":"left"},u),i),A=qV(Object.assign({textAlign:"right"===y?"right":"left"},m),i),k=qV(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:ZV(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=Tj({},A,qV(b,void 0,{})),{width:s,height:n,text:r}=SV(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=Tj({},k,qV(x,void 0,{})),{width:e,height:s,text:n}=SV(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(N){Y=Tj({},S,qV(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}=SV(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,V=H+(O?T.title.spaceRow:0)}return P+=V,B+=V,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(Jy(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=xV(t,s),u=xV(l,c)}return s*=d,n*=d,Jy(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()}}AN.specKey="tooltip";const kN=(t,e)=>p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",MN=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 TN;const wN=(t=document.body)=>{if(u(TN)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),TN=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return TN};function CN(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}=Tj({},e,t),s={};return s.width=kN(i),s}(C),R=EN(E),L=EN(P),{bottom:O,left:I,right:D,top:F}=$F(h),j="right"===m?"marginLeft":"marginRight";return{align:m,panel:{width:kN(T+2*M),minHeight:kN(g+2*M),paddingBottom:kN(O),paddingLeft:kN(I),paddingRight:kN(D),paddingTop:kN(F),borderColor:k,borderWidth:kN(M),borderRadius:kN(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)?kN(null==r?void 0:r.spaceRow):"0px"},EN(Tj({},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 PN.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=PN.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==Zy?void 0:Zy.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(PN.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}}PN.type="tooltipModel";const BN={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},RN={boxSizing:"border-box"},LN={display:"inline-block",verticalAlign:"top"},ON={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},IN={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},DN={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},FN={lineHeight:"normal",boxSizing:"border-box"};class jN extends PN{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=MN(u),y=t=>new _g({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 zN extends PN{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 HN={overflowWrap:"normal",wordWrap:"normal"};class VN extends PN{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(Tj({},LN,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=Tj({},o?IN:ON,Object.assign(Object.assign(Object.assign({height:kN(l)},HN),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 Tj({},DN,Object.assign(Object.assign(Object.assign({height:kN(s)},HN),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 Tj({},FN,Object.assign(Object.assign({height:kN(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 NN extends PN{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 VN(this.product,this._option,t,e);return i.init(),this.children[i.childIndex]=i,i}setStyle(t){super.setStyle(Tj(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+MN(e)),0);return Object.assign(Object.assign({},t),{width:`${a+wN(this._option.getContainer())}px`,maxHeight:kN(s),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class GN extends PN{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 jN(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 zN(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(Tj({},BN,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 WN="99999999999999";class UN extends PN{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:WN,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 GN(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 NN(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(Tj({},RN,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 YN=t=>{hz.registerComponentPlugin(t.type,t)};class KN extends AN{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(KN.type),this.type=vN.dom,this._tooltipContainer=null==Zy?void 0:Zy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(Zy&&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=CN(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()}))}}KN.type=vN.dom;class XN extends AN{constructor(){super(XN.type),this.type=vN.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 XP({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()}}XN.type=vN.canvas;const $N=()=>{YN(XN)},qN=(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},ZN={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}},JN=(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=Xj([],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 QN(a,n,o)},QN=(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)=>{sb(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=>{sb(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]=ZN[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},tG=(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=>{sb(t[e])||(t[e]=0)}))})),t};class eG extends DH{_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 iG=`${hB}_HIERARCHY_DEPTH`,sG=`${hB}_HIERARCHY_ROOT`,nG=`${hB}_HIERARCHY_ROOT_INDEX`;function rG(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function aG(t,e,i){t&&(i.needDefaultSeriesField&&(t[bD]=i.defaultSeriesField),t[_D]=e,t[yD]=i.getKey(t,e,i))}function oG(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function lG(t,e,i,s=0,n,r){void 0===r&&(r=e),aG(t,e,i),t[iG]=s,t[sG]=n||t[i.categoryField],t[nG]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>lG(e,s,i,t[iG]+1,t[sG],r)))}const hG=["appear","enter","update","exit","disappear","normal"];function cG(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 mG(n)&&delete n.type,n.oneByOne&&(n=uG(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:pG,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=Tj({},o[e],a);return mG(n)&&delete n.type,n.oneByOne&&(n=uG(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:pG,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s.state=s.update,s}function dG(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),fG(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 uG(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 pG(t,e){var i,s;return null!==(i=null==t?void 0:t[_D])&&void 0!==i?i:null===(s=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===s?void 0:s.elementIndex}function gG(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 mG(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function fG(t,e){if(y(t))t.forEach(((i,s)=>{t[s]=e(t[s],s),fG(t[s],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),fG(t[i],e)}class vG extends yH{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=EF(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=Pj(R(a,`series.${h}`),h,l,o),d=R(a,`series.${h}_${r}`);return Tj({},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),c(t.stackOffsetSilhouette)&&(this.stack=t.stackOffsetSilhouette||this.stack),p(t.stackValue)&&(this.stack=!0),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=Tj({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>Tj({},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 _G extends bH{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:`${hB}_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=vG,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=function(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)}(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)&&(Dz(this._rawData.dataSet,"invalidTravel",tG),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=Yz(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=Uz(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=Uz(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new eG(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;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){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];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):this._rawStatisticsCache[t]=QN(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t]}}return e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))&&(this._rawStatisticsCache[t].min=$(this._rawStatisticsCache[t].values),this._rawStatisticsCache[t].max=X(this._rawStatisticsCache[t].values)),this._rawStatisticsCache[t]}_statisticViewData(){Dz(this._dataSet,"dimensionStatistics",JN);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&&Xj(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){Dz(this._dataSet,"dimensionStatistics",JN);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=Xj(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&Xj(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)&&(Dz(this._rawData.dataSet,"addVChartProperty",qN),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:rG.bind(this),call:aG}},!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=cG({},dG(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"}}:Qy(s)||tb(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=Tj(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=Tj(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:Jz.STATE_HOVER_REVERSE,highlightState:Jz.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:Jz.STATE_SELECTED_REVERSE,state:Jz.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 t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:bD;this.getMarksWithoutRoot().forEach((t=>{const s={},n={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(s[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{n[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:xD,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][i]]:!0===s[t[i]]});const a={};Object.keys(n).forEach((e=>{a[e]=s=>{var n,a;let o;if(Array.isArray(s)){if(0===s.length)return;o=null===(n=r[s[0][i]])||void 0===n?void 0:n[e]}return o=null===(a=r[s[i]])||void 0===a?void 0:a[e],o||t.getAttribute(e,s)}})),this.setMarkStyle(t,a,xD)}))}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 aN(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=null!=i?i:{data:!0}).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((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||Kz(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()}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:bD,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new HF).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return RF(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:bD}}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()}`),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,Tj({},h,d||a[T.name]))}return T}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:yD}_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!==MD&&t!==wD&&t!==kD&&t!==TD||(t=this.getStackValueField()),null!==(e=qj(this.getRawData(),t))&&void 0!==e?e:t}getMarkInfoList(){var t;const e=super.getMarkInfoList();return e.length?e:Object.values(null!==(t=CF[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=>sb(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:bD]}}function yG(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();Dw(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 bG(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}}}_G.mark=ND,_G.transformerConstructor=vG;class xG extends _G{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);Dw(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:`${hB}_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(MD),this.setFieldX2(kD)):(this.setFieldY(MD),this.setFieldY2(kD))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(wD),this.setFieldX2(TD)):(this.setFieldY(wD),this.setFieldY2(TD))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(ED),this.setFieldX2(CD)):(this.setFieldY(ED),this.setFieldY2(CD))}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)&&(yG("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 SG="monotone",AG="linear";class kG{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($D.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:AG,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===SG?"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($D.point,{morph:gG(this._spec,$D.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:`${hB}_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(Pz.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:Jz.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[$D.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(Pz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,Tj({},this._spec[$D.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:Jz.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 MG extends zH{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)&&(Fw(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);let c=this._styleConvert(h);a&&"angle"===l&&(c=this.convertAngleToRadian(c)),this.setAttribute(l,c,e,i,s)})),o&&this.setEnableSegments(o)}}class TG extends MG{constructor(){super(...arguments),this.type=TG.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)===oB.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}TG.type="line";const wG=()=>{hz.registerMark(TG.type,TG),fM(),aM(),kR.registerGraphic(RB.line,Sg),JH()};class CG extends zH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class EG extends CG{constructor(){super(...arguments),this.type=EG.type}}EG.type="symbol";const PG=()=>{hz.registerMark(EG.type,EG),fO()};class BG extends vG{_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 RG extends eV{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function LG(t,e,i,s){switch(t){case r.cartesianBandAxis:return RV(_z(i,["z"]),"band",e);case r.cartesianLinearAxis:return RV(_z(i,["z"]),"linear",e);case r.cartesianLogAxis:return RV(_z(i,["z"]),"log",e);case r.cartesianSymlogAxis:return RV(_z(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return RV(_z(i),void 0,e);case r.polarBandAxis:return LV(i.orient,"band",e);case r.polarLinearAxis:return LV(i.orient,"linear",e);case r.polarAxis:return LV(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=MV(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>mz(t.orient)));let d;d=p(c)?Tj({},OV(c.type)?a:o,l):l;const u=n.find((t=>fz(t.orient)));let g;return g=p(u)?Tj({},jw(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=MV(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>"angle"===t.orient));let d;d=p(c)?Tj({},OV(c.type)?a:o,l):l;const u=n.find((t=>"radius"===t.orient));let g;return g=p(u)?Tj({},jw(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 OG(i,MV(t,e));default:return MV(t,e)}}const OG=(t,e)=>{var i;const s=Tj({},e,e[yz(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class IG extends yH{getTheme(t,e){return LG(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({},$F(e)),{[s]:0}))}}class DG extends SH{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 RG(this)}constructor(e,i){super(e,i),this.name="component",this.modelType="component",this.transformerConstructor=IG,this._delegateEvent=(e,i,s,n=null,r=null)=>{var a,o;i instanceof tc||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 _H({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}}}DG.transformerConstructor=IG;class FG extends zH{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(RB.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}FG.type="component";const jG=()=>{hz.registerMark(FG.type,FG)},zG=t=>t;class HG extends DG{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()?DB.circleAxisGrid:DB.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=cG(null===(o=hz.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 DH(this._option,t)]}collectData(t,e){const i=[];return sB(this._regions,(s=>{var n;let r=this.collectSeriesField(t,s);if(r=y(r)?Dw(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 sB(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=nB(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()})),sB(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(sB(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;tthis._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=az(s=t.domainLine)).startSymbol=az(s.startSymbol),s.endSymbol=az(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 lz(Tj({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:lz(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)=>lz(t[i](e.rawValue,s,e,n,r)):B(t[i])||(e[i]=lz(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 lz(Tj({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:lz(t.tick.style)),t.tick.state&&(i.tick.state=oz(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 lz(Tj({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:lz(t.subTick.style)),t.subTick.state&&(i.subTick.state=oz(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=wV[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?Qt(p):null,textStyle:Tj({},d,lz(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:lz(h.style)}),h.state&&(i.title.state.shape=oz(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:lz(o.style)}),o.state&&(i.title.state.background=oz(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=oz(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=lz(t.background.style)),t.background.state&&(i.panel.state=oz(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 lz(Tj({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:lz(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:lz(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=TV(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){Fz(this._option.dataSet,"scale",zG),Dz(this._option.dataSet,"ticks",UC);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)}}HG.specKey="axes";const VG=()=>{kR.registerGraphicComponent(IB.lineAxis,((t,e)=>new Cw(t,e))),kR.registerGraphicComponent(IB.circleAxis,(t=>new Rw(t))),kR.registerComponent(LB.axis,FO),kR.registerGraphicComponent(DB.lineAxisGrid,((t,e)=>new qC(t,e))),kR.registerGraphicComponent(DB.circleAxisGrid,((t,e)=>new JC(t,e))),kR.registerComponent(LB.grid,HO),jG(),hz.registerAnimation("axis",(()=>({appear:{custom:Ow},update:{custom:Lw},exit:{custom:Gc}})))},NG=[bV];class GG extends HG{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),sB(this._regions,(t=>{const e=this.getOrient();mz(e)?t.setXAxisHelper(this.axisHelper()):fz(e)?t.setYAxisHelper(this.axisHelper()):vz(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=Tj({x:t.x,y:t.y},this._axisStyle,n);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(Tj({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=mz(this.getOrient()),n=t=>{var e;return(s?!mz(t.getOrient()):mz(t.getOrient()))&&Dw(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=_z(i,["z"]),vz(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(!PV(e))return null;const{axisType:t,componentName:s}=bz(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=>fz(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(!PV(t))return;const{axisType:s,componentName:n}=bz(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=hz.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=[];mz(this.getOrient())?k(e)&&(o=this._inverse?[e-n,s]:[s,e-n]):vz(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(NG.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){mz(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&&!mz(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),!vz(this.getOrient())&&this._spec.innerOffset){const t=this._spec;fz(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=KF(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=KF(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=mz(this.getOrient())?t.fieldX:vz(this.getOrient())?t.fieldZ:t.fieldY,Dw(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:Dw(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&&(mz(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=mz(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 sB(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]:mz(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:vz(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();sB(this._regions,(e=>{mz(t)?(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):fz(t)?(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):vz(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=mz(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=mz(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=Tj(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 IV(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}=EV(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>=WG?10:n>=UG?5:n>=YG?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 XG extends GG{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new TC}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}}XG.type=r.cartesianLinearAxis,XG.specKey="axes",U(XG,KG);const $G=()=>{VG(),hz.registerComponent(XG.type,XG)};class qG{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=IV(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=>IV(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 ZG extends GG{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new rC}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{VG(),hz.registerComponent(ZG.type,ZG)};class QG extends XG{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),sB(this._regions,(t=>{mz(this.getOrient())?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=Tj({},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 DH(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=>IV(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=>IV(e.value,this._getNormalizedValue([e.value],t))))),s}transformScaleDomain(){}}QG.type=r.cartesianTimeAxis,QG.specKey="axes";class tW extends XG{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new EC}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(){}}tW.type=r.cartesianLogAxis,tW.specKey="axes",U(tW,KG);class eW extends XG{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new PC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}transformScaleDomain(){}}eW.type=r.cartesianSymlogAxis,eW.specKey="axes",U(eW,KG);class iW extends xG{constructor(){super(...arguments),this.type=oB.line,this.transformerConstructor=BG,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(cG(null===(i=hz.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),dG("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=bG(this);this._symbolMark.setAnimationConfig(cG(null===(s=hz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),dG("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]}}iW.type=oB.line,iW.mark=qD,iW.transformerConstructor=BG,U(iW,kG);class sW{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)=>{Kz(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 nW{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)=>{nb(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{Xj(e,[{key:t,operations:Dw(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&&Xj(e,[{key:i.field,operations:Dw(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?NF("colorOrdinal"):NF(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(nb(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),nb(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(!nb(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=Dw(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=Dw(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;Dw(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(Dw(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=Dw(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)));Dw(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 rW{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=Zj(t,!0);for(const e in a)for(const i in a[e].nodes)ez(a[e].nodes[i],t.getStackInverse(),n);if(r)for(const t in a)for(const e in a[t].nodes)tz(a[t].nodes[e]);s&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&Qj(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 aW extends pH{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=ib(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:cB,height:dB},this._viewRect={width:cB,height:dB},this._viewBox={x1:0,y1:0,x2:cB,y2:dB},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=$F(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new Rz(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new sW(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._spec.background&&"object"==typeof this._spec.background&&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 rW(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=function(t){if(!t)return null;if("string"==typeof t)return{fill:t,fillOpacity:1};if("object"!=typeof t)return null;const e=H(t,["x","y","width","height","x1","y1","image"]);return e.background=t.image,e}(this._spec.background);t&&(this._backgroundMark=hz.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({},t),{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=hz.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 bH)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 zH))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof zH)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&&Kz(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=nH(this._spec,this._option,{width:cB,height:dB})),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=RF(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new nW(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){rH(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=RF(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{rH(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{var s,n;const r=i.specKey||i.type,a=null!==(s=this._spec[r])&&void 0!==s?s:{};y(a)?(e[r]=e[r]||{specCount:a.length,componentCount:0},e[r].componentCount++,rH(t,i.updateSpec(null!==(n=a[i.getSpecIndex()])&&void 0!==n?n:{},a))):rH(t,i.updateSpec(a))}));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()];rH(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=XF(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(Jz.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(Jz.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(Jz.STATE_SELECTED)}clearHovered(){this.clearState(Jz.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===Pz.dimensionHover||s===Pz.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>jw(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=>{r?i[t.series.fieldY[0]]=s:i[t.series.fieldX[0]]=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 oW=(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 lW{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);xj(t,r,l.spec),xj(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}));xj(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=oW(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=oW(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(hz.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(hz.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=hz.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=hz.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=hz.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 hW extends lW{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")&&Tj(i,aH(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 cW extends hW{_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),sH(t)}}class dW extends aW{constructor(){super(...arguments),this.transformerConstructor=cW,this.type="line",this.seriesType=oB.line,this._canStack=!0}}dW.type="line",dW.seriesType=oB.line,dW.transformerConstructor=cW;class uW extends MG{constructor(){super(...arguments),this.type=uW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}uW.type="area";const pW=()=>{hz.registerMark(uW.type,uW),fM(),qk(),kR.registerGraphic(RB.area,Wg),JH()};class gW extends aN{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 mW=()=>{hz.registerAnimation("area",qH),ZH(),XH()};class fW extends BG{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=Tj({},m.style,g.style),l.state=Tj({},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 vW extends xG{constructor(){super(...arguments),this.type=oB.area,this.transformerConstructor=fW,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(vW.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===SG?"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 GF(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 GF(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(cG(null===(e=hz.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),dG("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(cG(null===(i=hz.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),dG("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=bG(this);this._symbolMark.setAnimationConfig(cG(null===(s=hz.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),dG("point",this._spec,this._markAttributeContext),t))}}initTooltip(){this._tooltipHelper=new gW(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}}}vW.type=oB.area,vW.mark=JD,vW.transformerConstructor=fW,U(vW,kG);class _W extends hW{_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),sH(t)}}class yW extends aW{constructor(){super(...arguments),this.transformerConstructor=_W,this.type="area",this.seriesType=oB.area,this._canStack=!0}}yW.type="area",yW.seriesType=oB.area,yW.transformerConstructor=_W;function bW(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 xW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:bW(t,e)}),SW=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:bW(t,e)}),AW={type:"fadeIn"},kW={type:"growCenterIn"};function MW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return AW;case"scaleIn":return kW;default:return xW(t)}}class TW extends zH{constructor(){super(...arguments),this.type=TW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}TW.type="rect";const wW=()=>{hz.registerMark(TW.type,TW),gO(),uO.useRegisters([VI,NI,GI,WI,zI,HI])};function CW(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[GD]):this._spec.barMinHeight?this._calculateRectPosition(t,!1):GF(this._dataToPosX(t),e),this._getBarXEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[WD]):GF(this._dataToPosX1(t),e),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[UD]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):GF(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[YD]):GF(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({},BW.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{morph:gG(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(BW.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(Dz(this._option.dataSet,"addVChartProperty",qN),s){const t=([t],{scaleDepth:e})=>{var i;let s=[{}];const n=this.getDimensionField(),r=u(e)?n.length:Math.min(n.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};Dz(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:rG.bind(this),call:aG}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new eG(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=YD,s=UD,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=WD,s=GD,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=Zj(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)CW(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=GF(this[n](t),o),d=GF(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[kD],n=t[MD],r=t[TD],h=t[wD];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]),{[kD]:i,[MD]:s}),a?{[TD]:o,[wD]:l}:void 0);t.push(Mg(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=>GF(this._dataToPosY(t),a),y1:t=>GF(this._dataToPosY1(t),a)}:{y:t=>GF(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=>GF(this._dataToPosX(t),r),x1:t=>GF(this._dataToPosX1(t),r)}:{x:t=>GF(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=bG(this);this._barMark.setAnimationConfig(cG(null===(e=hz.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),dG(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;if(void 0!==this._spec.barWidth&&r===n)return ZF(this._spec.barWidth,a);const o=void 0!==this._spec.barMinWidth,l=void 0!==this._spec.barMaxWidth;let h=a;return o&&(h=Math.max(h,ZF(this._spec.barMinWidth,a))),l&&(h=Math.min(h,ZF(this._spec.barMaxWidth,a))),h}_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=ZF(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=Dw(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}}BW.type=oB.bar,BW.mark=KD,BW.transformerConstructor=PW;const RW=()=>{iI(),wW(),hz.registerAnimation("bar",((t,e)=>({appear:MW(t,e),enter:xW(t,!1),exit:SW(t,!1),disappear:SW(t)}))),JG(),$G(),hz.registerSeries(BW.type,BW)};class LW extends hW{_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),sH(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 OW extends aW{constructor(){super(...arguments),this.transformerConstructor=LW,this.type="bar",this.seriesType=oB.bar,this._canStack=!0}}OW.type="bar",OW.seriesType=oB.bar,OW.transformerConstructor=LW;class IW extends zH{constructor(){super(...arguments),this.type=IW.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}IW.type="rect3d";class DW extends BW{constructor(){super(...arguments),this.type=oB.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d"}}DW.type=oB.bar3d,DW.mark=XD;class FW extends LW{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}class jW extends OW{constructor(){super(...arguments),this.transformerConstructor=FW,this.type="bar3d",this.seriesType=oB.bar3d}}jW.type="bar3d",jW.seriesType=oB.bar3d,jW.transformerConstructor=FW;const zW=[10,20],HW=Pw.Linear,VW="circle",NW=Pw.Ordinal,GW=["circle","square","triangle","diamond","star"],WW=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class UW extends vG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class YW extends xG{constructor(){super(...arguments),this.type=oB.scatter,this.transformerConstructor=UW,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=`${hB}_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=`${hB}_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:HW,defaultRange:zW},"size")}getShapeAttribute(t,e){return u(e)?VW:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:NW,defaultRange:GW},"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(YW.mark.point,{morph:gG(this._spec,YW.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=bG(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(cG(null===(i=hz.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),dG("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:VW},Jz.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},Jz.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},Jz.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},Jz.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},Jz.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]}}YW.type=oB.scatter,YW.mark=ZD,YW.transformerConstructor=UW;const KW=()=>{PG(),hz.registerAnimation("scatter",((t,e)=>Object.assign({appear:WW(0,e)},YH))),JG(),$G(),hz.registerSeries(YW.type,YW)};class XW extends hW{_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 $W extends aW{constructor(){super(...arguments),this.transformerConstructor=XW,this.type="scatter",this.seriesType=oB.scatter,this._canStack=!0}}$W.type="scatter",$W.seriesType=oB.scatter,$W.transformerConstructor=XW;Rn();const qW={},ZW=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function JW(t,e){t&&_(t)||ob("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(qW[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 ZW.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}(i,e)),qW[i]||null}const QW={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(QW).forEach((t=>{JW(t,QW[t])}));const tU="Feature",eU="FeatureCollection";function iU(t){const e=Y(t);return 1===e.length?e[0]:{type:eU,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===eU?t.features:Y(t).filter((t=>!u(t))).map((t=>t.type===tU?t:{type:tU,geometry:t}))}(e))),[])}}const sU=ZW.concat(["pointRadius","fit","extent","size"]);function nU(t,e){let i=[];return t?(Object.keys(t).forEach((s=>{sU.includes(s)&&(i=i.concat(dR(t[s],e)))})),i):i}let rU=class extends $R{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(dR(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(dR(t,this.view)),this.commit(),this}size(t){return u(this.spec.size)||this.detach(dR(this.spec.size,this.view)),this.spec.size=t,this.attach(dR(t,this.view)),this.commit(),this}extent(t){return u(this.spec.extent)||this.detach(dR(this.spec.extent,this.view)),this.spec.extent=t,this.attach(dR(t,this.view)),this.commit(),this}fit(t){return u(this.spec.fit)||this.detach(dR(this.spec.fit,this.view)),this.spec.fit=t,this.attach(dR(t,this.view)),this.commit(),this}configure(t){return this.detach(nU(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(nU(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=JW((t||"mercator").toLowerCase());return e||ob("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),ZW.forEach((t=>{u(this.spec[t])||function(t,e,i){d(t[e])&&t[e](i)}(this.projection,t,pR(this.spec[t],e,JW))})),u(this.spec.pointRadius)||this.projection.path.pointRadius(pR(this.spec.pointRadius,e,JW)),!(u(this.spec.fit)||u(this.spec.extent)&&u(this.spec.size))){const t=iU(pR(this.spec.fit,e,JW));this.spec.extent?this.projection.fitExtent(pR(this.spec.extent,e,JW),t):this.spec.size&&this.projection.fitSize(pR(this.spec.size,e,JW),t)}return this.projection}output(){return this.projection}};const aU=(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 oU extends _G{constructor(){super(...arguments),this.type=oB.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=`${hB}_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 lU=`${hB}_MAP_LOOK_UP_KEY`,hU=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[_D]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[lU]=e.nameMap[n]:t[lU]=n})),t.features);class cU extends aN{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 dU extends zH{constructor(){super(...arguments),this.type=dU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}dU.type="path";const uU=()=>{hz.registerMark(dU.type,dU),pO()};class pU{constructor(t){this.projection=JW(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 gU{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 mU{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 fU(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:gU}:Qy(e)||tb(e)?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:mU}:null}const vU={debounce:bt,throttle:xt};class _U{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=Qy(this._renderMode)||tb(this._renderMode),fU(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return fU(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;u(n)||Ie({x:r,y:a},this._getRegionOrSeriesLayout(e),!1)&&(i&&i({zoomDelta:n,zoomX:r,zoomY:a},s),this._eventObj.emit("zoom",{scale:s.zoomDelta,scaleCenter:{x:s.zoomX,y:s.zoomY},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,vU[o]((t=>{this._zoomableTrigger.clearZoom()}),l)),h.on(...c,vU[o]((t=>{this._zoomEventDispatch(t,i,s)}),l))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||fU(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||fU(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,vU[o]((t=>{this._zoomableTrigger.clearScroll()}),l)),h.on(...c,vU[o]((t=>this._scrollEventDispatch(t,i,s)),l))}initScrollEventOfSeries(t,e,i){fU(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||fU(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||fU(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||fU(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=vU[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)}),l),_=vU[o]((t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1;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 yU(t,e){return`${hB}_${e}_${t}`}class bU extends DG{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:yU(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),e&&(e.zoomDelta=l),this.zoom(l,[t.zoomX,t.zoomY]),l},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=Tj(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},s=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,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 pU(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===oB.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),sB(this._regions,(t=>{var e;if(t.type===oB.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===oB.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[lU],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}}bU.type=r.geoCoordinate,U(bU,_U);const xU=()=>{hz.registerComponent(bU.type,bU)};class SU extends vG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class AU extends oU{constructor(){super(...arguments),this.type=oB.map,this.transformerConstructor=SU,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 !`),jz.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),Dz(this._dataSet,"copyDataView",Wz),Dz(this._dataSet,"map",hU),Dz(this._dataSet,"lookup",aU);const i=jz.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:Xz.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:lU,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 eG(this._option,s)}initMark(){this._pathMark=this._createMark(AU.mark.area,{morph:gG(this._spec,AU.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:bD])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:bD]):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(cG(null===(t=hz.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),dG("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new cU(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[_D]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[_D],{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 _D}getActiveMarks(){return[this._pathMark]}}AU.type=oB.map,AU.mark=sF,AU.transformerConstructor=SU;const kU=()=>{kR.registerGrammar("projection",rU,"projections"),xU(),uU(),hz.registerSeries(AU.type,AU),hz.registerImplement("registerMap",Vz),hz.registerImplement("unregisterMap",Nz),$H()},MU=(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[RD]=!0:delete t[RD]})),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=TU([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}=wU(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=TU(a,t,n,r,h,l,i,e),r.push(n)})),r};function TU(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}=wU(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===pD)&&(t[pD]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function wU(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?Ky("total.collectCountField error"):n=e[a].start;o<0?Ky("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 CU=(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},EU={type:"fadeIn"},PU={type:"growCenterIn"};function BU(t,e){switch(e){case"fadeIn":return EU;case"scaleIn":return PU;default:return xW(t,!1)}}class RU extends zH{constructor(){super(...arguments),this.type=RU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}RU.type="rule";const LU=()=>{hz.registerMark(RU.type,RU),mO()},OU=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:IU(t.map((t=>t.latestData)).flat(),e.fields,i)}};function IU(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)=>IU(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class DU{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"}),Dz(e,"dimensionTree",OU),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 FU extends PW{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel")}}const jU={rect:GU,symbol:VU,arc:UU,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=VU(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1);return e},stackLabel:YU,line:KU,area:KU,rect3d:GU,arc3d:UU,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function zU(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}=TV(i,s,o.text,e);return h&&(o.text=h(...c,{series:a})),o}function HU(t){return d(t)?e=>t(e.data):t}function VU(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=HU(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:NU(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function NU(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function GU(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=HU(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:WU(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function WU(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 UU(t){var e;const{labelSpec:i}=t,s=null!==(e=HU(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 YU(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=zU(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),gp(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 KU(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 XU extends BW{constructor(){super(...arguments),this.type=oB.waterfall,this.transformerConstructor=FU,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 DU(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=pD)}getSeriesKeys(){return this._seriesField===pD?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),Dz(this._dataSet,"waterfallFillTotal",CU),Dz(this._dataSet,"waterfall",MU),(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=Uz(this.getViewData(),this._dataSet,{name:`${hB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new eG(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:kD,endAs:MD,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=bG(this);this._barMark.setAnimationConfig(cG(null===(i=hz.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),dG("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(cG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),dG("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(XU.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){if(!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible))return super.initLabelMarkStyle(t),void(this._labelMark=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 YU(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?GF(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):GF(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))}}XU.type=oB.waterfall,XU.mark=uF,XU.transformerConstructor=FU;const $U=()=>{LU(),wW(),hz.registerAnimation("waterfall",((t,e)=>({appear:BU(t,e),enter:xW(t,!1),exit:SW(t,!1),disappear:SW(t,!1)}))),$H(),JG(),$G(),hz.registerSeries(XU.type,XU)},qU=`${hB}_BOX_PLOT_OUTLIER_VALUE`;var ZU;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(ZU||(ZU={}));const JU=(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={[qU]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class QU extends aN{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===ZU.OUTLIER)return this.series.getOutliersField();if(t===ZU.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case ZU.MIN:return this.series.getMinField();case ZU.MAX:return this.series.getMaxField();case ZU.MEDIAN:return this.series.getMedianField();case ZU.Q1:return this.series.getQ1Field();case ZU.Q3:return this.series.getQ3Field();case ZU.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===ZU.OUTLIER)return e[qU];if(t===ZU.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case ZU.MIN:return e[this.series.getMinField()];case ZU.MAX:return e[this.series.getMaxField()];case ZU.MEDIAN:return e[this.series.getMedianField()];case ZU.Q1:return e[this.series.getQ1Field()];case ZU.Q3:return e[this.series.getQ3Field()];case ZU.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[qU])}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.dimensionTooltipTitleCallback,hasShape:!1},content:[{key:this.getContentKey(ZU.OUTLIER),value:this.getContentValue(ZU.OUTLIER),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(ZU.MAX),value:this.getContentValue(ZU.MAX),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(ZU.Q3),value:this.getContentValue(ZU.Q3),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(ZU.MEDIAN),value:this.getContentValue(ZU.MEDIAN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(ZU.Q1),value:this.getContentValue(ZU.Q1),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(ZU.MIN),value:this.getContentValue(ZU.MIN),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1},{key:this.getContentKey(ZU.SERIES_FIELD),value:this.getContentValue(ZU.SERIES_FIELD),hasShape:!0,shapeType:this.shapeTypeCallback,shapeColor:this.shapeColorCallback,shapeStroke:this.shapeStrokeCallback,shapeHollow:!1}]}}}class tY extends zH{constructor(){super(...arguments),this.type=tY.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}}tY.type="boxPlot";const eY=()=>{hz.registerMark(tY.type,tY),kR.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(SO).registerChannelEncoder("x",((t,e,i,s,n,r)=>r&&_b(r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,s,n,r)=>r&&_b(r.direction)?{shaft:{y:e,y1:e}}:null)).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&_b(r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&_b(r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&_b(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&&_b(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&&_b(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&&_b(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}}))),kR.registerAnimationType("boxplotScaleIn",AO),kR.registerAnimationType("boxplotScaleOut",kO),_O(),gO(),mO(),kR.registerGlyph("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(TO).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&_b(r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&_b(r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&_b(r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&_b(r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&_b(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}}))),kR.registerAnimationType("barBoxplotScaleIn",wO),kR.registerAnimationType("barBoxplotScaleOut",CO),_O(),gO(),mO()};class iY extends xG{constructor(){super(...arguments),this.type=oB.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(iY.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(iY.mark.outlier,{progressive:t,key:_D,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,Jz.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"},Jz.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=>GF(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>GF(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>GF(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>GF(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>GF(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},Jz.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=>GF(e(this.getDatumPositionValues(t,qU),{bandPosition:this._bandPosition}),s)}:{x:this.dataToPositionX.bind(this),y:t=>GF(e(this.getDatumPositionValues(t,qU),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,Jz.STATE_NORMAL,t.AttributeLevel.Series)}}initData(){if(super.initData(),!this._data)return;Dz(this._dataSet,"foldOutlierData",JU),Dz(this._dataSet,"addVChartProperty",qN);const t=new _a(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${hB}_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:rG.bind(this),call:aG}},!1),this._outlierDataView=new eG(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=bG(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=hz.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(dG("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(cG(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(cG(null===(a=hz.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new QU(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]}}iY.type=oB.boxPlot,iY.mark=pF;class sY extends zH{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=sY.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})}}sY.type="text";const nY=()=>{hz.registerMark(sY.type,sY),vO(),fM(),gM(),kR.registerGraphic(RB.richtext,jg)};function rY(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 aY extends aN{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 oY=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),lY={type:"fadeIn"},hY=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function cY(t,e){return"fadeIn"===e?lY:oY(t)}class dY extends PW{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 uY extends BW{constructor(){super(...arguments),this.type=oB.rangeColumn,this._barMarkType="rect",this._barName=oB.bar,this.transformerConstructor=dY}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(uY.mark.bar,{morph:gG(this._spec,uY.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(uY.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(uY.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}});rY(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}});rY(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=bG(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(cG(null===(i=hz.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),dG("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(cG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),dG("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(cG(null===(n=hz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),dG("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new aY(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)}}uY.type=oB.rangeColumn,uY.mark=yF,uY.transformerConstructor=dY;const pY=()=>{wW(),nY(),hz.registerAnimation("rangeColumn",((t,e)=>({appear:cY(t,e),enter:oY(t),exit:hY(t),disappear:hY(t)}))),$H(),JG(),$G(),hz.registerSeries(uY.type,uY)};class gY extends uY{constructor(){super(...arguments),this.type=oB.rangeColumn3d,this._barMarkType="rect3d",this._barName=oB.bar3d}}gY.type=oB.rangeColumn3d,gY.mark=bF;class mY extends aN{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 fY extends vW{constructor(){super(...arguments),this.type=oB.rangeArea}initMark(){var t;const{customShape:e,stateSort:i}=null!==(t=this._spec.area)&&void 0!==t?t:{};this._areaMark=this._createMark(fY.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 mY(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))}}fY.type=oB.rangeArea,fY.mark=kF;class vY extends _G{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=EB,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:[]};Dw(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:[]};Dw(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)&&yG(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 _Y=(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[_B],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[_B]*t;g(e,b,i),b+=i}))}return 0!==m&&(i[i.length-1][l]=r),i};function yY(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const bY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:yY(t,!0,qz.appear)}),xY={type:"fadeIn"},SY=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:yY(t,!0,qz.enter)}),AY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:yY(t,!0,qz.exit)}),kY=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:yY(t,!0,qz.exit)});function MY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return xY;case"growRadius":return bY(Object.assign(Object.assign({},t),{growField:"radius"}));default:return bY(Object.assign(Object.assign({},t),{growField:"angle"}))}}class TY extends zH{constructor(t,e){super(t,e),this.type=wY.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[AB])[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 wY extends TY{constructor(){super(...arguments),this.type=wY.type}}wY.type="arc";const CY=()=>{fM(),Xk(),kR.registerGraphic(RB.arc,Kg),uO.useRegisters([QI,tD,ZI,JI]),hz.registerMark(wY.type,wY)};class EY extends vG{_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=Tj({},this._theme,i,t);const n=(t,e)=>Tj({},"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 PY extends vY{constructor(){super(...arguments),this.transformerConstructor=EY,this._pieMarkName="pie",this._pieMarkType="arc",this._startAngle=TB,this._endAngle=wB,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this.dataToCentralPosition=t=>{const e=t[AB];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;Dz(this._dataSet,"pie",_Y),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:bB,asEndAngle:xB,asRatio:yB,asMiddleAngle:AB,asRadian:MB,asQuadrant:kB,asK:SB}},!1);const e=new _a(this._dataSet,{name:`${hB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new eG(this._option,e)}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},PY.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{morph:gG(this._spec,this._pieMarkName),defaultMorphElementKey:this._seriesField,key:yD,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 aB(bB)(t)}endAngleScale(t){return aB(xB)(t)}initMarkStyle(){const e=this._pieMark;e&&this.setMarkStyle(e,{x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:WF(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:WF(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:aB(mB).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[AB];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===qz.appear)return this._startAngle;if(i===qz.disappear)return this._endAngle;const n=[qz.disappear,qz.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[_D];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[_D]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[_D])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[_D])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+ie({x:0,y:0},a,e[AB]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+ie({x:0,y:0},a,e[AB]).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[AB]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+ie({x:0,y:0},a,e[AB]).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]}}PY.transformerConstructor=EY,PY.mark=tF;class BY extends PY{constructor(){super(...arguments),this.type=oB.pie}}BY.type=oB.pie;const RY=()=>{CY(),hz.registerAnimation("pie",((t,e)=>({appear:MY(t,e),enter:SY(t),exit:AY(t),disappear:kY(t)}))),hz.registerSeries(BY.type,BY)};class LY extends TY{constructor(){super(...arguments),this.type=LY.type,this._support3d=!0}}LY.type="arc3d";class OY extends EY{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class IY extends PY{constructor(){super(...arguments),this.type=oB.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=OY}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[AB];return"inside"===i.position?te(e):0},this.setMarkStyle(e,Object.assign(Object.assign({},s),{z:100}),void 0,t.AttributeLevel.Mark)}}IY.type=oB.pie3d,IY.mark=eF,IY.transformerConstructor=OY;const DY=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)=>e.getGraphicAttribute("innerRadius")},outerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("outerRadius")}}}},FY={type:"fadeIn"},jY=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),zY=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),HY=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function VY(t,e){if(!1===e)return{};switch(e){case"fadeIn":return FY;case"growAngle":return DY(Object.assign(Object.assign({},t),{growField:"angle"}));default:return DY(Object.assign(Object.assign({},t),{growField:"radius"}))}}class NY extends vY{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(MD),this.setInnerRadiusField(kD)}setValueFieldToPercent(){this.setRadiusField(wD),this.setInnerRadiusField(TD)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}class GY extends vG{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}const WY=(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:CB,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:EB,layoutRadius:e.layoutRadius}};class UY extends HG{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(!BV(e))return null;const{axisType:i,componentName:s,startAngle:n,endAngle:r,center:a,outerRadius:o,layoutRadius:l}=WY(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(!BV(e))return;const{axisType:a,componentName:o,startAngle:l,endAngle:h,center:c,outerRadius:d,layoutRadius:u}=WY(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=hz.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=TB,this._endAngle=wB,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),sB(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:CV(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(){sB(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 Dw(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:Dw(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:KF(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:KF(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=>IV(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=EB,e=0;const i=this.getChart().getSpec();return sB(this.getRegions(),(s=>{const n=s;if(r=n.type,[oB.rose,oB.radar,oB.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(Tj({},this._axisStyle,s)),this._gridMark){this._gridMark.getProduct().encode(Tj({},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)}}UY.type=r.polarAxis,UY.specKey="axes";class YY extends UY{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new TC}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}}YY.type=r.polarLinearAxis,YY.specKey="axes",U(YY,KG);const KY=()=>{VG(),hz.registerComponent(YY.type,YY)};class XY extends UY{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new rC}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(){}}XY.type=r.polarBandAxis,XY.specKey="axes",U(XY,qG);const $Y=()=>{VG(),hz.registerComponent(XY.type,XY)};class qY extends NY{constructor(){super(...arguments),this.type=oB.rose,this.transformerConstructor=GY,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(qY.mark.rose,{morph:gG(this._spec,qY.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=>GF(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=GF(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(cG(null===(i=hz.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),dG("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}qY.type=oB.rose,qY.mark=iF,qY.transformerConstructor=GY;const ZY=()=>{hz.registerSeries(qY.type,qY),CY(),hz.registerAnimation("rose",((t,e)=>({appear:VY(t,e),enter:jY(t),exit:zY(t),disappear:HY(t)}))),$Y(),KY()};class JY extends gc{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);k(t*e)||(this.valid=!1),this._fromAngle=t,this._fromRadius=e;const{angle:i,radius:s}=this._pointToCoord(this.to);k(i*s)||(this.valid=!1),this._toAngle=i,this._toRadius=s}onUpdate(t,e,i){if(!1!==this.valid)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 QY extends zc{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}),r=ne(s.angle),a=ne(n.angle),o=this._pointToCoord(e),l=this._pointToCoord({x:e.x1,y:e.y1}),h=ne(o.angle),c=ne(l.angle),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 tK=t=>({type:"in"===t?"fadeIn":"fadeOut"});function eK(t,e,i){return"fadeIn"===e?tK(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function iK(t,e,i){return"fadeIn"===e?tK(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 sK=(t,e)=>({custom:Vc,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 nK extends NY{constructor(){super(...arguments),this.type=oB.radar,this.transformerConstructor=BG,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(nK.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:AG,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):TB,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(cG(null===(s=hz.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),dG("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=hz.getAnimationInKey(e);t.setAnimationConfig(cG(null==i?void 0:i(n,r),dG(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}}}nK.type=oB.radar,nK.mark=QD,nK.transformerConstructor=BG,U(nK,kG);const rK=()=>{hz.registerSeries(nK.type,nK),sI(),pW(),wG(),PG(),hz.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:eK(t,e,"in"),enter:eK(t,e,"in"),exit:eK(t,e,"out"),disappear:"clipIn"===e?void 0:eK(t,e,"out"),update:[{options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:QY,customParameters:t,duration:UH.update.duration,easing:UH.update.easing}]}))),hz.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:iK(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:iK(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:JY,customParameters:t,duration:UH.update.duration,easing:UH.update.easing}]}))),hz.registerAnimation("radarGroup",((t,e)=>({appear:sK(t,"in"),disappear:sK(t,"out")}))),Xk(),$Y(),KY()};class aK extends aN{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 oK=(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},lK={fill:"#bbb",fillOpacity:.2};class hK extends xG{constructor(){super(...arguments),this.type=oB.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]])),Dz(this._option.dataSet,"objFlat",oK),Dz(this._option.dataSet,"copyDataView",Wz),Fz(this._option.dataSet,"dataview",pa),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:Xz.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(Tj(lK,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(hK.mark.group),this._containerMark=this._createMark(hK.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(hK.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(hK.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(hK.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(hK.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(hK.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(hK.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:bD}}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 HF).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:bD}}initTooltip(){this._tooltipHelper=new aK(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]}}hK.type=oB.dot,hK.mark=oF;class cK extends aN{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 dK=(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 uK extends xG{constructor(){super(...arguments),this.type=oB.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(),Dz(this._option.dataSet,"linkDotInfo",dK),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:Xz.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(uK.mark.group),this._containerMark=this._createMark(uK.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(uK.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(uK.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:bD}}initInteraction(){const t=[];this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new cK(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]}}uK.type=oB.link,uK.mark=aF;class pK extends vY{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()?kD:LD],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()?MD: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):TB;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?Qt(r):wB,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=GF(this.angleAxisHelper.dataToPosition([t[kD]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=GF(this.angleAxisHelper.dataToPosition([t[MD]]),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(pK.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 Kg(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[Mg({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 fK=()=>{hz.registerAnimation("circularProgress",((t,e)=>({appear:mK(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class vK extends vG{constructor(){super(...arguments),this._supportStack=!0}}class _K extends pK{constructor(){super(...arguments),this.type=oB.circularProgress,this.transformerConstructor=vK,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(_K.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(_K.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()?kD:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?MD: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(cG(null===(i=hz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),dG("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(cG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),dG("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}_K.type=oB.circularProgress,_K.mark=rF,_K.transformerConstructor=vK;function yK(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const bK=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:yK(t)}),xK={type:"fadeIn"};function SK(t,e){return!1===e?{}:"fadeIn"===e?xK:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:yK(t)}))(t)}class AK extends aN{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 kK extends xG{constructor(){super(...arguments),this.type=oB.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(kK.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 GF(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 GF(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 GF(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 GF(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(kK.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 GF(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 GF(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(kK.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=GF(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(Mg({x:i,y:0,height:r,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=GF(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(Mg({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(cG(null===(i=hz.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),dG("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(cG(null===(s=hz.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),dG("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new AK(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}kK.type=oB.linearProgress,kK.mark=dF;const MK=()=>{wW(),hz.registerAnimation("linearProgress",((t,e)=>({appear:SK(t,e),enter:{type:"grow"},disappear:bK(t)}))),$H(),hz.registerSeries(kK.type,kK)},TK=[0],wK=[20,40],CK=[200,500],EK={shrink:!1,enlarge:!1,fontSizeLimitMin:0},PK=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],BK=`${hB}_WORD_CLOUD_WEIGHT`,RK=`${hB}_WORD_CLOUD_TEXT`;class LK extends _G{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=wK}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:CK,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:TK,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)?RK:this._nameField,this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:EK},this._spec.wordCloudConfig),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:TK,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=!PK.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(LK.mark.word,{key:yD,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(cG(hz.getAnimationInKey("wordCloud")(n,s),dG("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 HF).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:bD])}}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 TC,o=this._fontWeightRange;if(r){const[e,i]=ub(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:BK,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:RK,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:Jy(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[r,a],shape:this._maskShape,dataIndexKey:yD,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:BK}: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:yD,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:BK}: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)}}LK.mark=lF;function OK(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)||UH.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 DK(){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 FK(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 jK=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function zK(t){return d(t)?t:function(){return t}}class HK{constructor(t){var e,i,s;switch(this.options=z({},HK.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=(s=this.options.shape,IK[s]?IK[s]():IK.circle()),this.getText=null!==(e=zK(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=zK(this.options.fontWeight),this.getTextFontSize=zK(this.options.fontSize),this.getTextFontStyle=zK(this.options.fontStyle),this.getTextFontFamily=zK(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>jK(10,50);break;case"random-light":this.getTextColor=()=>jK(50,90);break;default:this.getTextColor=zK(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 NK extends HK{constructor(t){var e;super(z({},NK.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<=NK.defaultOptions.minFontSize&&(this.options.minFontSize=NK.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=VK[this.options.spiral])&&void 0!==e?e:VK.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=zK(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}=FK(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(E_.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(YK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(UK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}YK(p,this._size)&&(p=KK(p,this._size))}else if(YK(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||WK(p,i))&&(!i||!GK(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 GK(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 WK(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,YK=(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 KK(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}=FK(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)}$K.defaultOptions={enlarge:!1};const ZK={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},JK=(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?QK(t.fontFamily):"sans-serif",d=t.fontStyle?QK(t.fontStyle):"normal",u=t.fontWeight?QK(t.fontWeight):"normal",p=t.rotate?QK(t.rotate):0,g=QK(t.text),m=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",f=t.padding?QK(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||ZK,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?QK(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=eX(iX(t,l),C);w=i=>e(t(i))}let E=NK;"fast"===t.layoutType?E=$K:"grid"===t.layoutType&&(E=XK);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()},QK=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],tX=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),eX=(t,e)=>{if(t[0]===t[1])return t=>e[0];const i=tX(t[0]),s=tX(t[1]),n=Math.min(i,s),r=Math.max(i,s);return t=>(tX(t)-n)/(r-n)*(e[1]-e[0])+e[0]},iX=(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 sX(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{kR.registerTransform("wordcloud",{transform:JK,markPhase:"beforeJoin"},!0),nY(),hz.registerAnimation("wordCloud",((t,e)=>({appear:OK(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),hz.registerSeries(nX.type,nX)};(class extends LK{constructor(){super(...arguments),this.type=oB.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(LK.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(cG(null===(e=hz.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}})),dG("word",this._spec,this._markAttributeContext)))}}).type=oB.wordCloud3d;const aX=(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},oX=(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},lX=`${hB}_FUNNEL_TRANSFORM_RATIO`,hX=`${hB}_FUNNEL_REACH_RATIO`,cX=`${hB}_FUNNEL_HEIGHT_RATIO`,dX=`${hB}_FUNNEL_VALUE_RATIO`,uX=`${hB}_FUNNEL_LAST_VALUE_RATIO`,pX=`${hB}_FUNNEL_NEXT_VALUE_RATIO`,gX=`${hB}_FUNNEL_LAST_VALUE`,mX=`${hB}_FUNNEL_CURRENT_VALUE`,fX=`${hB}_FUNNEL_NEXT_VALUE`,vX=`${hB}_FUNNEL_TRANSFORM_LEVEL`,_X=20;class yX extends aN{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[hX])).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 bX extends zH{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class xX extends bX{constructor(){super(...arguments),this.type=xX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}xX.type="polygon";const SX=()=>{hz.registerMark(xX.type,xX),fM(),cM(),kR.registerGraphic(RB.polygon,qg),uO.useRegisters([UI,YI])};class AX extends vG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class kX extends _G{constructor(){super(...arguments),this.type=oB.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=AX,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;Dz(this._dataSet,"funnel",aX),Dz(this._dataSet,"funnelTransform",oX);const t=new _a(this._dataSet,{name:`${hB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new eG(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:mX,asTransformRatio:lX,asReachRatio:hX,asHeightRatio:cX,asValueRatio:dX,asNextValueRatio:pX,asLastValueRatio:uX,asLastValue:gX,asNextValue:fX,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:vX}})}initMark(){var t,e,i,s,n,r,a,o,l,h,c,d;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},kX.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,morph:gG(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({},kX.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(kX.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(kX.mark.outerLabelLine,{themeSpec:e,markSpec:t,depend:[this._funnelOuterLabelMark.label],noSeparateStyle:!0})}}initTooltip(){this._tooltipHelper=new yX(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*aB(hX).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(cG(null===(s=hz.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),dG("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(cG(hz.getAnimationInKey("fadeInOut")(),dG(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(cG(hz.getAnimationInKey("funnel")({},o),dG(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(cG(null===(a=hz.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),dG("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[uX])/2:this._getSecondaryAxisLength(t[dX])/2,n=this._getSecondaryAxisLength(t[dX])/2):(s=this._getSecondaryAxisLength(t[dX])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[pX])/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[vX])}_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[yD]===t[yD]));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?_X: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<_X&&(y=_-_X),v=f):(_=this._getPolygonCenter(i).y+s/2+e,y=!1!==m.alignLabel?(null==p?void 0:p.y1)-e:_+e,f=this._getPolygonCenter(i).x,y-_<_X&&(y=_+_X),v=f),{x1:f,x2:v,y1:_,y2:y}}const b=this.getPoints(t),x=(Math.abs(b[0].x-b[1].x)+Math.abs(b[2].x-b[3].x))/2,S=(null==g?void 0:g.x2)-(null==g?void 0:g.x1)||0,A=null!==(d=m.spaceWidth)&&void 0!==d?d:5;return"right"===this._spec.outerLabel.position||"left"===this._funnelAlign?(f=this._getPolygonCenter(b).x+Math.max(S/2,x/2)+A,v=!1!==m.alignLabel?(null==p?void 0:p.x1)-A:f+A,_=this._getPolygonCenter(b).y,v-f<_X&&(v=f+_X),y=_):(f=this._getPolygonCenter(b).x-Math.max(S/2,x/2)-A,v=!1!==m.alignLabel?(null==p?void 0:p.x2)+A:f-A,_=this._getPolygonCenter(b).y,f-v<_X&&(v=f-_X),y=_),{x1:f,x2:v,y1:_,y2:y}}_computeMaxSize(){var t;const e=this._isHorizontal()?this.getLayoutRect().height:this.getLayoutRect().width;return KF(null!==(t=this._spec.maxSize)&&void 0!==t?t:"80%",e)}_computeMinSize(){var t;const e=this._isHorizontal()?this.getLayoutRect().height:this.getLayoutRect().width;return KF(null!==(t=this._spec.minSize)&&void 0!==t?t:0,e)}_isHorizontal(){return"left"===this._funnelOrient||"right"===this._funnelOrient}_isReverse(){return"bottom"===this._funnelOrient||"right"===this._funnelOrient}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._funnelMark]}}kX.type=oB.funnel,kX.mark=hF,kX.transformerConstructor=AX;const MX=()=>{SX(),nY(),LU(),hz.registerSeries(kX.type,kX),hz.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},KH))),hz.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Nc,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Nc,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),$H()};class TX extends bX{constructor(){super(...arguments),this.type=TX.type}}TX.type="pyramid3d";class wX extends AX{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class CX extends kX{constructor(){super(...arguments),this.type=oB.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=wX}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},CX.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({},CX.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(CX.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(CX.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())}}CX.type=oB.funnel3d,CX.mark=cF,CX.transformerConstructor=wX;const EX=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},PX=t=>{const e=t.mark.elements.filter((t=>t.diffState===BB.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}))},BX=(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]},RX=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=PX(i),a=BX(r,s,n);return EX(e.startAngle,a)*(n-s)+s},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=PX(i),a=BX(r,s,n);return EX(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}}}),LX=t=>{const e=$(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),i=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[e,i]},OX=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=PX(i),a=LX(r);return EX(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=PX(i),a=LX(r);return EX(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}}}),IX=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},DX=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):DX(t.children,e,i)))})),e};function FX(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=HX(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}},VX=(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=VX(t.children,e,t,n))})),s},NX=(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=NX(t.children,e,t,n)),n=e(t,s,i,n)})),n},GX={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:FX,slice:jX,sliceDice:function(t,e,i,s,n){(t.depth%2==1?jX:FX)(t,e,i,s,n)}};class WX{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({},WX.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?hb(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?zX(this.options.aspectRatio):null!==(e=GX[this.options.splitType])&&void 0!==e?e:GX.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=HX(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)}))}}WX.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const UX=(t,e)=>{const i=new WX(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 DX(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},YX={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class KX{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];FX(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),YX);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({},KX.defaultOpionts,t):Object.assign({},KX.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?hb(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+gb(this.options.center[0],t.width),s=t.y0+gb(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=>gb(t,n))):gb(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>gb(t,n))):gb(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=gb(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=HX(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)}}}KX.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const XX=4294967296;function $X(t,e){let i,s;if(JX(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function JX(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 i$(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 s$(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 n$(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 r$(t){return{_:t,next:null,prev:null}}function a$(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];i$(n,s,r);let a,o,l,h,c,d,u,p=r$(s),g=r$(n),m=r$(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=HX(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)%XX)/XX}(),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:c$.defaultOpionts.nodeSort;VX([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)VX([o],o$(h)),NX([o],l$(this._getPadding,.5,a)),VX([o],h$(1,this._maxDepth));else{const t=Math.min(s.width,s.height);VX([o],o$(c$.defaultOpionts.setRadius)),NX([o],l$(db,1,a)),c&&NX([o],l$(this._getPadding,o.radius/t,a)),VX([o],h$(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}c$.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const d$=(t,e={})=>{if(!t)return[];const i=[];return DX(t,i,e),i},u$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new KX(i).layout(t,{width:s,height:n})};class p$ extends aN{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var g$;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(g$||(g$={}));const m$=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===g$.DrillDown){return Y(sz(t,n,s,"children"))}if(i.type===g$.DrillUp){const e=nz(t,n,s,"children");if(e)return Y(e)}return t};class f${_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=fU(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;Dz(t,"drillFilter",m$),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:g$.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:g$.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:g$.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:g$.DrillUp},model:this}),r}}class v$ extends vY{constructor(){super(...arguments),this.type=oB.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:sG),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:yD},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),Dz(this._dataSet,"sunburstLayout",u$),Dz(this._dataSet,"flatten",d$),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:iG,operations:["max","min","values"]},{key:sG,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(Dz(t.dataSet,"addVChartProperty",qN),t.transform({type:"addVChartProperty",options:{beforeCall:oG.bind(this),call:lG}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t,e;if(!1===this._sunburst.visible)return;const i=this._createMark(v$.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()},Jz.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(v$.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},Jz.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new p$(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(cG(null===(e=hz.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),dG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(cG(null===(e=hz.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),dG(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]}}v$.type=oB.sunburst,v$.mark=_F,U(v$,f$);const _$=()=>{hz.registerSeries(v$.type,v$),CY(),nY(),$H(),hz.registerAnimation("sunburst",((t,e)=>({appear:IX(0,e),enter:RX(t),exit:OX(t),disappear:OX(t)})))},y$=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new c$(i).layout(t,{width:s,height:n})};class b$ extends aN{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const x$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"};class S$ extends xG{constructor(){super(...arguments),this.type=oB.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:sG),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:yD},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),Dz(this._dataSet,"circlePackingLayout",y$),Dz(this._dataSet,"flatten",d$),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)||(Dz(t.dataSet,"addVChartProperty",qN),t.transform({type:"addVChartProperty",options:{beforeCall:oG.bind(this),call:lG}}))}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(S$.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},Jz.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(S$.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"},Jz.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:iG,operations:["max","min","values"]},{key:sG,operations:["values"]}])}initTooltip(){this._tooltipHelper=new b$(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(cG(null===(i=hz.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),dG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(cG(null===(e=hz.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),dG(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]}}S$.type=oB.circlePacking,S$.mark=xF,U(S$,f$);const A$=()=>{hz.registerSeries(S$.type,S$),CY(),nY(),XH(),hz.registerAnimation("circlePacking",((t,e)=>({appear:x$(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},k$=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=k$(t.children):t.value=0),e+=Math.abs(t.value)})),e};function M$(t){return t.depth}function T$(t,e){return e-1-t.endDepth}const w$=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),C$=(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},E$={left:M$,right:T$,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:M$,end:T$},P$=_t(0,1);class B${constructor(t){this._ascendingSourceBreadth=(t,e)=>w$(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>w$(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},B$.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?hb(e):null;this._getNodeKey=i,this._logger=rt.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):E$[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)};yb(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))),yb(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=[];k$(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}`;if(n[r])return n[r].value+=Tt(t.value),void n[r].datum.push(t);const a={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[t],value:t.value,parents:t.parents.map((t=>t.key))};i.push(a),s[t.source].sourceLinks.push(a),s[t.target].targetLinks.push(a),n[r]=a})),{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=[C$(s[t.source]),C$(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=Math.min(n>0?Math.max(this.options.nodeGap,n):this.options.nodeGap,this._viewBox.height/e);a=()=>i,this._gapY=i,this.options.equalNodeHeight?o=this._viewBox.height/e-i:r=t.reduce(((t,e)=>{const s=e.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-(e.length-1)*i)/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,n,0),p=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.max(e.value?i*P$(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&&(o/=i.length-1,n+o>0)){n+=o,this._gapY=Math.min(n);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(w$),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(w$),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 B$(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]:[]},L$=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&L$(t,e.children,i)}))},O$=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},I$=(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 B$(e),r=[];return r.push(n.layout(s,i)),r},D$=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:[]},F$=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 j$ extends aN{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 z$=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),H$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:z$(t),V$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class N$ extends zH{constructor(){super(...arguments),this.type=N$.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}}N$.type="linkPath";const G$=()=>{kR.registerGlyph("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(BO).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),kR.registerAnimationType("linkPathGrowIn",RO),kR.registerAnimationType("linkPathGrowOut",LO),kR.registerAnimationType("linkPathUpdate",OO),_O(),pO(),hz.registerMark(N$.type,N$)};class W$ extends xG{constructor(){super(...arguments),this.type=oB.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=[Jz.STATE_SANKEY_EMPHASIS,Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:s})}else n.target===e.key?i.includes(n.source)||i.push(n.source):(t.removeState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState(Jz.STATE_SANKEY_EMPHASIS),e.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS)):(t.removeState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(Jz.STATE_SANKEY_EMPHASIS),void s.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),s.addState(Jz.STATE_SANKEY_EMPHASIS),void s.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:h.value/r.value});s.removeState(Jz.STATE_SANKEY_EMPHASIS),s.addState(Jz.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=[Jz.STATE_SANKEY_EMPHASIS,Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS),void t.addState(Jz.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(Jz.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(Jz.STATE_SANKEY_EMPHASIS),void t.addState(Jz.STATE_SANKEY_EMPHASIS,{ratio:o.value/i.value});t.removeState(Jz.STATE_SANKEY_EMPHASIS),t.addState(Jz.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){Dz(this._dataSet,"sankeyLayout",I$),Dz(this._dataSet,"sankeyFormat",O$),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:Xz.sankeyLayout});const{dataSet:a}=this._option;Dz(a,"sankeyNodes",D$),Dz(a,"flatten",d$);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:rG.bind(this),call:aG}},!1),this._nodesSeriesData=new eG(this._option,o),Dz(a,"sankeyLinks",F$);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:rG.bind(this),call:aG}},!1),this._linksSeriesData=new eG(this._option,l)}}initMark(){var t,e,i,s;const n=this._createMark(W$.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(W$.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(W$.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},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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"},Jz.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(cG(null===(i=hz.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(r,a),dG("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(cG(null===(s=hz.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(r,a),dG("link",this._spec,this._markAttributeContext))),this._labelMark&&this._labelMark.setAnimationConfig(cG(null===(n=hz.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),dG("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([Jz.STATE_SANKEY_EMPHASIS_REVERSE,Jz.STATE_SANKEY_EMPHASIS]),e.includes(t.getDatum().key)||t.addState(Jz.STATE_SANKEY_EMPHASIS_REVERSE)}))}initTooltip(){this._tooltipHelper=new j$(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 HF;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 L$(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]}}W$.type=oB.sankey,W$.mark=mF;const U$=()=>{kR.registerTransform("sankey",{transform:R$,markPhase:"beforeJoin"},!0),wW(),G$(),nY(),hz.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:H$(t,e)},KH))),hz.registerAnimation("sankeyLinkPath",((t,e)=>({appear:V$(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),$H(),hz.registerSeries(W$.type,W$)},Y$=(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=d$(n);return i=JN([{latestData:r}],e),i};class K$ extends aN{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}get defaultShapeType(){return"square"}}const X$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class $$ extends vG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}class q$ extends xG{constructor(){super(...arguments),this.type=oB.treemap,this.transformerConstructor=$$,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:sG),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:yD},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&&[sG,"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)&&(Dz(this._rawData.dataSet,"addVChartProperty",qN),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:oG.bind(this),call:lG}}))}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){Dz(this._dataSet,"hierarchyDimensionStatistics",Y$),Dz(this._dataSet,"flatten",d$);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:iG,operations:["max","min","values"]},{key:sG,operations:["values"]}])}initMark(){var t,e,i,s;const n=this._createMark(q$.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(q$.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()},Jz.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()},Jz.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},Jz.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},Jz.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},Jz.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},Jz.STATE_NORMAL,t.AttributeLevel.Series))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(cG(null===(e=hz.getAnimationInKey("treemap"))||void 0===e?void 0:e(),dG(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 K$(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]}}q$.type=oB.treemap,q$.mark=gF,q$.transformerConstructor=$$,U(q$,f$),U(q$,_U);const Z$=()=>{wW(),nY(),hz.registerAnimation("treemap",((t,e)=>({appear:X$(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),$H(),kR.registerTransform("treemap",{transform:UX,markPhase:"beforeJoin"},!0),hz.registerSeries(q$.type,q$)},J$={type:"fadeIn"};function Q$(t,e){return"fadeIn"===e?J$:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class tq extends vG{constructor(){super(...arguments),this._supportStack=!1}}class eq extends pK{constructor(){super(...arguments),this.type=oB.gaugePointer,this.transformerConstructor=tq,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(eq.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},eq.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(eq.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(cG(null===(i=hz.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),dG("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}eq.type=oB.gaugePointer,eq.mark=vF,eq.transformerConstructor=tq;const iq=()=>{hz.registerSeries(eq.type,eq),uU(),wW(),hz.registerAnimation("gaugePointer",((t,e)=>{const i=Q$(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),$Y(),KY()};class sq extends vG{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class nq extends pK{constructor(){super(...arguments),this.type=oB.gauge,this.transformerConstructor=sq,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();Dz(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[OD]=t[this._angleField[0]],t[LD]=e>0?i[e-1][OD]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(nq.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(nq.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[LD])?this.angleAxisHelper.dataToPosition([t[LD]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[OD]])}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(cG(null===(i=hz.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),dG("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}nq.type=oB.gauge,nq.mark=fF,nq.transformerConstructor=sq;class rq extends CG{constructor(){super(...arguments),this.type=rq.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}rq.type="cell";const aq=()=>{hz.registerMark(rq.type,rq),fM(),_M(),kR.registerGraphic(RB.cell,yg),kR.registerMark(RB.cell,lD)};function oq(t){return!1===t?{}:{type:"fadeIn"}}class lq extends aN{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return p(i)&&"dimension"===t&&(i.visible=!1),i}}class hq extends vG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class cq extends xG{constructor(){super(...arguments),this.type=oB.heatmap,this.transformerConstructor=hq}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(cq.mark.cell,{morph:gG(this._spec,cq.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(cq.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=bG(this);this._cellMark.setAnimationConfig(cG(null===(i=hz.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),dG("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 lq(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]}}cq.type=oB.heatmap,cq.mark=SF,cq.transformerConstructor=hq;const dq=()=>{nY(),aq(),hz.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},KH),{appear:oq(e)}))),JG(),$G(),hz.registerSeries(cq.type,cq)},uq=(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=gb(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=gb(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+gb(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+gb(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=hb(e.field),C=t.map(w),[E,P]=ub(C),B=E===P?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(P-E),R=u(e.radiusField)?w:hb(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?ub(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=pq(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),gq({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},gq=(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,[_D]:null==n?void 0:n[_D],[bD]:null==n?void 0:n[bD]}};class fq extends zH{constructor(){super(...arguments),this.type=fq.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}}fq.type="ripple";const vq=()=>{hz.registerMark(fq.type,fq),kR.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}}))),_O(),fO()},_q=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class yq extends vG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class bq extends vY{constructor(){super(...arguments),this.type=oB.correlation,this.transformerConstructor=yq,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;Dz(this._dataSet,"correlation",uq);const s=new fa;Fz(s,"dataview",pa),Dz(s,"correlationCenter",mq);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 eG(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(bq.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:_D,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(bq.mark.ripplePoint,{key:_D,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});a&&(this._ripplePointMark=a);const o=this._createMark(bq.mark.centerPoint,{key:_D,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[gD],y:t=>t[mD],size:t=>t[fD],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},Jz.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},Jz.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},Jz.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)},Jz.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(cG(null===(e=hz.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),dG("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()}}bq.type=oB.correlation,bq.mark=AF,bq.transformerConstructor=yq;const xq=()=>{PG(),vq(),hz.registerSeries(bq.type,bq),hz.registerAnimation("correlation",((t,e)=>Object.assign({appear:_q(0,e)},YH)))};class Sq extends zH{constructor(){super(...arguments),this.type=Sq.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}}Sq.type="liquid";const Aq=(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/2):t;class kq extends aN{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 Mq extends _G{constructor(){super(...arguments),this.type=oB.liquid,this.transformerConstructor=BG,this._liquidBackgroundMark=null,this._liquidOutlineMark=null}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){super.setAttrFromSpec(),this._marginSpec=$F(this._spec.outlineMargin),this._paddingSpec=$F(this._spec.outlinePadding),this.setValueField(this._spec.valueField)}rawDataUpdate(t){super.rawDataUpdate(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(Mq.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(Mq.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidMark=this._createMark(Mq.mark.liquid,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_getPosAndSizeFormRegion(t=!1){const{top:e=0,bottom:i=0,left:s=0,right:n=0}=this._marginSpec,{top:r=0,bottom:a=0,left:o=0,right:l=0}=this._paddingSpec,{width:h,height:c}=this._region.getLayoutRect();return t?{x:h/2+(s-n)/2,y:c/2+(e-i)/2,size:Math.min(h-(s+n),c-(e+i))}:{x:h/2+(s+l-(n+l))/2,y:c/2+(e+r-(i+a))/2,size:Math.min(h-(s+n+o+l),c-(e+i+r+a))}}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.setZIndex(this.layoutZIndex),e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),x:()=>this._getPosAndSizeFormRegion(!0).x,y:()=>this._getPosAndSizeFormRegion(!0).y,size:()=>this._getPosAndSizeFormRegion(!0).size,symbolType:()=>{var t;return Aq(null!==(t=this._spec.maskShape)&&void 0!==t?t:"circle",this._getPosAndSizeFormRegion(!0).size)}},"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:()=>{var t;const{x:e,y:i,size:s}=this._getPosAndSizeFormRegion();return[yg({x:e,y:i,size:s,symbolType:Aq(null!==(t=this._spec.maskShape)&&void 0!==t?t:"circle",s),fill:!0})]}},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setInteractive(!1)}_initLiquidMarkStyle(){const e=this._liquidMark;e&&this.setMarkStyle(e,{dx:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,y:()=>{const{y:t,size:e}=this._getPosAndSizeFormRegion();return t-e/2+e-e*this._heightRatio},height:()=>{const{size:t}=this._getPosAndSizeFormRegion();return t*this._heightRatio},fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new kq(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}initInteraction(){this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i;const s={y:{from:()=>{const{y:t,size:e}=this._getPosAndSizeFormRegion();return t-e/2+e},to:()=>{const{y:t,size:e}=this._getPosAndSizeFormRegion();return t-e/2+e-e*this._heightRatio}},height:{from:0,to:()=>{const{size:t}=this._getPosAndSizeFormRegion();return t*this._heightRatio}}},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(cG(null===(i=hz.getAnimationInKey("liquid"))||void 0===i?void 0:i(s,n),dG("liquid",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=DM(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]}}Mq.type=oB.liquid,Mq.mark=MF,Mq.transformerConstructor=BG;const Tq=t=>Y(t).join(",");class wq extends aN{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>Tq(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>Tq(null==t?void 0:t[this.series.getDimensionField()[0]])}}class Cq extends vG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}class Eq extends _G{constructor(){super(...arguments),this.type=oB.venn,this.transformerConstructor=Cq,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:yD)}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(Eq.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(Eq.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()},Jz.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},Jz.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},Jz.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=>Tq(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)}},Jz.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=>Tq(t.sets)},Jz.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new wq(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:Tq(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return Tq(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[Tq(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(Tq(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(cG(null===(e=hz.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),dG(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(cG(null===(e=hz.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),dG(t.name,this._spec,this._markAttributeContext)))}))}}Eq.type=oB.venn,Eq.mark=TF,Eq.transformerConstructor=Cq;class Pq extends lW{_isValidSeries(t){return t===oB.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 Bq extends aW{constructor(){super(...arguments),this.transformerConstructor=Pq,this.type="map",this.seriesType=oB.map}}Bq.type="map",Bq.seriesType=oB.map,Bq.transformerConstructor=Pq;class Rq extends lW{_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 Lq extends Rq{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=EV(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,Tj({},s,l)),n&&Object.assign(o,Tj({},n,o))}}class Oq extends Rq{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 Iq extends Rq{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 Dq extends aW{constructor(){super(...arguments),this.transformerConstructor=Iq}}Dq.transformerConstructor=Iq;class Fq extends Dq{constructor(){super(...arguments),this.transformerConstructor=Iq,this.type="pie",this.seriesType=oB.pie}}Fq.type="pie",Fq.seriesType=oB.pie,Fq.transformerConstructor=Iq;class jq extends Iq{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class zq extends Dq{constructor(){super(...arguments),this.transformerConstructor=jq,this.type="pie3d",this.seriesType=oB.pie3d}}zq.type="pie3d",zq.seriesType=oB.pie3d,zq.transformerConstructor=jq;class Hq extends Oq{_getDefaultSeriesSpec(t){var e,i,s;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:EB,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:EB,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=>Tj({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}class Vq extends aW{constructor(){super(...arguments),this.transformerConstructor=Hq,this.type="rose",this.seriesType=oB.rose,this._canStack=!0}}Vq.type="rose",Vq.seriesType=oB.rose,Vq.transformerConstructor=Hq;class Nq extends Oq{_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:Tj({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=>Tj({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class Gq extends aW{constructor(){super(...arguments),this.transformerConstructor=Nq,this.type="radar",this.seriesType=oB.radar,this._canStack=!0}}Gq.type="radar",Gq.seriesType=oB.radar,Gq.transformerConstructor=Nq;class Wq extends lW{_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")&&Tj(e,aH(this.type,t))})),this._transformAxisSpec(t)}}class Uq extends aW{constructor(){super(...arguments),this.transformerConstructor=Wq,this.type="common",this._canStack=!0}}Uq.type="common",Uq.transformerConstructor=Wq;class Yq extends hW{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 Kq extends aW{constructor(){super(...arguments),this.transformerConstructor=Yq,this._canStack=!0}}Kq.transformerConstructor=Yq;class Xq extends Yq{transformSpec(t){super.transformSpec(t),sH(t)}}class $q extends Kq{constructor(){super(...arguments),this.transformerConstructor=Xq,this.type="histogram",this.seriesType=oB.bar}}$q.type="histogram",$q.seriesType=oB.bar,$q.transformerConstructor=Xq;class qq extends Kq{constructor(){super(...arguments),this.transformerConstructor=Xq,this.type="histogram3d",this.seriesType=oB.bar3d}}qq.type="histogram3d",qq.seriesType=oB.bar3d,qq.transformerConstructor=Xq;class Zq extends Lq{_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 Jq extends aW{constructor(){super(...arguments),this.transformerConstructor=Zq,this.type="circularProgress",this.seriesType=oB.circularProgress,this._canStack=!0}}Jq.type="circularProgress",Jq.seriesType=oB.circularProgress,Jq.transformerConstructor=Zq;class Qq extends Lq{_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:oB.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===oB.gauge||t.type===oB.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===oB.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 tZ extends aW{constructor(){super(...arguments),this.transformerConstructor=Qq,this.type="gauge",this.seriesType=oB.gaugePointer}}tZ.type="gauge",tZ.seriesType=oB.gaugePointer,tZ.transformerConstructor=Qq;class eZ extends lW{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class iZ extends aW{constructor(){super(...arguments),this.transformerConstructor=eZ,this.type="wordCloud",this.seriesType=oB.wordCloud}}iZ.transformerConstructor=eZ;class sZ extends eZ{_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 nZ extends iZ{constructor(){super(...arguments),this.transformerConstructor=sZ,this.type="wordCloud",this.seriesType=oB.wordCloud}}nZ.type="wordCloud",nZ.seriesType=oB.wordCloud,nZ.transformerConstructor=sZ;class rZ extends eZ{_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 aZ extends iZ{constructor(){super(...arguments),this.transformerConstructor=rZ,this.type="wordCloud3d",this.seriesType=oB.wordCloud3d}}aZ.type="wordCloud3d",aZ.seriesType=oB.wordCloud3d,aZ.transformerConstructor=rZ;class oZ extends lW{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 lZ extends aW{constructor(){super(...arguments),this.transformerConstructor=oZ,this.type="funnel",this.seriesType=oB.funnel}}lZ.type="funnel",lZ.seriesType=oB.funnel,lZ.transformerConstructor=oZ;class hZ extends aW{constructor(){super(...arguments),this.transformerConstructor=oZ,this.type="funnel3d",this.seriesType=oB.funnel3d}}hZ.type="funnel3d",hZ.seriesType=oB.funnel3d,hZ.transformerConstructor=oZ;class cZ extends hW{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=EV(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=EV(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class dZ extends aW{constructor(){super(...arguments),this.transformerConstructor=cZ,this.type="linearProgress",this.seriesType=oB.linearProgress,this._canStack=!0}}dZ.type="linearProgress",dZ.seriesType=oB.linearProgress,dZ.transformerConstructor=cZ;class uZ extends hW{_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),sH(t)}}class pZ extends aW{constructor(){super(...arguments),this.transformerConstructor=uZ,this.type="rangeColumn",this.seriesType=oB.rangeColumn}}pZ.type="rangeColumn",pZ.seriesType=oB.rangeColumn,pZ.transformerConstructor=uZ;class gZ extends hW{_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 mZ extends aW{constructor(){super(...arguments),this.transformerConstructor=gZ,this.type="rangeColumn3d",this.seriesType=oB.rangeColumn3d}}mZ.type="rangeColumn3d",mZ.seriesType=oB.rangeColumn3d,mZ.transformerConstructor=gZ;class fZ extends lW{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:CB,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=oB.sunburst;return s.type=n,s[n]=t[n],s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class vZ extends aW{constructor(){super(...arguments),this.transformerConstructor=fZ,this.type="sunburst",this.seriesType=oB.sunburst}}vZ.type="sunburst",vZ.seriesType=oB.sunburst,vZ.transformerConstructor=fZ;class _Z extends lW{_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=oB.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class yZ extends aW{constructor(){super(...arguments),this.transformerConstructor=_Z,this.type="circlePacking",this.seriesType=oB.circlePacking}}yZ.type="circlePacking",yZ.seriesType=oB.circlePacking,yZ.transformerConstructor=_Z;class bZ extends lW{_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 xZ extends aW{constructor(){super(...arguments),this.transformerConstructor=bZ,this.type="treemap",this.seriesType=oB.treemap}}xZ.type="treemap",xZ.seriesType=oB.treemap,xZ.transformerConstructor=bZ;class SZ extends LW{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),sH(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}class AZ extends OW{constructor(){super(...arguments),this.transformerConstructor=SZ,this.type="waterfall",this.seriesType=oB.waterfall}}AZ.type="waterfall",AZ.seriesType=oB.waterfall,AZ.transformerConstructor=SZ;class kZ extends hW{_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"}]),sH(t)}}class MZ extends aW{constructor(){super(...arguments),this.transformerConstructor=kZ,this.type="boxPlot",this.seriesType=oB.boxPlot}}MZ.type="boxPlot",MZ.seriesType=oB.boxPlot,MZ.transformerConstructor=kZ;class TZ extends lW{_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 wZ extends aW{constructor(){super(...arguments),this.transformerConstructor=TZ,this.type="sankey",this.seriesType=oB.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)}))}}wZ.type="sankey",wZ.seriesType=oB.sankey,wZ.transformerConstructor=TZ;class CZ extends hW{_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),sH(t)}}class EZ extends aW{constructor(){super(...arguments),this.transformerConstructor=CZ,this.type="rangeArea",this.seriesType=oB.rangeArea}}EZ.type="rangeArea",EZ.seriesType=oB.rangeArea,EZ.transformerConstructor=CZ;class PZ extends hW{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}class BZ extends aW{constructor(){super(...arguments),this.transformerConstructor=PZ,this.type="heatmap",this.seriesType=oB.heatmap}}BZ.type="heatmap",BZ.seriesType=oB.heatmap,BZ.transformerConstructor=PZ;class RZ extends lW{_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=oB.correlation;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class LZ extends aW{constructor(){super(...arguments),this.transformerConstructor=RZ,this.type="correlation",this.seriesType=oB.correlation}}LZ.type="correlation",LZ.seriesType=oB.correlation,LZ.transformerConstructor=RZ;function OZ(t){var e,i;const s=Object.assign({},t);return B(t.style)||(s.textStyle=lz(t.style)),B(t.textStyle)||Tj(s.textStyle,lz(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&lz(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&lz(s.background.style),s}const IZ=(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},DZ=(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:bD;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 FZ extends DG{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:()=>{sB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),sB(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=UF(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 DH(this._option,e),this._initSelectedData(),sB(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)||(sB(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(Tj({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(Tj({},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(Tj({},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}}FZ.specKey="legends";class jZ extends FZ{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),sB(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:Xz.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){Dz(this._option.dataSet,"discreteLegendFilter",DZ),Dz(this._option.dataSet,"discreteLegendDataMake",IZ);const t=new _a(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return sB(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(!nb(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=qj(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=OZ(s)),B(n.focusIconStyle)||lz(n.focusIconStyle),n.shape&&(n.shape=az(n.shape)),n.label&&(n.label=az(n.label)),n.value&&(n.value=az(n.value)),n.background&&(n.background=az(n.background)),YF(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),YF(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),YF(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)||lz(r.railStyle),B(r.sliderStyle)||lz(r.sliderStyle)):(B(r.textStyle)||lz(r.textStyle),r.handler&&az(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(Tj(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 uP}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(rP.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(rP.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(rP.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}=TV(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=TV(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}jZ.specKey="legends",jZ.type=r.discreteLegend;const zZ=(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[]},HZ=(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)?rz(t,+e,+i):t.filter((t=>t[o]>=e&&t[o]<=i))}return t};function VZ(t){return"color"===t||"size"===t}const NZ={color:vP,size:yP},GZ=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],WZ=[2,10];class UZ extends FZ{static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!y(e))return VZ(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)=>{VZ(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),sB(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData},level:Xz.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(){Dz(this._option.dataSet,"continuousLegendFilter",HZ),Dz(this._option.dataSet,"continuousLegendDataMake",zZ);const t=new _a(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>nB(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=qj(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!nb(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=qj(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?GZ:WZ);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=Tj({},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=OZ(s)),w.showHandler=!1!==n.visible,B(n.style)||(w.handlerStyle=lz(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),B(r.style)||(w.railStyle=lz(r.style)),B(a.style)||(w.trackStyle=lz(a.style)),w.startText=az(o),w.endText=az(l),w.handlerText=az(h),B(c)||(w.sizeBackground=lz(c)),d.visible&&!B(d.style)&&(Tj(w,d.style),p(d.padding)&&(w.padding=d.padding)),w}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return NZ[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))}}}UZ.specKey="legends",UZ.type=r.continuousLegend;class YZ{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=Tz(n,a,!0))&&void 0!==e?e:[],...null!==(i=gz(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(!jw(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=sN(s).includes(t):p(e.visible)||p(e.activeType)?d.visible=sN(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)&&(uN(s).every((t=>{var e;return!sN(null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec).includes("dimension")}))?d.visible=!1:p(e.visible)||p(e.activeType)?d.visible=sN(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=cN(t,i,s),m=dN(t,i,s),f=Tj({},I(e[t]),m),v=g.title,_=gN(void 0,f,u.shape,void 0,v);p(f.title)?f.title=lN(f.title,Object.assign(Object.assign({},v),_)):f.title=lN(v,_,!0);const y=Y(g.content);if(p(f.content)){const t=pN(y);f.content=hN(f.content,(e=>gN(e,f,u.shape,t)))}else f.content=hN(y,(t=>gN(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=xN(a,t,e),l=!!p(o)&&!1!==fN(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 KZ extends YZ{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 XZ extends YZ{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 $Z extends YZ{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 qZ=t=>p(t)&&!y(t),ZZ=t=>p(t)&&y(t);class JZ extends IG{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:s}=super._initTheme(t,e);return i.style=Tj({},this._theme,i.style),{spec:i,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h,c,d;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=sN(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:tb(this._option.mode)||!Jy(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=null===(d=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===d?void 0:d.getElementById(t.parentElement)):Jy(this._option.mode)&&(t.parentElement=null==Zy?void 0:Zy.body)}}class QZ extends DG{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=JZ,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._getMouseOutHandler=t=>e=>{var i,s,n;if(this._alwaysShow)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=Jy(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(!t&&this._clickLock)return;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&&qZ(this._cacheInfo)?a.mark=this._showTooltipByMouseEvent("mark",i,e,t,!0):r&&ZZ(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),t&&this._clickLock&&(this._clickLock=!1))},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(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));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&sV.globalConfig.uniqueTooltip&&l&&sV.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._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?vN.canvas:vN.dom,n=hz.getComponentPluginInType(t);n||Xy("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 XZ(this),dimension:new KZ(this),group:new $Z(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)),(Qy(i)||tb(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)))}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=eN(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(ZZ(t)){if(qZ(this._cacheInfo))return!1;const e=this._cacheInfo;if(!(e.length===t.length&&t.every(((t,i)=>cz(t,e[i])))))return!1}else{if(ZZ(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}}QZ.type=r.tooltip,QZ.transformerConstructor=JZ,QZ.specKey="tooltip";var tJ,eJ;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(tJ||(tJ={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(eJ||(eJ={}));const iJ={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class sJ extends DG{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=>{this._handleIn(t),this._clickLock=this._hasActive&&this._spec.lockAfterClick,this._clickLock&&S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._clickLock=!1,this._handleOutEvent()}),this.triggerOff))},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"}:Qy(e)||tb(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=this.trigger||"hover",e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;if(y(t)){const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return[{click:"click"===t,in:i[t],out:e(t)}]}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)=>{iJ[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||t.yField)&&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){mz(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=>{jw(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[0],s=e.series.dataToPosition(e.datum[0]);(p(t.dimType)?"y"===t.dimType:fz(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=s.y:r=s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=e.x,a=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=rB(this._regions,"cartesian");if(!e)return;const{x:i,y:s,offsetWidth:n,offsetHeight:r,bandWidth:a,bandHeight:o}=jV(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=VV(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=NV(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 uT(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(n=new pT(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 QM(e)),null==s||s.add(t)),DV(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}nJ.specKey="crosshair",nJ.type=r.cartesianCrosshair;class rJ extends sJ{static getSpecInfo(t){const e=t[this.specKey];if(u(e))return;if(!y(e))return e.categoryField||e.valueField?[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:r.polarCrosshair}]:void 0;const i=[];return e.forEach(((t,e)=>{(t.categoryField||t.valueField)&&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=>{jw(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=rB(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:"",Tj(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=CV(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=CV(s.getSpec())),c.angle=a.angle,c.axis=s,Tj(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}=TV(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}=TV(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 uT(Object.assign(Object.assign({},l),{lineStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===o&&(t=new mT(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 fT(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex+1})):new gT(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 QM(e),null==s||s.add(t),i(t)),DV(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair]}}rJ.specKey="crosshair",rJ.type=r.polarCrosshair;const aJ=(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)},oJ=(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 lJ extends DG{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 sB(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),sB(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=_z(t),this._isHorizontal="horizontal"===yz(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=>!Dw(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(Dw(this._stateScale.type));this._stateScale.domain(e,!0),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={};sB(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=Dw(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 sB(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;Fz(s,"dataview",pa),Dz(s,"dataFilterComputeDomain",oJ);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 DH(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(Dw(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&&Dw(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,Dw(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=Dw(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 rC,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||(Dz(this._option.dataSet,"dataFilterWithNewDomain",aJ),sB(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:()=>Dw(this._stateScale.type)},level:Xz.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(Dw(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&&jw(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,jw(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(lJ,_U);class hJ extends IG{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=Tj({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 cJ extends lJ{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=hJ,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 TC;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(!Dw(t.type)||e[0]!==e[1])&&(!jw(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 rE(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:lz(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:lz(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:lz(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:lz(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:lz(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:lz(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:lz(g.style)},selectedBackgroundStyle:lz(this._spec.selectedBackground.style),dragMaskStyle:lz(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:Tj(lz(null===(l=m.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},lz(null===(h=m.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:Tj(lz(null===(c=f.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},lz(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}=TV(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()}}cJ.type=r.dataZoom,cJ.transformerConstructor=hJ,cJ.specKey="dataZoom";class dJ extends lJ{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 EM(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=$P(this._start,e)&&$P(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=lz(t.style)),B(null==e?void 0:e.style)||(s.sliderStyle=lz(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}dJ.type=r.scrollBar,dJ.specKey="scrollBar";const uJ=(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 pJ extends DG{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!==pJ.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(){Dz(this._option.dataSet,"indicatorFilter",uJ);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 DH(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=Tj({},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({},lz(e.style)),{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?ZF(this._spec.offsetX,this._computeLayoutRadius()):0,dy:this._spec.offsetY?ZF(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({},lz(this._spec.title.style)),{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 SP(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}}pJ.type=r.indicator,pJ.specKey="indicator";const gJ=["sum","average","min","max","variance","standardDeviation","median"];function mJ(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=X(s);return er}function fJ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&mJ(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=YF(t.x)?bJ(t.x,n)+r.x:l.getXAxisHelper().dataToPosition([t.x])+r.x,h}function vJ(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&mJ(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=YF(t.y)?bJ(t.y,n)+r.y:l.getYAxisHelper().dataToPosition([t.y])+r.y,h}function _J(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&mJ(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 yJ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&mJ(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 bJ(t,e){return Number(t.substring(0,t.length-1))*e/100}function xJ(t){return gJ.includes(t)}function SJ(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=fJ(t,m,n,d,h,a),i=vJ(t,f,n,d,c,a);u.push([{x:e,y:i}])}else if(e){const e=fJ(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=vJ(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 AJ(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=_J(t,l,n,r),i=yJ(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=_J(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=yJ(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function kJ(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=YF(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=YF(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])&&mJ(_,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])&&mJ(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 MJ(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])&&mJ(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])&&mJ(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 TJ(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 YF(e)&&(e=bJ(e,r)),e+=s,YF(i)&&(i=bJ(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 YF(e)&&(e=bJ(e,s)),YF(i)&&(i=bJ(i,n)),{x:e,y:i}}))}function wJ(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 CJ(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},lz(r.style)):t.shape={visible:!1},!1!==s.visible?(t.panel=Object.assign({visible:!0},PJ(lz(s.style),i)),p(s.padding)&&(t.padding=ti(s.padding))):(t.panel={visible:!1},t.padding=0),n&&(t.textStyle=PJ(lz(n),i)),t}return{visible:!1}}function EJ(t,e){for(const i in t)d(t[i])&&(t[i]=t[i](e));return t}function PJ(t,e){return d(t)?t(e):t}function BJ(t,e){return d(t)?t(e):t}function RJ(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 LJ(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 OJ(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 IJ(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function DJ(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=>jJ(i,t,e))):s.x=jJ(i,t,e)}if(p(e.y)){const i=e.y;y(i)?s.y=i.map((i=>jJ(i,t,e))):s.y=jJ(i,t,e)}if(p(e.angle)){const i=e.angle;y(i)?s.angle=i.map((i=>jJ(i,t,e))):s.angle=jJ(i,t,e)}if(p(e.radius)){const i=e.radius;y(i)?s.radius=i.map((i=>jJ(i,t,e))):s.radius=jJ(i,t,e)}if(p(e.areaName)){const i=e.areaName;s.areaName=jJ(i,t,e)}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),i.push(s)})),i}const FJ={min:(t,e)=>qP(t[0].latestData,e.field),max:(t,e)=>ZP(t[0].latestData,e.field),sum:function(t,e){return JP(t[0].latestData,e.field)},average:function(t,e){return QP(t[0].latestData,e.field)},variance:function(t,e){return tB(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(tB(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 jJ(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 FJ[i](e,{field:s})}return t}class zJ extends DG{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)&&xJ(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])&&xJ(t[h])?i.x={field:h,aggrType:t[h]}:i.x=Y(h).map((e=>t[e])),_(t[c])&&xJ(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])&&xJ(t[o])?i.angle={field:o,aggrType:t[o]}:i.angle=Y(o).map((e=>t[e])),_(t[l])&&xJ(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=rB(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=KF(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=KF(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 HJ(t,e){return function(t,e,i){const{predict:s}=vb(t,(t=>t[e]),(t=>t[i])),n=qP(t,e),r=ZP(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 VJ(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 NJ extends zJ{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}=LJ(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:PJ(lz(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:CJ(y,this._markerData),state:{line:EJ(null!==(a=null===(r=this._spec.line)||void 0===r?void 0:r.state)&&void 0!==a?a:{},this._markerData),lineStartSymbol:EJ(null!==(l=null===(o=this._spec.startSymbol)||void 0===o?void 0:o.state)&&void 0!==l?l:{},this._markerData),lineEndSymbol:EJ(null!==(c=null===(h=this._spec.endSymbol)||void 0===h?void 0:h.state)&&void 0!==c?c:{},this._markerData),label:EJ(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:EJ(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:lz(b.style)}):S.startSymbol={visible:!1},x.visible?S.endSymbol=Object.assign(Object.assign({},x),{visible:!0,style:lz(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}=wJ([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}=LJ(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;Dz(this._option.dataSet,"markerAggregation",DJ),Dz(this._option.dataSet,"markerRegression",HJ),Dz(this._option.dataSet,"markerFilter",VJ);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}}NJ.specKey="markLine";class GJ extends NJ{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new UE(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:_}=LJ(e);let y=[];if(u||m||g||f||v||a&&l||a&&h){const t=SJ(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=kJ(i,r,d,e.coordinatesOffset):c&&(y=TJ(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(YF(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}=LJ(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}}}GJ.type=r.markLine,GJ.coordinateType="cartesian";class WJ extends NJ{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=LJ(this._spec);return e||i?new XE(t):new UE(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}=LJ(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=AJ(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=MJ(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}=LJ(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}}}WJ.type=r.polarMarkLine,WJ.coordinateType="polar";class UJ extends DG{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=UF(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 bP(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}}UJ.type=r.title,UJ.specKey=r.title;class YJ extends zJ{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=OJ(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:PJ(lz(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:CJ(u,this._markerData),state:{area:EJ(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData),label:EJ(null===(o=this._spec.label)||void 0===o?void 0:o.state,this._markerData),labelBackground:EJ(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}=wJ([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}=OJ(t);if(!(e||i||s||n||r||a||o))return null;const{options:l}=this._computeOptions(),h=this._getRelativeDataView();Dz(this._option.dataSet,"markerAggregation",DJ),Dz(this._option.dataSet,"markerFilter",VJ);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}}YJ.specKey="markArea";class KJ extends YJ{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new KE(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}=OJ(e),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t;let u=[],g=[];if(l){g=SJ(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=SJ(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[...t,e[1],e[0]])}else h?u=kJ(i,r,d,e.coordinatesOffset):c&&(u=TJ(e.positions,r,e.regionRelative));return{points:u}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=OJ(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}}}KJ.type=r.markArea,KJ.coordinateType="cartesian";class XJ extends YJ{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=OJ(this._spec);return i||e||s?new $E(t):new KE(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}=OJ(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=AJ(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=MJ(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}=OJ(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}}}XJ.type=r.polarMarkArea,XJ.coordinateType="polar";const $J=t=>lz(Object.assign({},t)),qJ=t=>Object.assign(Object.assign({},t),{style:Object.assign({},lz(t.style))}),ZJ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,m;const f=$J(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=$J(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:{},lz(Object.assign({},y)));var y;const b=qJ(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=qJ(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=qJ(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=qJ(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},JJ=t=>"left"===t||"right"===t,QJ=t=>"top"===t||"bottom"===t;class tQ extends DG{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({},ZJ(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({},ZJ(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 DP(t):this._playerComponent=new zP(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=JJ(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=JJ(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(PP.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(PP.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(PP.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(PP.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(PP.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(PP.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=JJ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=QJ(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)):JJ(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))):QJ(this._orient)?this._maxSize():t.height}_computeDx(t){return JJ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return QJ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}}tQ.specKey="player",tQ.type=r.player;class eQ extends DG{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)))}}eQ.type=r.label;class iQ extends sY{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}}iQ.type="text",iQ.constructorType="label";const sQ=()=>{hz.registerMark(iQ.constructorType,iQ),vO()};class nQ extends IG{_initTheme(t,e){return{spec:t,theme:this._theme}}}class rQ extends eQ{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=nQ,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),sB(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=Tj({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=jU[t])&&void 0!==i?i:jU.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}:zU(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}}rQ.type=r.label,rQ.specKey="label",rQ.transformerConstructor=nQ;class aQ extends eQ{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[PD]},"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 Tj({textStyle:{pickable:!0===this._spec.interactive},position:oQ(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[RD]))},a))}})).encode((e=>zU({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 oQ(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}aQ.type=r.totalLabel,aQ.specKey="totalLabel";class lQ extends zJ{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=IJ(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:BJ(E.offsetX,this._relativeSeries.getRegion()),offsetY:BJ(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:PJ(B.style,this._markerData)},state:{line:EJ(null!==(h=null===(l=this._spec.itemLine.line)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData),lineStartSymbol:EJ(null!==(d=null===(c=this._spec.itemLine.startSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData),lineEndSymbol:EJ(null!==(p=null===(u=this._spec.itemLine.endSymbol)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData),symbol:EJ(null!==(m=null===(g=this._spec.itemContent.symbol)||void 0===g?void 0:g.state)&&void 0!==m?m:{},this._markerData),image:EJ(null!==(v=null===(f=this._spec.itemContent.image)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData),text:EJ(null!==(y=null===(_=this._spec.itemContent.text)||void 0===_?void 0:_.state)&&void 0!==y?y:{},this._markerData),textBackground:EJ(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:EJ(null!==(A=null===(S=this._spec.itemContent.richText)||void 0===S?void 0:S.state)&&void 0!==A?A:{},this._markerData),customMark:EJ(null!==(M=null===(k=this._spec.itemContent.customMark)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData),targetItem:EJ(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=lz(PJ(L.style,this._markerData))),(null==O?void 0:O.style)&&(F.itemContent.imageStyle=PJ(O.style,this._markerData)),R&&(F.itemContent.textStyle=CJ(R,this._markerData)),(null==I?void 0:I.style)&&(F.itemContent.richTextStyle=PJ(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:lz(z.style)}):{visible:!1};return new ZE(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}=wJ([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:RJ(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:RJ(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}=IJ(t);if(!(p(t.coordinate)||e||i||s))return;Dz(this._option.dataSet,"markerAggregation",DJ),Dz(this._option.dataSet,"markerFilter",VJ);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}}lQ.specKey="markPoint";class hQ extends lQ{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=SJ(i,s,s,s,o)[0][0]:r?l=kJ(i,s,o,e.coordinatesOffset)[0]:a&&(l=TJ([e.position],s,e.regionRelative)[0]),{point:l}}_computeOptions(){const t=this._spec,{doXYProcess:e}=IJ(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}}}hQ.type=r.markPoint,hQ.coordinateType="cartesian";class cQ extends lQ{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=AJ(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}])]}}}cQ.type=r.polarMarkPoint,cQ.coordinateType="polar";class dQ extends lQ{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}])]}}}dQ.type=r.geoMarkPoint,dQ.coordinateType="geo";const uQ="inBrush",pQ="outOfBrush";class gQ extends DG{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),uQ,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),pQ,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 GP(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:lz(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(FP.drawStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(FP.moveStart,(i=>{this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(FP.drawing,(s=>{this._needInitOutState&&"single"===o&&this._initMarkBrushState(i,pQ),this._needInitOutState=!1,this._needDisablePickable=!0,this._handleBrushChange(t.ChartEvent.brushChange,e,s),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(FP.moving,(i=>{this._handleBrushChange(t.ChartEvent.brushChange,e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(FP.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(FP.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(FP.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({},lz(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(uQ),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(uQ),i.addState(pQ),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(uQ),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(uQ),i.addState(pQ),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(uQ),i.removeState(pQ),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}}}gQ.type=r.brush,gQ.specKey="brush";class mQ extends DG{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,`${hB}_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=cG({},dG(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}}}mQ.type=r.customMark,mQ.specKey="customMark";function fQ(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 vQ(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function _Q(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:vQ(t.rect),anchorCandidates:kQ(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=>fQ(t,r)));if(n.anchorCandidates)if(a&&(null===(e=n.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;tfQ(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 yQ(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=SQ(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(!SQ(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],bQ(xQ(t.point,l)))):t.point;n&&(s.x=n.x,s.y=n.y);const r=bQ(xQ(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=AQ(t.rect,a,0),t}));return _Q(h)}function bQ(t){return t>180?t-360:t}function xQ(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function SQ(t,e){for(let i=0;i{const{x:r,y:a}=AQ(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,s);n.push({x:r,y:a})})),n}class MQ extends DG{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:Xz.copyDataView},!1),this._data=new DH(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 ZE({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=$F(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=Au({});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=Mg(lz(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=yg(lz(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=gp(lz(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=gp(lz(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=AQ(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:lz(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]}))):_Q(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}}MQ.type=r.mapLabel,MQ.specKey="mapLabel";class TQ{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=>wQ(t))),a=n.filter((t=>!wQ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>wQ(t))),h=o.filter((t=>!wQ(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 wQ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}TQ.type="grid";sV.useRegisters([()=>{iI(),sI(),wG(),PG(),ZH(),XH(),JG(),$G(),hz.registerSeries(iW.type,iW),hz.registerChart(dW.type,dW)},()=>{iI(),sI(),wG(),pW(),PG(),mW(),JG(),$G(),hz.registerSeries(vW.type,vW),hz.registerChart(yW.type,yW)},()=>{RW(),hz.registerChart(OW.type,OW)},()=>{KW(),hz.registerChart($W.type,$W)},()=>{RY(),hz.registerChart(Fq.type,Fq)},()=>{ZY(),hz.registerChart(Vq.type,Vq)},()=>{rK(),hz.registerChart(Gq.type,Gq)},()=>{RW(),hz.registerChart($q.type,$q)},()=>{kU(),hz.registerChart(Bq.type,Bq)},()=>{iq(),hz.registerSeries(nq.type,nq),CY(),fK(),KY(),hz.registerChart(tZ.type,tZ)},()=>{rX(),hz.registerChart(nZ.type,nZ)},()=>{MX(),hz.registerChart(lZ.type,lZ)},()=>{$U(),hz.registerChart(AZ.type,AZ)},()=>{eY(),PG(),XH(),JG(),$G(),hz.registerSeries(iY.type,iY),hz.registerChart(MZ.type,MZ)},()=>{hz.registerSeries(_K.type,_K),CY(),fK(),$H(),$Y(),KY(),hz.registerChart(Jq.type,Jq)},()=>{MK(),hz.registerChart(dZ.type,dZ)},()=>{pY(),hz.registerChart(pZ.type,pZ)},()=>{pW(),JG(),$G(),hz.registerSeries(fY.type,fY),hz.registerChart(EZ.type,EZ)},()=>{_$(),hz.registerChart(vZ.type,vZ)},()=>{A$(),hz.registerChart(yZ.type,yZ)},()=>{Z$(),hz.registerChart(xZ.type,xZ)},()=>{U$(),hz.registerChart(wZ.type,wZ)},()=>{dq(),hz.registerChart(BZ.type,BZ)},()=>{xq(),hz.registerChart(LZ.type,LZ)},()=>{hz.registerChart(Uq.type,Uq)},$G,JG,()=>{VG(),hz.registerComponent(QG.type,QG)},()=>{VG(),hz.registerComponent(tW.type,tW)},()=>{VG(),hz.registerComponent(eW.type,eW)},$Y,KY,()=>{hz.registerComponent(jZ.type,jZ)},()=>{hz.registerComponent(UZ.type,UZ)},()=>{hz.registerComponent(QZ.type,QZ)},()=>{hz.registerComponent(nJ.type,nJ)},()=>{hz.registerComponent(rJ.type,rJ)},()=>{hz.registerComponent(cJ.type,cJ)},()=>{hz.registerComponent(dJ.type,dJ)},()=>{hz.registerComponent(pJ.type,pJ)},xU,()=>{hz.registerComponent(GJ.type,GJ),WE()},()=>{hz.registerComponent(KJ.type,KJ),YE()},()=>{hz.registerComponent(hQ.type,hQ),qE()},()=>{hz.registerComponent(WJ.type,WJ),XE._animate=TE,WE()},()=>{hz.registerComponent(XJ.type,XJ),$E._animate=CE,YE()},()=>{hz.registerComponent(cQ.type,cQ),qE()},()=>{hz.registerComponent(dQ.type,dQ),qE()},()=>{hz.registerComponent(UJ.type,UJ)},()=>{hz.registerComponent(tQ.type,tQ)},()=>{zO(),sQ(),jG(),hz.registerComponent(rQ.type,rQ,!0)},()=>{zO(),sQ(),jG(),hz.registerComponent(aQ.type,aQ,!0)},()=>{hz.registerComponent(gQ.type,gQ)},()=>{hz.registerComponent(mQ.type,mQ)},()=>{hz.registerComponent(MQ.type,MQ)},()=>{$l.load(cT)},()=>{hz.registerLayout(TQ.type,TQ)},$N,UR,WR]),sV.useRegisters([()=>{TA($l)}]),t.ARC_END_ANGLE=xB,t.ARC_K=SB,t.ARC_MIDDLE_ANGLE=AB,t.ARC_QUADRANT=kB,t.ARC_RADIAN=MB,t.ARC_RATIO=yB,t.ARC_START_ANGLE=bB,t.ARC_TRANSFORM_VALUE=_B,t.AxisSyncPlugin=bV,t.BASE_EVENTS=hD,t.CORRELATION_SIZE=fD,t.CORRELATION_X=gD,t.CORRELATION_Y=mD,t.CanvasTooltipHandler=XN,t.DEFAULT_CHART_HEIGHT=dB,t.DEFAULT_CHART_WIDTH=cB,t.DEFAULT_CONICAL_GRADIENT_CONFIG=HD,t.DEFAULT_DATA_INDEX=_D,t.DEFAULT_DATA_KEY=yD,t.DEFAULT_DATA_SERIES_FIELD=bD,t.DEFAULT_GRADIENT_CONFIG=VD,t.DEFAULT_LABEL_ALIGN=pB,t.DEFAULT_LABEL_LIMIT=uB,t.DEFAULT_LABEL_TEXT=gB,t.DEFAULT_LABEL_VISIBLE=mB,t.DEFAULT_LABEL_X=fB,t.DEFAULT_LABEL_Y=vB,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_GRADIENT_CONFIG=jD,t.DEFAULT_MEASURE_CANVAS_ID=vD,t.DEFAULT_RADIAL_GRADIENT_CONFIG=zD,t.DEFAULT_SERIES_STYLE_NAME=xD,t.DomTooltipHandler=KN,t.Factory=hz,t.FormatterPlugin=uV,t.GradientType=FD,t.MediaQuery=lV,t.POLAR_DEFAULT_RADIUS=EB,t.POLAR_END_ANGLE=270,t.POLAR_END_RADIAN=wB,t.POLAR_START_ANGLE=CB,t.POLAR_START_RADIAN=TB,t.PREFIX=hB,t.SEGMENT_FIELD_END=OD,t.SEGMENT_FIELD_START=LD,t.STACK_FIELD_END=MD,t.STACK_FIELD_END_OffsetSilhouette=ED,t.STACK_FIELD_END_PERCENT=wD,t.STACK_FIELD_KEY=AD,t.STACK_FIELD_START=kD,t.STACK_FIELD_START_OffsetSilhouette=CD,t.STACK_FIELD_START_PERCENT=TD,t.STACK_FIELD_TOTAL=PD,t.STACK_FIELD_TOTAL_PERCENT=BD,t.STACK_FIELD_TOTAL_TOP=RD,t.ThemeManager=Wj,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=sV,t.WaterfallDefaultSeriesField=pD,t.builtinThemes=Lj,t.computeActualDataScheme=LF,t.darkTheme=yj,t.dataScheme=JF,t.default=sV,t.defaultThemeName=Oj,t.getActualColor=IF,t.getColorSchemeBySeries=zF,t.getDataScheme=RF,t.getMergedTheme=Nj,t.getTheme=zj,t.hasThemeMerged=Fj,t.isColorKey=DF,t.isProgressiveDataColorScheme=FF,t.isTokenKey=fj,t.lightTheme=_j,t.queryColorFromColorScheme=OF,t.queryToken=mj,t.registerCanvasTooltipHandler=$N,t.registerChartPlugin=oV,t.registerDomTooltipHandler=()=>{YN(KN)},t.registerFormatPlugin=()=>{oV(uV)},t.registerMediaQuery=()=>{oV(lV)},t.registerTheme=jj,t.removeTheme=Hj,t.themeExist=Vj,t.themes=Ij,t.token=vj,t.transformColorSchemeToStandardStruct=jF,t.version="1.11.5",t.vglobal=E_,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/wx-vchart/package.json b/packages/wx-vchart/package.json index 95d5428a70..27a65345c8 100644 --- a/packages/wx-vchart/package.json +++ b/packages/wx-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/wx-vchart", - "version": "1.11.4", + "version": "1.11.5", "description": "", "main": "index.js", "miniprogram": ".", diff --git a/tools/story-player/package.json b/tools/story-player/package.json index e1e73944ec..fd7d250973 100644 --- a/tools/story-player/package.json +++ b/tools/story-player/package.json @@ -58,7 +58,7 @@ "dependencies": { "@visactor/vrender-core": "0.19.11", "@visactor/vrender-kits": "0.19.11", - "@visactor/vchart": "workspace:1.11.4", + "@visactor/vchart": "workspace:1.11.5", "@visactor/vrender": "0.19.11", "@visactor/vutils": "~0.18.9" } From 7af5cb90833296241867828ed9ce436609e9a007 Mon Sep 17 00:00:00 2001 From: xile611 Date: Thu, 20 Jun 2024 19:31:04 +0800 Subject: [PATCH 15/16] fix: fix bundler.config.js --- packages/vchart/bundler.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vchart/bundler.config.js b/packages/vchart/bundler.config.js index aa3918e54c..0f15653912 100644 --- a/packages/vchart/bundler.config.js +++ b/packages/vchart/bundler.config.js @@ -119,7 +119,7 @@ module.exports = { try { // harmonyOS - const source = 'es5/index.es.js'; + const source = '/index.es.js'; const dest = '../harmony_vchart/library/src/main/ets/vchart_dist.js'; const envSource = path.join(__dirname, config.outputDir.umd, source); copyFile(envSource, path.join(__dirname, dest)); From 62a9dab105a36ffabec4ae27a7ac92372a79decb Mon Sep 17 00:00:00 2001 From: xile611 Date: Fri, 21 Jun 2024 10:23:01 +0800 Subject: [PATCH 16/16] chore: update changelog task of harmony --- .github/workflows/publish.yml | 2 +- .github/workflows/release-changelog.yml | 9 +++++++++ .github/workflows/release.yml | 4 ---- common/scripts/set-changelog-of-harmony.js | 21 --------------------- 4 files changed, 10 insertions(+), 26 deletions(-) delete mode 100644 common/scripts/set-changelog-of-harmony.js diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 740f80fcc3..e586e905aa 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,4 +1,4 @@ -name: Release CI +name: Publish CI on: push: diff --git a/.github/workflows/release-changelog.yml b/.github/workflows/release-changelog.yml index 85bb6ae619..4786fde511 100644 --- a/.github/workflows/release-changelog.yml +++ b/.github/workflows/release-changelog.yml @@ -50,6 +50,15 @@ jobs: tag_name: ${{github.event.release.tag_name}} file_name: release.md + - name: generate changelog of harmony + id: generate-changelog-of-harmony + uses: xile611/collect-release-changelog@main + with: + token: ${{ secrets.GITHUB_TOKEN }} + folder: ./packages/harmony_vchart/library + tag_name: ${{github.event.release.tag_name}} + file_name: CHANGELOG.md + - name: Push branch run: | git add . diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ef0350caf4..2020c87f2c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -118,10 +118,6 @@ jobs: with: version: ${{ steps.package-version.outputs.current_version }} - - name: Update changelog of harmony - run: node common/scripts/set-changelog-of-harmony.js ${{ steps.package-version.outputs.current_version }} | - ${{ steps.changelog.outputs.markdown }} - - name: Create Release for Tag id: release_tag uses: ncipollo/release-action@v1.12.0 diff --git a/common/scripts/set-changelog-of-harmony.js b/common/scripts/set-changelog-of-harmony.js deleted file mode 100644 index 2af2a7d40c..0000000000 --- a/common/scripts/set-changelog-of-harmony.js +++ /dev/null @@ -1,21 +0,0 @@ -const fs = require('fs') -const path = require('path') - -function setChangelogOfHarmny() { - const nextVersion = process.argv.slice(2)[0]; - const changelogContent = process.argv.slice(2)[1]; - const changelogPath = path.join(__dirname, '../../packages/harmony_vchart/library/CHANGELOG.md'); - let fileContent = fs.readFileSync(changelogPath, { encoding: 'utf-8' }); - - fileContent = ` -## ${nextVersion} - -${changelogContent} - -${fileContent} -`; - - fs.writeFileSync(fileContent, changelogPath) -} - -module.exports = setChangelogOfHarmny; \ No newline at end of file